API:EPrints/XHTML
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
NAME
EPrints::XHTML - XHTML Module
SYNOPSIS
$xhtml = $repo->xhtml; $utf8_string = $xhtml->to_xhtml( $dom_node, %opts ); $xhtml_dom_node = $xhtml->input_field( $name, $value, type => "text" ); $xhtml_dom_node = $xhtml->hidden_field( $name, $value ); $xhtml_dom_node = $xhtml->text_area_field( $name, $value, rows => 4 ); $xhtml_dom_node = $xhtml->form( "get", $url ); $xhtml_dom_node = $xhtml->data_element( $name, $value, indent => 4 ); $page = $xhtml->page( %opts );
DESCRIPTION
The XHTML object facilitates the creation of XHTML objects.
METHODS
form
$node = $xhtml->form( $method [, $action] )
Returns an XHTML form. If $action isn't defined uses the current URL.
input_field
$node = $xhtml->input_field( $name, $value, %opts ) $node = $xhtml->input_field( "name", "Bob", type => "text" );
Returns an XHTML input field with name $name and value $value. Specify "noenter" to prevent the form being submitted when the user presses the enter key.
$node = $xhtml->hidden_field( $name, $value, %opts );
Returns an XHTML hidden input field.
text_area_field
$node = $xhtml->text_area_field( $name, $value, %opts )
Returns an XHTML textarea input.
data_element
$node = $xhtml->data_element( $name, $value, %opts )
Create a new element named $name containing a text node containing $value.
Options: indent - amount of whitespace to indent by
to_xhtml
$utf8_string = $xhtml->to_xhtml( $node, %opts )
Returns $node as valid XHTML.
to_text_dump
$string = $xhtml->to_text_dump( $tree, %opts )
Dumps the XHTML contents of $tree as a utf8 string, stripping tags and converting common HTML layout elements into their plain-text equivalent.
Options:
width - word-wrap after the given number of columns show_links - see below preformatted - equivalent to wrapping $tree in <pre></pre>
XHTML elements are removed with the following exceptions:
<br /> is replaced by a newline.
<p>...</p> will have a blank line above and below.
<img /> is replaced with the content of the alt attribute.
<hr /> will insert a line of dashes if width is set.
<a href="foo">bar</a> will be replaced by "bar <foo>" if show_links is set.
page
$page = $xhtml->page( $map, %opts )
Returns an EPrints::Page object describing an XHTML page filled out with the templates provided in $map.
$map is a hash of XHTML DOM fragments. At least "title" and "page" should be defined. Use "links" to add items to the header.
Option "page_id" set's the XML id of the <body> to be "page_YOURID". Useful when you want to use CSS to tweak elements on one page only.
Option "template" uses a different template to "default.xml".