Files/Import BibTeX via CGI

From EPrints Documentation
Revision as of 12:03, 13 November 2006 by Ckeene (talk | contribs) (Add location of home script, and add a few details about where the code should go)
Jump to: navigation, search

To install bibimport you will need to modify home and /opt/eprints2/cfg/system-phrases-es.xml files.

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

In home script, put:

       ### Import BibTex? SGT_RULEZ
       {
               location=>"create",
               code=>"bibimport",
               page=>"bibimport",
               priv=>"deposit"
       },

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.

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

'pages',

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+)/) {
               $data->{'pagerange'}=$1."-".$2;
           } else {
               $data->{'pages'} = $t;
           }
       }