NAME¶
Publican::Builder::DocBook - A module to Convert XML to various output formats
SYNOPSIS¶
use Publican::Builder::DocBook;
my $builder = Publican::Builder::DocBook->new();
$builder->clean_ids();
DESCRIPTION¶
Manipulate DocBook XML and convert to other formats.
INTERFACE¶
new¶
Create a new Publican::Builder::DocBook object.
build¶
Transform the source in to another format.
#BUGBUG fix templates print( $OUT <<EOL \t\t\t\t\t\t<div class="group" id="[% prod %]-[% ver.replace('\\.', '-')%]-$sort"> \t\t\t\t\t\t\t<span>$term</span> EOL );¶
print( $OUT <<EOL
\t\t\t\t\t\t\t<span>$text</span>
EOL
) if ( $text && $text ne "" );
print( $OUT <<EOL
\t\t\t\t\t\t</div>
EOL
);
Run XSLT over XML
Write csv file for drupal node import
get_nodes_order¶
Get all nodes with id from xml files in order
build_drupal_book¶
Convert each html file into csv a row for drupal.
adjustColumnWidths¶
Adjust column widths for XML Tables. Converts hard coded to px and relative
withs to %.
FO input:
"<?xml version=\"1.0\"?>\n<fo:table-column
xmlns:fo=\"
http://www.w3.org/1999/XSL/Format\"
column-number=\"1\"
column-width=\"1*\"/>\n<fo:table-column
xmlns:fo=\"
http://www.w3.org/1999/XSL/Format\"
column-number=\"2\"
column-width=\"2*\"/>\n<fo:table-column
xmlns:fo=\"
http://www.w3.org/1999/XSL/Format\"
column-number=\"3\"
column-width=\"1*\"/>\n<fo:table-column
xmlns:fo=\"
http://www.w3.org/1999/XSL/Format\"
column-number=\"4\" column-width=\"3*\"/>\n"
HTML input:
"<?xml version=\"1.0\"?>\n<colgroup
xmlns=\"
http://www.w3.org/1999/xhtml\"><col
width=\"1*\"/><col width=\"2*\"/><col
width=\"1*\"/><col
width=\"3*\"/></colgroup>\n"
Returns: modified input tree which is XHTML or XML:FO
highlight¶
perl_highlight syntax highlighting
Edit highlight_color template in pdf.xsl and .perl_XXX in CSS to change
highlight colours
Returns: Modified input tree, which is DocBook XML.
insertCallouts¶
XSLT callout function for inserting Callout markup in to verbatim text.
Parameters: areaspec: the DocBook areaspec node set verbatim: the XHTML/XML:FO
tree to place gfx in
Returns: modified $verbatim
BUGBUG: BZ #561618 BUGBUG: The approach taken here does not work for tagged
content in the verbatim. BUGBUG: Need to walk the node tree in childnode
instead of using it as a string. BUGBUG: make sure class is being set
numberLines¶
perl_numberLines XSL function for numbering lines.
Returns: Modified input tree, which is DocBook XML.
web_labels¶
Determine if the labels use in the web navigation are different from the names
used for packaging.
change_log¶
Generate an RPM style change log from $xml_lang/Revision_History.xml
get_abstract¶
Return the abstract for the supplied language with all white space truncated.
## BUGBUG this should be moved to the DocBook sub classes
get_subtitle¶
Return the subtitle for the supplied language with white space truncated.
## BUGBUG this should be moved to the DocBook sub classes
get_author_list¶
Return the author list for the supplied language.
get_contributors¶
Return the contributor hash for the supplied language.
## BUGBUG this should be moved to the DocBook sub classes
get_keywords¶
Return the contributor hash for the supplied language.
## BUGBUG this should be moved to the DocBook sub classes
get_legalnotice¶
Return the legal notice for the supplied language.
## BUGBUG this should be moved to the DocBook sub classes
get_draft¶
Is the book in draft mode?.
## BUGBUG this should be moved to the DocBook sub classes
to_html¶
Convert an XML::Element node containing DocBook XML directly to HTML text.
headings¶
Create an array of all headings in DocBook XML.
links¶
Convert DocBook links in to HTML5 anchors.
Convert DocBook footnotes in to HTML5 footnotes.
highlight2¶
Highlight code blocks in HTML5.
TODO replace with highlight.js??
number_lines¶
Number lines in HTML5 code blocks.
toc¶
Create an HTML5 TOC.
DIAGNOSTICS¶
- "unknown args %s"
- All subs with named parameters will return this error when unexpected
named arguments are provided.
- "%s is a required argument"
- Any sub with a mandatory parameter will return this error if the parameter
is undef.
CONFIGURATION AND ENVIRONMENT¶
Publican requires no configuration files or environment variables.
DEPENDENCIES¶
Carp version Publican Publican::XmlClean Publican::Translate File::Path
File::pushd File::Find XML::LibXSLT XML::LibXML Cwd Archive::Tar DateTime
DateTime::Format::DateParse Syntax::Highlight::Engine::Kate HTML::TreeBuilder
HTML::FormatText Term::ANSIColor POSIX
INCOMPATIBILITIES¶
None reported.
BUGS AND LIMITATIONS¶
No bugs have been reported.
Please report any bugs or feature requests to
"publican-list@redhat.com", or through the web interface at
<
https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Publican&component=publican>.
AUTHOR¶
Jeff Fearn "<jfearn@redhat.com>"