Scroll to navigation

Publican::Builder(3) User Contributed Perl Documentation Publican::Builder(3)

NAME

Publican::Builder - A module to Convert XML to various output formats

VERSION

This document describes Publican::Builder version 0.1

SYNOPSIS

    use Publican::Builder;
    my $builder = Publican::Builder->new();
    $builder->clean_ids();

DESCRIPTION

Manipulate XML and convert to other formats.

INTERFACE

new

Create a new Publican::XmlBuilder object.

build

Transform the source in to another format.

FORMATS eclipse epub html html-single html-desktop pdf txt

Valid formats: eclipse epub html html-single html-desktop pdf txt

setup_xml

Create the proper directory structure for the XML, including copying in Brand files.

del_unwanted_dirs

Callback that deletes all unwanted directories from the given directory tree. Used to delete CVS and SVN files from the working directories.

del_unwanted_xml

Callback that deletes all unwanted xml from the given directory tree.

validate_xml

Ensure the XML validates against the DTD.

transform

Run XSLT over XML

clean_ids

Travers over the source XML and update the id's to match the standard format.

Updates all existing PO files with the new xref links.

adjustColumnWidths

Adjust column widths for XML Tables. Converts hard coded and relative withs to percentages.

Based on xsl-stylesheets-1.74.3/html/dtbl.xsl

 Get all the colwidth, NULL == * == 1*
 Convert $table_width to pt
 Convert all hard coded widths to pt
 $total_relative_width = $table_width
 subtract hard coded widths from $total_relative_width
 convert hard coded withs to a % of $table_width
 total all relative widths
 convert relative widths to a proportion of $total_relative_width
 convert relative widths to a % of $table_width

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

package_brand

Create the structure for the distributed files and save it as a tar.gz file

package_home

Package a book for use as a Publican Website home page.

build_rpm

Build an srpm for books and brands.

package

Create the structure for the distributed files and save it as a tar.gz file

Creates RPM Specfile and build SRPM.

TODO: Consider handling other package formats, deb etc.

change_log

Generate an RPM style change log from $xml_lang/Revision_History.xml

abstract

Generate an RPM style description from $lang/$TYPE_Info.xml

get_books

Fetch all the books for a set from a repo.

Supported Repos: SVN

build_set_books

Prepare XML from sub books for Remote Sets

new_tree

Create a new XML::TreeBuilder object with the required attributes for DocBook.

TODO: Make XmlClean use this.

dtd_string

Returns a valid DTD for the DocBook tag supplied.

Parameters: tag The root tag for this file dtdver The DTD version ent_file An entity file to include (optional)

NAME

Description

# my $lang = delete( $args->{lang} ) || croak(maketext("lang is a mandatory argument")); # # if ( %{$args} ) { # croak( maketext("unknown arguments: [_1]", join( ", ", keys %{$arg}) )); # }

    return;
}

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 Config::Simple Publican Publican::XmlClean Publican::Translate File::Copy::Recursive 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=Fedora&amp;version=rawhide&amp;component=publican>.

AUTHOR

Jeff Fearn "<jfearn@redhat.com>"

2010-11-23 perl v5.10.1