- Changelog
- Installation
- Docker container
- Updating xml2rfc
- Usage
- Contributing
- Getting Started
- Release Procedure
The IETF uses a specific format for the standards and other documents it publishes as RFCs, and for the draft documents which are produced when developing documents for publications. There exists a number of different tools to facilitate the formatting of drafts and RFCs according to the existing rules, and this tool, xml2rfc, is one of them. It takes as input an xml file that contains the text and meta-information about author names etc., and transforms it into suitably formatted output. The input xml file should follow the grammars in RFC7749 (for v2 documents) or RFC7991 (for v3 documents).
RFCXML vocabulary reference is available at authors.ietf.org.
xml2rfc provides a variety of output formats. See the command line help for a full list of formats. It also provides conversion from v2 to v3, and can run the preptool on its input.
xml2rfc is available as Python package and container image (see Docker-container-usage).
You can install the python package with the following command:
pip install xml2rfcIf you're using pipx, you can install xml2rfc with the following command:
pipx install xml2rfcxml2rfc also provides pdf extra package to install required packages required for PDF file generation.
See next section about additional requirements for PDF generation.
To install xml2rfc with PDF generation support run:
pip install "xml2rfc[pdf]"To install pdf extra with pipx run:
pipx install "xml2rfc[pdf]"In order to generate PDFs, xml2rfc uses the WeasyPrint module, which depends on external libraries that must be installed as native packages on your platform, separately from the xml2rfc install.
-
First, install the Pango, and other required libraries on your system. See installation instructions on the WeasyPrint Docs.
-
Next, install WeasyPrint python modules using pip.
pip install "xml2rfc[pdf]"- Finally, install the required fonts:
- Download latest fonts from xml2rfc-fonts.
- In the Assets section, download either the
tar.gzor theziparchive. - Extract the contents of the downloaded
xml2rfc-fontsarchive. - Install the fonts found in the
notoandroboto_monodirectories to your operating system.
With these installed and available to xml2rfc, the --pdf switch will be enabled.
A series of docker images are available to accommodate various use cases. The table below describes the features of each image type.
| Docker image name | Description |
|---|---|
| xml2rfc-slim | xml2rfc without PDF support; small image. |
| xml2rfc-base | xml2rfc with PDF generation and required fonts; large image. |
| xml2rfc-dev | xml2rfc with multiple Python versions and development tools; large image for developers. |
Example using the xml2rfc-slim image:
docker run --rm `# automatically remove container upon termination` \
-v "$(pwd):/data" `# bind current working directory to /data` \
ghcr.io/ietf-tools/xml2rfc-slim:latest \
--html example.xml
# if input is example.xml, output will be example.htmlSingle line:
docker run --rm -v "$(pwd):/data" ghcr.io/ietf-tools/xml2rfc-slim:latest --html example.xmlDevelopment images are further documented under #docker-dev-environment.
Docker image versions follow the regular release versioning. Use a versioned tag to ensure reproducibility in CI / CD:
docker run --rm -v "$(pwd):/data" ghcr.io/ietf-tools/xml2rfc-slim:v3.32.0 --html example.xmlTo update xml2rfc, run the following command:
pip install --upgrade xml2rfcIf you are using pipx, you can update it with:
pipx upgrade xml2rfcxml2rfc accepts a single XML document as input and outputs to one or more conversion formats.
xml2rfc SOURCE [options] FORMATS...Run xml2rfc --help for a full listing of command-line options.
This project is following the standard Git Feature Workflow development model. Learn about all the various steps of the development workflow, from creating a fork to submitting a pull request, in the Contributing guide.
Make sure to read the Styleguides section to ensure a cohesive code format across the project.
You can submit bug reports, enhancements and new feature requests in the discussions area. Accepted tickets will be converted to issues.
As outlined in the Contributing guide, you will first want to create a fork of the xml2rfc project in your personal GitHub account before cloning it.
For example (replace USERNAME with your GitHub username):
git clone https://github.com/USERNAME/xml2rfc.gitRun ./run.sh command to build and start a docker development environment.
The initial build may take time because it downloads all required fonts as well.
./run.sh