NAME
Text::Amuse::Functions - Exportable functions for Text::Amuse
SYNOPSIS
This module provides some functions to format strings wrapping the OO interface to function calls.
use Text::Amuse::Functions qw/muse_format_line/
my $html = muse_format_line(html => "hello 'world'");
my $ltx = muse_format_line(ltx => "hello #world");
FUNCTIONS
muse_format_line ($format, $string)
Output the given chunk in the desired format (html
or ltx
).
This is meant to be used for headers, or for on the fly escaping. So lists, footnotes, tables, blocks, etc. are not supported. Basically, we process only one paragraph, without wrapping it in <p>.
muse_fast_scan_header($file, $format);
Open the file $file, which is supposed to be UTF-8 encoded. Decode the content and read its Muse header.
Returns an hash reference with the metadata.
If the second argument is set and is ltx
or <html>, filter the hashref values through muse_format_line
.
It dies if the file doesn't exist or can't be read.
muse_to_html($body);
Format the $body text (assumed to be decoded) as HTML and return it. Header is discarded.
$body can also be a reference to a scalar to speed up the argument passing.
muse_to_tex($body);
Format the $body text (assumed to be decoded) as LaTeX and return it. Header is discarded
$body can also be a reference to a scalar to speed up the argument passing.
muse_to_object($body);
Same as above, but returns the Text::Amuse document instead.
muse_rewrite_header($file, { header1 => value, header2 => value2 })
Rewrite the headers of the given file, adding/replacing the header where appropriate.