Public...ocBook(3pm)
π Publican::Builder::DocBook π
okay bestie, so this is a Perl module manpage β a 3pm one, straight outta User Contributed Perl Documentation β and it's called Publican::Builder::DocBook. she's the one who takes your DocBook XML and turns it into, like, every other format. iconic behavior honestly.
πΈ NAME πΈ
Publican::Builder::DocBook β a module to Convert XML to various output formats. no cap, that's the whole job description.
β¨ SYNOPSIS β¨
use Publican::Builder::DocBook;
my $builder = Publican::Builder::DocBook->new();
$builder->clean_ids();
look at her. three lines. doing the most with the least. we love a low-effort entrance π
π¦ DESCRIPTION π¦
Manipulate DocBook XML and convert to other formats. that's it, that's the vibe. XML goes in, other formats come out π
π INTERFACE π
this is the part where we meet all the methods. buckle up, there's a lot of them and they're all kinda doing the most.
new
Create a new Publican::Builder::DocBook object. the origin story. the main character entrance β¨
build
Transform the source in to another format.
and then there's this absolute mess of a template fix that's just sitting here, flagged as a bug, and we're showing it to you verbatim because we do not edit the facts, bestie:
#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
);
not me showing you a #BUGBUG in the middle of a method description π it's giving "we know, we know."
transform
Run XSLT over XML. short. sweet. does what it says on the tin.
drupal_transform
Write csv file for drupal node import. very specific. very niche. very slay.
escape_xml
Escapes an input string so that it can be used in an XML Element. safety first, always π«Ά
get_nodes_order
Get all nodes with id from xml files in order. she's organized. she's type A. we stan.
get_chunk_filename
Gets the chunked filename for an LibXML::Node in a tree.
convert_num_to_alpha
Converts a numeric number to an alpha list item. ie 1 -> a, 27 -> aa. math girlies rise up π
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. cute, she does both π
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.
okay so that's three whole BUGBUGs stacked on top of each other. it's giving "known issues, we're working on it, please don't look directly at it" π
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.
footnotes
Convert DocBook footnotes in to HTML5 footnotes.
highlight2
Highlight code blocks in HTML5.
TODO replace with highlight.js??
not the open question mark TODO in the docs π she's leaving notes for herself fr fr.
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.
so like, she will tell you when you're wrong. respectfully. in a string format β¨
π CONFIGURATION AND ENVIRONMENT π
Publican requires no configuration files or environment variables.
ngl that's the best sentence in this whole page. zero setup. we love a low-maintenance queen π
π 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
look at that list. she has friends. she has a whole group chat of modules backing her up π«Ά
π 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.
okay so technically "no bugs have been reported" β but did we all collectively forget the four BUGBUGs and the TODO up in INTERFACE? anyway. not my business. I'm just the messenger π
πΈ AUTHOR πΈ
Jeff Fearn "<jfearn@redhat.com>"
and that's the whole page bestie!! π she's Publican...ocBook(3pm), she lives in perl v5.26.2, and she was dated 2018-07-08 β a whole vintage icon, aging like fine wine, still out here converting XML into literally everything πβ¨π
π¦ where this page comes from
- debian bookworm: publican 4.3.2-3 Β· Artistic-1.0-Perl OR GPL-2.0-or-later
- ubuntu jammy: publican 4.3.2-3 Β· Artistic-1.0-Perl OR GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms