DocBookFormatter(3)

NAME
Lire::ReportParser::DocBookFormatter - Lire::ReportParser subclass which formats description.

SYNOPSIS
To format DocBook:

    use Lire::ReportParser::DocBookFormatter qw/dbk2txt/;
    my $txt = dbk2txt( "<para>Test</para>" );
In XML Report processors :

    package MyParser;
    use Lire::ReportParser::DocBookFormatter;
    use vars qw/@ISA/;
    @ISA = qw/Lire::ReportParser::DocBookFormatter/;
    sub handle_description {
        my ( $self, $desc ) = @_;
        print $desc;
    }

DESCRIPTION
This package defines a subclass of Lire::ReportParser that can handle the content of "description" element. Client only have to inherit from this module so that a new handle_description() method is available to process the text formatted DocBook description.

This module also provide a convenient dbk2txt() function which can be used to format a string containing DocBook elements into an ASCII equivalent.

USING Lire::ReportParser::DocBookFormatter
Lire::ReportParser processors that would like to work with text version of the description only have to inherit from Lire::ReportParser::DocBookFormatter. They shouldn't override the known_dbk_elements() method nor the known_dbk_pcdata_elements() method. If they override the element_start(), description_start or description_end() method, they must link to their parents' version using "SUPER::".

  PARAMETERS
The constructor recognize some parameters that can be used to control the behavior of the DocBook handling:

columns
    The number of columsn in which the DocBook text should be formatted. Defaults to 72.

target-user
    Select for which description the handle_description() event will be synthetized. The handle_description() method will only be invoked for description tailored to this target-user. Defaults to "sysadmin".

userlevel
    In description, the maximum level of elements that will be formatted. Defaults to "normal" (i.e. "advanced" elements aren't formatted.

  handle_description( $description )
This method is invoked after the closing tag of the "description" element is encoutered. The $description contains the description formatted in plain text.

FORMATTING DocBook SRINGS
If you have DocBook content in a string, like you can obtain from some of the Report Specifications object, you can format it in plain text using the dbx2txt() function.

  dbk2txt( $docbook_str, [$userlevel] )
Returns a plain text version of the DocBook XML fragment $docbook_str. You can set the "userlevel" according to which it should be formatted by using the $userlevel parameter.

This method will die() in case of error.

SEE ALSO
Lire::ReportParser(3pm)

VERSION
$Id: DocBookFormatter.pm,v 1.1 2002/07/28 19:29:17 flacoste Exp $

COPYRIGHT
Copyright (C) 2001 Stichting LogReport Foundation LogReport@LogReport.org

This file is part of Lire.

Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.

AUTHOR
Francis J. Lacoste <flacoste@logreport.org>