⧼vector-jumptocontent⧽

XPAGE Format: Difference between revisions

From EPrints Documentation
m Reverted edit of EwnDbb, changed back to last version by WikiSysop
 
Libjlrs (talk | contribs)
Added note about whitespace breaking phrases
Line 3: Line 3:
Stored in the [[EPrints_Directory_Structure/eprints3/archives/ARCHIVEID/cfg/lang/en/static|static]] folder, xpage files are portions of HTML that are rendered into static files when generate_static is run. Three tags are in the xpage namespace: xpage:page, xpage:title, and xpage:body.
Stored in the [[EPrints_Directory_Structure/eprints3/archives/ARCHIVEID/cfg/lang/en/static|static]] folder, xpage files are portions of HTML that are rendered into static files when generate_static is run. Three tags are in the xpage namespace: xpage:page, xpage:title, and xpage:body.


The beginning of index.xpage (which generates the site's index page) is as follows - the three tags are analogous to the html, title, and body tags of an HTML document, except the body is included within the site's template. It is recommended to use xhtml as the default namespace to ease writing. As with templates, [[EPrints Control Format]] tags may be used.  
The beginning of index.xpage (which generates the site's index page) is as follows - the three tags are analogous to the html, title, and body tags of an HTML document, except the body is included within the site's template. It is recommended to use xhtml as the default namespace to ease writing. As with templates, [[EPrints Control Format]] tags may be used.


<source lang="xml">
  <?xml version="1.0" encoding="iso-8859-1" standalone="no"  ?>
  <?xml version="1.0" encoding="iso-8859-1" standalone="no"  ?>
  <!DOCTYPE page SYSTEM "entities.dtd" >
  <!DOCTYPE page SYSTEM "entities.dtd" >
Line 11: Line 12:
   <xpage:body>Some example body text.</xpage:body>
   <xpage:body>Some example body text.</xpage:body>
  </xpage:page>
  </xpage:page>
</source>
When generate_statics is run, four static files are created for each xpage file. For index.xpage, these would be index.html (the HTML page), index.page (the contents of the xpage:body tag), index.title (the contents of the xpage:title tag), and index.title.textonly (the contents of the xpage:title with HTML tags stripped out). Note that these files are generated by generate_static, and shouldn't be edited by hand.


When generate_statics is run, four static files are created for each xpage file. For index.xpage, these would be index.html (the HTML page), index.page (the contents of the xpage:body tag), index.title (the contents of the xpage:title tag), and index.title.textonly (the contents of the xpage:title with HTML tags stripped out). Note that these files are generated by generate_static, and shouldn't be edited by hand.
2013-10-21 NOTE: Some versions of EPrints (3.3.10 and lower?) don't process phrases with pins in them properly from xpages. Whitespace in the phrase tag breaks the processor, resulting in a '[error in script]' message in the page, and something like ' EPScript error: Can't locate object method "tagName" via package "XML::LibXML::Text" at /usr/share/eprints/perl_lib/EPrints/XML/EPC.pm line 204' in the apache error logs.
This can be fixed by removing the whitespace:
<source lang="xml">
<!-- BROKEN -->
        <epc:phrase ref="lib/searchexpression:results_for">
            <epc:param name='title'>Test</epc:param>
        </epc:phrase>
<!-- OK -->
        <epc:phrase ref="lib/searchexpression:results_for"><epc:param name='title'>Test</epc:param></epc:phrase>
</source>
or possibly patching ~/perl_lib/EPrints/XML/EPC.pm with https://github.com/eprints/eprints/commit/10fc4e67fac54dc87c6968ac3be79c4cb121efcf

Revision as of 18:17, 21 October 2013

Stored in the static folder, xpage files are portions of HTML that are rendered into static files when generate_static is run. Three tags are in the xpage namespace: xpage:page, xpage:title, and xpage:body.

The beginning of index.xpage (which generates the site's index page) is as follows - the three tags are analogous to the html, title, and body tags of an HTML document, except the body is included within the site's template. It is recommended to use xhtml as the default namespace to ease writing. As with templates, EPrints Control Format tags may be used.

 <?xml version="1.0" encoding="iso-8859-1" standalone="no"  ?>
 <!DOCTYPE page SYSTEM "entities.dtd" >
 <xpage:page xmlns="http://www.w3.org/1999/xhtml" xmlns:xpage="http://eprints.org/ep3/xpage" xmlns:epc="http://eprints.org/ep3/control">
   <xpage:title>Welcome to <epc:phrase ref="archive_name" /></xpage:title>
   <xpage:body>Some example body text.</xpage:body>
 </xpage:page>

When generate_statics is run, four static files are created for each xpage file. For index.xpage, these would be index.html (the HTML page), index.page (the contents of the xpage:body tag), index.title (the contents of the xpage:title tag), and index.title.textonly (the contents of the xpage:title with HTML tags stripped out). Note that these files are generated by generate_static, and shouldn't be edited by hand.

2013-10-21 NOTE: Some versions of EPrints (3.3.10 and lower?) don't process phrases with pins in them properly from xpages. Whitespace in the phrase tag breaks the processor, resulting in a '[error in script]' message in the page, and something like ' EPScript error: Can't locate object method "tagName" via package "XML::LibXML::Text" at /usr/share/eprints/perl_lib/EPrints/XML/EPC.pm line 204' in the apache error logs. This can be fixed by removing the whitespace:

<!-- BROKEN -->
        <epc:phrase ref="lib/searchexpression:results_for">
            <epc:param name='title'>Test</epc:param>
        </epc:phrase>
<!-- OK -->
        <epc:phrase ref="lib/searchexpression:results_for"><epc:param name='title'>Test</epc:param></epc:phrase>

or possibly patching ~/perl_lib/EPrints/XML/EPC.pm with https://github.com/eprints/eprints/commit/10fc4e67fac54dc87c6968ac3be79c4cb121efcf