[EP-tech] Re: Creating new citation formats....
Ian Stuart
Ian.Stuart at ed.ac.uk
Tue Feb 4 15:43:46 GMT 2014
I cheated :)
In
<PATH_TO_ARCHIVE_ID>/cfg/plugins/EPrints/Plugin/Export/MyExporter.pm
sub output_dataobj {
my ( $plugin, $dataobj ) = @_;
my $exporter = 'Text';
my $session = $plugin->{session};
my $link;
my $cite = $dataobj->render_citation('myCitation');
my $text = EPrints::Utils::tree_to_utf8($cite) . "\n";
$text .= $dataobj->get_url() . "\n";
my @plugins = $session->plugin_list(
type => "Export",
can_accept => "dataobj/eprint",
is_advertised => 1,
is_visible => "all"
);
if ( scalar @plugins > 0 ) {
foreach my $plugin_id (@plugins) {
$plugin_id =~ m/^[^:]+::(.*)$/;
my $id = $1;
next unless $id eq $exporter;
my $plugin = $session->plugin($plugin_id);
$link = $plugin->dataobj_export_url($dataobj);
$text .= $link;
} ## end foreach my $plugin_id (@plugins)
} ## end if ( scalar @plugins >...)
$text .= "\n\n";
return $text;
} ## end sub output_dataobj
On 04/02/14 15:05, John Salter wrote:
> If the output of your export uses EPrints::Utils::tree_to_utf8 (text.pm does in 3.3.10), then you should (according to the documentation) be able to add an html line break, that will get converted to a newline:
> From ~/perl_lib/EPrints/Utils.pm:
> "$string = EPrints::Utils::tree_to_utf8( $tree, $width, [$pre], [$whitespace_before], [$ignore_a] )
>
> Convert a XML DOM tree to a utf-8 encoded string.
> If $width is set then word-wrap at that many characters.
> XHTML elements are removed with the following exceptions:
> <br /> is converted to a newline.
> <p>...</p> will have a blank line above and below.
> <img /> will be replaced with the content of the alt attribute.
> <hr /> will, if a width was specified, insert a line of dashes.
> <a href="foo">bar</a> will be converted into "bar <foo>" unless ignore_a is set.
> "
> - might just work!?
--
Ian Stuart.
Developer: ORI, RJ-Broker, and OpenDepot.org
Bibliographics and Multimedia Service Delivery team,
EDINA,
The University of Edinburgh.
http://edina.ac.uk/
This email was sent via the University of Edinburgh.
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the Eprints-tech
mailing list