Text::Amuse::Output - Internal module for Text::Amuse output
The module is used internally by Text::Amuse, so everything here is pretty much internal only (and underdocumented).
\documentclass[DIV=9,fontsize=10pt,oneside,paper=a5]{scrbook} \usepackage{graphicx} \usepackage{alltt} \usepackage{verbatim} \usepackage[hyperfootnotes=false,hidelinks,breaklinks=true]{hyperref} \usepackage{bookmark} \usepackage[stable]{footmisc} \usepackage{enumerate} \usepackage{longtable} \usepackage[normalem]{ulem} \usepackage{wrapfig} % avoid breakage on multiple <br><br> and avoid the next [] to be eaten \newcommand*{\forcelinebreak}{~\\\relax} % this also works % \newcommand*{\forcelinebreak}{\strut\\{}} \newcommand*{\hairline}{% \bigskip% \noindent \hrulefill% \bigskip% } % reverse indentation for biblio and play \newenvironment{amusebiblio}{ \leftskip=\parindent \parindent=-\parindent \bigskip \indent }{\bigskip} \newenvironment{amuseplay}{ \leftskip=\parindent \parindent=-\parindent \bigskip \indent }{\bigskip} \newcommand{\Slash}{\slash\hspace{0pt}}
Constructor. Format can be ltx or html, while document must be a Text::Amuse::Document object.
ltx
html
Accessor to the Text::Amuse::Document object (read-only, but you may call its method on that.
Accessor to the current format (read-only);
True if the format is html
True if the format is latex
This method returns a array ref with the processed chunks. To get a sensible output you will have to join the pieces yourself.
We don't return a joined string to avoid copying large amounts of data.
my $splat_pages = $obj->process(split => 1); foreach my $html (@$splat_pages) { # ...templating here... }
If the format is html, the option split may be passed. Instead of a arrayref of chunks, an arrayref with html pages will be returned. Each page usually starts with an heading, and it's without <head> <body>. Footnotes are flushed and inserted at the end of each pages.
split
E.g.
print @{$obj->process};
Return the formatted header as an hashref with key/value pairs.
Add the footnote to the internal list of found footnotes.
Return the list of primary footnotes found as a list of elements.
Return the list of secondary footnotes found as a list of elements.
Main routine to transform a string to the given format
Options:
If set to true, do not parse the links and consider them plain strings
If set to true, parse the anchors and return two elements, the first is the processed string, the second is the processed anchors string.
Parse the provided string into a list of Text::Amuse::InlineElement objects.
Be sure that the strings passed are properly escaped for the current format, to avoid command injection.
When we catch an header, we save it in the Output object, so we can emit the ToC. Level 5 is excluded as per doc.
It returns the numerical index (so you can inject the id).
Clear out the list. This is called at the beginning of the main loop, so we don't collect duplicates over multiple runs.
Emit the formatted ToC (if any). Please note that this method works even for the LaTeX format, even if does not produce usable output.
This because we can test if we need to emit a table of contents looking at this without searching the whole output.
The output is a list of hashref, where each hashref has the following keys:
The level of the header. Currently we store only levels 1-4, defining part(1), chapter(2), section(3) and subsection(4). Any other value means something is off (a.k.a., you found a bug).
The index of the entry, starting from 1.
The output.
The hashrefs are returned as copies, so they are safe to manipulate.
Put an horizontal rule
If it's LaTeX, insert a newpage
Here we see if it's a single one or a link/desc pair. Then dispatch
Methods providing some fixed values
Regular expression to match image links.
Given the input string $link, return undef if it's not an image. If it is, return a Text::Amuse::Output::Image object.
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.