Skip to content
Snippets Groups Projects
Commit 4af94e6c authored by Gerhard Gonter's avatar Gerhard Gonter
Browse files
parents
No related branches found
No related tags found
No related merge requests found
Showing
with 134 additions and 0 deletions
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
// Project: Web Reference Database (refbase) <http://www.refbase.net>
// Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
// original author(s).
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY. Please see the GNU General Public
// License for more details.
//
// File: ./cite/styles/cite_TextCitation.php
// Repository: $HeadURL: https://svn.code.sf.net/p/refbase/code/branches/bleeding-edge/cite/styles/cite_TextCitation.php $
// Author(s): Matthias Steffens <mailto:refbase@extracts.de>
//
// Created: 28-Sep-04, 23:46
// Modified: $Date: 2012-02-27 21:25:30 +0100 (Mon, 27 Feb 2012) $
// $Author: msteffens $
// $Revision: 1337 $
// This is a citation style file (which must reside within the 'cite/styles/' sub-directory of your refbase root directory). It contains a
// version of the 'citeRecord()' function that outputs a reference list from selected records according to the citation style defined
// by a user's custom text citation format (or by the default format given in '$defaultTextCitationFormat' in 'ini.inc.php').
// --------------------------------------------------------------------
// --- BEGIN CITATION STYLE ---
function citeRecord($row, $citeStyle, $citeType, $markupPatternsArray, $encodeHTML)
{
global $defaultTextCitationFormat; // defined in 'ini.inc.php'
global $userOptionsArray; // '$userOptionsArray' is made globally available by function 'generateCitations()' in 'search.php'
// output records suitable for citation within a text, e.g., like: "Ambrose 1991 {3735}", "Ambrose & Renaud 1995 {3243}" or "Ambrose et al. 2001 {4774}"
if (!empty($userOptionsArray) AND ($userOptionsArray['use_custom_text_citation_format'] == "yes")) // if the user wants to use a custom text citation format
$textCitationFormat = $userOptionsArray['text_citation_format'];
else // use the default text citation format that was specified by the admin in 'ini.inc.php'
$textCitationFormat = $defaultTextCitationFormat;
// this is a stupid hack that maps the names of the '$row' array keys to those used
// by the '$formVars' array (which is required by function 'parsePlaceholderString()')
// (eventually, the '$formVars' array should use the MySQL field names as names for its array keys)
$formVars = buildFormVarsArray($row); // function 'buildFormVarsArray()' is defined in 'include.inc.php'
if (preg_match("/RTF|LaTeX/i", $citeType))
{
$textCitationFormat = preg_replace("/([{}])/i", "\\\\1", $textCitationFormat); // in case of RTF or LaTeX output we need to escape braces in placeholder strings
$fallbackPlaceholderString = "<:authors[2| & | et al.]:>< :year:>< \{:recordIdentifier:\}>";
}
else
$fallbackPlaceholderString = "<:authors[2| & | et al.]:>< :year:>< {:recordIdentifier:}>";
// generate a text citation according to the given naming scheme:
$record = parsePlaceholderString($formVars, $textCitationFormat, $fallbackPlaceholderString); // function 'parsePlaceholderString()' is defined in 'include.inc.php'
// Perform search & replace actions on the text:
$searchReplaceActionsArray["(et +al\.)"] = $markupPatternsArray["italic-prefix"] . "\\1" . $markupPatternsArray["italic-suffix"]; // print 'et al.' in italic
$record = searchReplaceText($searchReplaceActionsArray, $record, false); // function 'searchReplaceText()' is defined in 'include.inc.php'
return $record;
}
// --- END CITATION STYLE ---
?>
This diff is collapsed.
refbase command line clients
============================
Author
------
Matthias Steffens <refbase@extracts.de>
About
-----
'refbase' is a command line client (written in perl) to search refbase.
'refbase_import' is a client to import references into refbase.
Use
---
Part I: Configuration
- Both scripts may be edited in a text editor. It is suggested that you set:
- %hosts
- %loginParams
Part II: Use
- Both scripts will print help if run with an argument of '-h' or '--help'
- They will print usage examples if run with '-X' or '--examples'
See also:
<http://cli.refbase.net>
This diff is collapsed.
This diff is collapsed.
endnote2refbase
===============
Author
------
Richard Karnesky <karnesky@gmail.com>
About
-----
This is an alternative to refbase's web-based import of Endnote data. It
allows Endnote users to export a text file which can be imported into the
refbase MySQL database.
Use
---
Part I: Endnote
- Copy refbase.ens into your Endnote styles directory.
On win32 systems, this is typically:
C:\Program Files\Endnote\Styles
On Mac systems, this is typically:
Macintosh HD\Applications\EndNote #\Styles
(where # corresponds to a version #)
- Open the Endnote file you wish to import into refbase.
- Choose the refbase Output Style
- Export to 'endnote.txt'
Part II: PHP [*]
- Executing 'php endnote2mysql.php' will produce 'import.txt'
('php' must be in your path or you should prefix it with the path to php)
Part III: Check it!
- As this is a preliminary script that has undergone little testing, it is
suggested that you look at 'import.txt' in spreadsheet software.
- New versions of Endnote dump UTF-8 data. You should be able to use this as
is if you have a UTF-8 database. If you don't have a UTF-8 database, you
should convert the file to the character encoding you do use (using iconv,
recode, or <http://www.motobit.com/util/charset-codepage-conversion.asp>).
Part IV: MySQL [*]
- From within your MySQL command line interpreter (mysql -u root literature -p):
LOAD DATA LOCAL INFILE "import.txt" INTO TABLE refs;
[*]If you are comfortable that the script works and are on a system with a POSIX
shell (nearly all *nix, including OS X; Windows through Cygwin or similar),
you may use Andreas Czerniak's en-importer.sh to automate Parts II-IV.
This diff is collapsed.
This diff is collapsed.
File added
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment