---
name: "Publican::Builder::DocBook"
section: "3pm"
platform: "linux"
package: "publican"
version: "4.3.2-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Publican::Builder::DocBook"
---

# Publican::Builder::DocBook(3pm)

A module to Convert XML to various output formats

## 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
                                    );
```

### transform

Run XSLT over XML

### drupal\_transform

Write csv file for drupal node import

### escape\_xml

Escapes an input string so that it can be used in an XML Element.

### get\_nodes\_order

Get all nodes with id from xml files in order

### 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

### 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.

### footnotes

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>"`
