Text::Amuse - Perl module to generate HTML and LaTeX documents from Emacs Muse markup.
Version 0.22
Typical usage which should illustrate all the public methods
use Text::Amuse; my $doc = Text::Amuse->new(file => "test.muse"); # get the title, author, etc. as an hashref my $html_directives = $doc->header_as_html; # get the table of contents my $html_toc = $doc->toc_as_html; # get the body my $html_body = $doc->as_html; # same for LaTeX my $latex_directives = $doc->header_as_latex; my $latex_body = $doc->as_latex; # do we need a \tableofcontents ? my $wants_toc = $doc->wants_toc; # (boolean) # files attached my @images = $doc->attachments; # at this point you can inject the values in a template, which is left # to the user. See the bundled muse-quick.pl for a real-life usage.
Create a new Text::Amuse object. You should pass the named parameter file, pointing to a muse file to process. Please note that you can't pass a string. Build a wrapper going through a temporary file if you need to pass strings.
file
Accessor to the Text::Amuse::Document object. [Internal]
Accessor to the file passed in the constructor (read-only)
Output the HTML document (and cache it in the object)
The directives of the document in HTML (title, authors, etc.), returned as an hashref.
Please note that the keys are not escaped nor manipulated.
Return the HTML formatted ToC, as a string.
Return a list of strings, each of them is a html page resulting from the splitting of the as_html output. Linked footnotes as inserted at the end of each page.
Return an internal representation of the ToC
Output the (Xe)LaTeX document (and cache it in the object), as a string.
Return true if a toc is needed because we found some headings inside.
The LaTeX formatted header, as an hashref. Keys are not interpolated in any way.
Report the attachments (images) found, as a list. This can be invoked only after a call (direct or indirect) to as_html or as_latex, or any other operation which scans the body, otherwise you'll get an empty list.
as_html
as_latex
The language code of the document. This method will looks into the header of the document, searching for the keys lang or language, defaulting to en.
lang
language
en
Same as above, but returns the human readable version, notably used by Babel, Polyglossia, etc.
Return a convenience hashref with the header fields set to true when they are defined in the document.
This way, in the template you can write doc.header_defined.subtitle without doing crazy things like doc.header_as_html.subtitle.size which relies on virtual methods.
doc.header_as_html.subtitle.size
Always return undef, because in the current implementation you can't switch language in the middle of a text. But could be implemented in the future. It should return an arrayref or undef.
Always return undef. When and if implemented, it should return an arrayref or undef.
Return a validated version of the #hyphenation header, if present, or the empty string.
#hyphenation
The updated manual can be found at http://www.amusewiki.org/library/manual and is also present between the test files (t/testfiles/manual.muse).
t/testfiles/manual.muse
Underlining has been dropped.
Emphasis and strong can also be written with tags, like <em>emphasis</em>, <strong>strong</strong> and <code>code</code>.
Added tag <sup> and <sub> for superscript and subscript.
Description lists have been dropped. (Lists work as usual).
The only tables supported are the native one (with ||| as separator).
Anchors are unsupported (mainly because of the confusing syntax and the PDF output).
Embedded lisp code and syntax highlight is not supported.
Exoteric stuff like citing from other resources is not supported.
The scope of this module is not to replicate all the features of the original implementation, but to use the markup for a wiki (as opposed as a personal and private wiki).
Marco Pessotto, <melmothx at gmail.com>
<melmothx at gmail.com>
Please report any bugs or feature requests to the author's email. If you find a bug, please provide a minimal muse file which reproduces the problem (so I can add it to the test suite).
You can find documentation for this module with the perldoc command.
perldoc Text::Amuse
Repository available at Gitorious: https://gitorious.org/text-amuse
The original documentation for the Emacs Muse markup can be found at: http://mwolson.org/static/doc/muse/Markup-Rules.html
This module is free software and is published under the same terms as Perl itself.
To install Text::Amuse, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Amuse
CPAN shell
perl -MCPAN -e shell install Text::Amuse
For more information on module installation, please visit the detailed CPAN module installation guide.