The xml2rfc writer package contains a Base Writer Class interface (an abstract python class) with callback methods to write specific elements of an RFC document. Adding a new output format to xml2rfc would be done by extending this class.
Additionally, there is a collection of Formatted Writer Classes which provide implementations for various formats. Each writer takes an xmlrfc instance as a constructor argument, and has a single public write() method which converts and writes the rfc document to a specified filename.
The following writer implementations are provided in xml2rfc.
Writes to a text file, unpaginated, no headers or footers.
The page width is controlled by the width parameter.
Public method to write the RFC document to a file.
Writes to a text file, paginated with headers and footers
The page width is controlled by the width parameter.
Public method to write the RFC document to a file.
Writes to an nroff formatted file
The page width is controlled by the width parameter.
Public method to write the RFC document to a file.
The following interface provides all methods necessary for creation of an RFC document. To support a new format, the writer class must subclass BaseRfcWriter and override all methods–with the exception of write(), which contains the callback logic and should be left alone.
Base class for all writers
All public methods need to be overridden for a writer implementation.
Draws a formatted table from a <texttable> element
For HTML nothing is really ‘drawn’ since we can use <table>
Inserts a document anchor for internal links
Marks the current buffer position to insert the index at
Marks the current buffer position to insert ToC at
Last method that is called after traversing the XML RFC tree
First method that is called before traversing the XML RFC tree
Public method to write the RFC document to a file.
Writes the address information for an <author> element
Writes a section heading
Writes a table or figure label
Writes a paragraph of text
Writes a block of text that preserves all whitespace
Writes a <references> element
Recursively writes <t> elements
Writes the document title
Writes the finished buffer to a file
Writes the main document header
Takes two list arguments, one for each margin, and combines them so that they exist on the same lines of text