Difference between revisions of "Files/Export metadata in BIBTEX-format"

From EPrints Documentation
Jump to: navigation, search
(citations-en.xml)
(ArchiveRenderConfig.pm)
Line 59: Line 59:
 
The BIBTEX-Entry
 
The BIBTEX-Entry
  
my $bibtexid = new EPrints::EPrint?(
+
my $bibtexid = new EPrints::EPrint(
  $eprint->{session},
+
        $eprint->{session},
  $eprint->get_value( "eprintid" ) );
+
        $eprint->get_value( "eprintid" ) );
my $bibtex;
+
    my $bibtex;
$bibtex = $session->make_element( "a",  
+
    $bibtex = $session->make_element( "a",  
      href=>$eprint->{session}->get_archive()->get_conf( "" )."/data/".$bibtexid->get_value( "eprintid" ).".bibtex", target=>'_blank');
+
        href=>$eprint->{session}->get_archive()->get_conf( "" )."/data/".$bibtexid->get_value( "eprintid" ).".bibtex", target=>'_blank');
  
 +
    $bibtex->appendChild(
 +
        $bibtexid->render_citation( "bibtexitem") );
  
$bibtex->appendChild(
+
    $table->appendChild( _render_row(
$bibtexid->render_citation( "bibtexitem") );
+
        $session,
 
+
        $session->html_phrase( "page:BibTex?" ),
 
+
        $bibtex ) );
 
+
$table->appendChild( _render_row(
+
$session,
+
$session->html_phrase( "page:BibTex?" ),
+
$bibtex ) );
+

Revision as of 11:56, 27 June 2006

For using this script you have to make some changes in

  • the citations-en.xml,
  • the phrases-en.xml,
  • the ArchiveConfig.pm,
  • the ArchiveRenderConfig.pm

citations-en.xml

two new entries in the citations-en.xml

<ep:citation type="eprint_bibtexitem">
    <ep:linkhere>
        <ep:ifset name="title">BibTex</ep:ifset>
        <ep:ifnotset name="title">Untitled @eprintid@</ep:ifnotset>
    </ep:linkhere>
</ep:citation>

I create a special citation type for a better parsing

<ep:citation type="eprint_bibtex">
   Citation-begin <ep:linkhere>
   <span class="citation">
   Aut-begin author = {@authors@} Aut-end
   <ep:ifset name="year"> Year-begin year = {@year@} Year-end</ep:ifset>
   Title-begin title = {@title@} Title-end
   <ep:ifset name="editors"> Editor-begin editor = {@editors@} Editor-end</ep:ifset>
   <ep:ifset name="volume"> Volumne-begin volume = {@volume@} Volumne-end</ep:ifset>
   <ep:ifset name="pages"> Pages-begin pages = {@pages@} Pages-endType-end</ep:ifset>
   <ep:ifset name="confloc">, @confloc@</ep:ifset>
   <ep:ifset name="confdates">, @confdates@</ep:ifset>
   <ep:ifset name="conference"> Conference-begin booktitle = {@conference@, @confloc@, @confdates@} Conference-end</ep:ifset>
   <ep:ifset name="chapter"> Chapter-begin chapter = {@chapter@} Chapter-end</ep:ifset>
   <ep:ifset name="publisher"> Publisher-begin publisher = {@publisher@} Publisher-end</ep:ifset>
   <ep:ifset name="publication"> Publication-begin journal = {@publication@} Publication-end</ep:ifset>
   <ep:ifset name="institution"> Institution-begin institution = {@institution@} Institution-end</ep:ifset>
   <ep:ifset name="number"> Number-begin number = {@number@} Number-end</ep:ifset> 
   Citation-end
   </span>
   </ep:linkhere>
</ep:citation>

phrases-en.xml

<ep:phrase ref="viewname_eprint_bibtex">Bibtex</ep:phrase>

and

<ep:phrase ref="page:BibTex">Display Formats</ep:phrase>

ArchiveConfig.pm

{ id=>"bibtex", fields=>"year", order=>"title/authors", citation=>"bibtex", nohtml=>1, nolink=>1, include=>1, nocount=>1},

ArchiveRenderConfig.pm

The BIBTEX-Entry

my $bibtexid = new EPrints::EPrint(
       $eprint->{session},
       $eprint->get_value( "eprintid" ) );
   my $bibtex;
   $bibtex = $session->make_element( "a", 
       href=>$eprint->{session}->get_archive()->get_conf( "" )."/data/".$bibtexid->get_value( "eprintid" ).".bibtex", target=>'_blank');
   $bibtex->appendChild(
       $bibtexid->render_citation( "bibtexitem") );
   $table->appendChild( _render_row(
       $session,
       $session->html_phrase( "page:BibTex?" ),
       $bibtex ) );