LaTeXDo...ormatter(3pm)
π NAME π
Okay bestie, so Lire::ReportParser::LaTeXDocBookFormatter is literally a Lire::DocBookParser subclass that formats descriptions into LaTeX. It's giving "I speak fluent LaTeX so you don't have to" energy, no cap. π
β¨ SYNOPSIS β¨
So you wanna convert a DocBook description to LaTeX? Obsessed. Here's the vibe:
use Lire::ReportParser::LaTeXDocBookFormatter qw/dbk2latex/;
my $LaTeX = dbk2latex( "<para>Test</para>" );
That's it. That's the whole thing. Slay. π
π¦ DESCRIPTION π¦
This package implements methods that can handle the content of "description" elements, and it can be used by a subclass of Lire::ReportParser. Basically, clients only have to inherit from this module so that a handle_description() method is available to process the text formatted DocBook description. It's literally that easy, iykyk. β¨
This module also provides a convenient dbk2txt() function which can be used to format a string containing DocBook elements into an ASCII equivalent. Lowkey iconic of it, honestly. πΈ
π USING Lire::ReportParser::LaTeXDocBookFormatter π
Okay so listen up, because this part matters fr fr. π
Lire::ReportParser processors that would like to work with the text version of the description should inherit from Lire::ReportParser::LaTeXDocBookFormatter in addition to Lire::ReportParser. Two parents, one iconic child. Main character energy. π«Ά
If they override the description_start() and description_end() methods, they must link to their parents' version using "SUPER::". Don't skip this bestie, it's not optional. π
Additionally, they should merge the value elements_spec() in their elements_spec() implementation. (And yes, the original doc spells it "Additionnally" β we respect the lore. π)
The Lire::ReportParser::LaTeXDocBookFormatter should be listed before Lire::ReportParser in the @ISA. The LaTeXDocBookFormatter doesn't inherit directly from Lire::ReportParser so that it can be used in multiple inheritance scenarios. It's flexible like that. π§
dbk_start_processing()
Initializes the parser's structure for formatting DocBook XML as ASCII. This is used from the description_start implementation. Setting the stage, if you will. β
dbk_end_processing()
Cleans the parser structure. This is used from the description_end() implementation. Tidy queen behavior. π
handle_description( $description )
This method is invoked after the closing tag of the "description" element is encountered. The $description contains the description converter to LaTeX. It's literally just doing its job. π
π₯ PROCESSING LaTeX DESCRIPTION π₯
The generated LaTeX is encoded in UTF-8, so Omega must be used to process it. Don't @ me, that's just the rules. β οΈ
Additionally, the result of calling dbk_latex_environment() should be added to the document preamble. It adds some environment and command definitions used by the formatter. So like, don't forget this part or things get weird. π
π FORMATTING DocBook STRINGS π
If you have DocBook content in a string β like you can obtain from some of the Report Specifications object β you can convert it to LaTeX by using the dbx2latex() function. (Yes, the doc says dbx2latex() here and dbk2latex up top. We don't fix the lore, we honor it. π)
dbk2txt( $docbook_str, [$columns] )
Returns a plain text version of the DocBook XML fragment $docbook_str. The "columns" parameter sets the number of columns in which the DocBook text should be formatted.
Heads up bestie: this method will die() in case of error. Not a vibe, but forewarned is forearmed. π
π SEE ALSO π
Lire::ReportParser(3pm)β go read it, it's the whole context. π«Ά
π VERSION π
$Id: LaTeXDocBookFormatter.pm,v 1.4 2006/07/23 13:16:31 vanbaal Exp $
π COPYRIGHT π
Copyright (C) 2004 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. (Not me being legally required to yell that part. π)
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.
πΈ AUTHOR πΈ
Francis J. Lacoste <flacoste@logreport.org>
Okay that's the whole page bestie, you ate that. π β¨ This was Lire 2.1.1, dated 2025-09-28 β go forth and format your DocBook like the icon you are. ππ¦
π¦ where this page comes from
- arch rolling: lire 2.1.1-8 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms