Difference between revisions of "Files/Import BibTeX via CGI"

From EPrints Documentation
Jump to: navigation, search
(add stuff from the old wiki about downloading the file, installing perl modules, and create headnigs/TOC)
Line 9: Line 9:
     * Files: bibimport  
     * Files: bibimport  
== Overview ==
== Download the script ==
* download file
* Install perl modules
* edit home script
* edit system-phrases-es.xml
== Download file ==
Drop [http://files.eprints.org/29/ this file] into /cgi/users/
Drop [http://files.eprints.org/29/ this file] into /cgi/users/

Revision as of 12:26, 13 November 2006

This allows a user to cut and paste a bibtex record into a form, and it will create a new eprint in their inbox based on the values in the bibtex.

File moved to http://files.eprints.org/29/

   * Contributor: Christopher Gutteridge
   * Eprints version: 2.3
   * Purpose: CGI script to import a single bibtex record operable by individual users
   * License: GNU General Public License
   * Files: bibimport 

Download the script

Drop this file into /cgi/users/

Install perl modules

You'll need to install these modules from CPAN:


To install these packages, please make sure you do these steps:

 * perl -MCPAN -e shell
 * get Text::BibTeX
 * exit
 * cd ".cpan/build/Text-BibTeX-0.36/"
 * perl Makefile.PL
 * make
 * make test
 * make install

edit home script

The home script is located in eprints2 at: /opt/eprints2/cgi/users

In home script, put:

       ### Import BibTex? SGT_RULEZ

This should go within the 'my $tools' section where you will find similar entries, if you are adding this to the end of the list, make sure you add a comma to the preceding entry, and remove the comma from the end of the code above.

Edit system-phrases-es.xml

And in /opt/eprints2/cfg/system-phrases-es.xml file, put this:

<ep:phrase ref="cgi/users/home:bibimport_link">Importar Objeto a partir de BibTeX</ep:phrase>
<ep:phrase ref="cgi/users/home:bibimport_info"><p>Esto permitirá importar publicaciones a partir del BibTex?. Sólo es necesario copiar el c ontenido en formato BibTex? en el formulario correspondiente, y la publicación será incluida en el repositorio de EPrints.</p></ep:phrase>

Suggestion for a patch

Jussi Karlgren, SICS

Most BibTeX users use the "pages" field to indicate page range rather than the number of pages in the entire book. The script as it stands moves the "pages" field from BibTeX into the "pages" field in EPrints.

Remove the line


from the long sequence of BibTeX field names in the foreach clause about halfway in the bibimport code and instead add the clause:

  if (defined $entry->get('pages')) {
           my $t = $entry->get('pages');
           if ($t =~ m/(\d+)-+(\d+)/) {
           } else {
               $data->{'pages'} = $t;