xml2rfc根据ietfxml2rfc v2和v3词汇表从xml文档源生成rfc和ietf草稿。

xml2rfc的Python项目详细描述


简介

IETF为标准和其他文档使用特定的格式 发布为RFCs,并用于在 为出版物开发文档。存在着许多不同的 根据 现有的规则,以及这个工具,{ 1 },即$ <强>,就是其中之一。作为输入 包含有关作者姓名的文本和元信息的XML文件 等等,并将其转换为适当格式的输出。输入XML文件 应该遵循RFC7749(对于v2文档)或RFC7991(对于 v3文档)。注意,v3的语法仍在改进中,并且 最终将在bis draft for 7991中捕获更改。 在xml2rfc源v3.rng中可以看到尚未捕获的更改。

xml2rfc提供多种输出格式。查看命令行 格式完整列表的帮助。它还提供从v2到 v3,并可以对其输入运行preptool

安装

python包的安装通常使用'pip install xml2rfc'完成, 使用适当的开关和/或sudo。

为pdf格式化程序安装支持库

为了生成pdf,xml2rfc使用weasyprint模块,它 依赖于必须作为本机软件包安装的外部库 在您的平台上,独立于xml2rfc安装。

首先,在您的 系统。请参阅weasyprint文档上的安装说明:

https://weasyprint.readthedocs.io/en/stable/install.html

(如果系统python是2.7,则不需要python 3)。

(在某些系统完整性保护处于活动状态的OS X系统上,您可以 需要创建从主目录到库安装的符号链接 目录(通常为/opt/local/lib):

ln -s /opt/local/lib ~/lib

为了让weasyprint找到已安装的cairo和pango库。 这是否需要取决于您使用的是MacPorts还是自制的 安装cairo和pango以及自制/macport版本。

接下来,使用pip安装pycairo和weasyprint python模块。 根据您的系统,您可能需要使用“sudo”或安装在 用户特定的目录,使用–user开关。在OS X上 特别是,您可能还需要安装较新版本的setuptools 在安装weasyprint之前使用–user。如果安装时使用 –user开关,您可能还需要设置pythonpath,例如

PYTHONPATH=/Users/henrik/Library/Python/2.7/lib/python/site-packages

对于Python2.7。

基本的pip命令(根据上面的文本根据需要修改) 是:

pip install ‘pycairo>=1.18’ ‘weasyprint<=0.42.3’

安装这些文件并提供给xml2rfc后,–pdf开关将 启用。

对于pdf输出,还需要安装noto字体集。下载完整的 从https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip设置, 并根据您的平台进行适当的安装。

用法

xml2rfc接受单个xml文档作为输入,并输出为一种或多种转换格式。

基本用法xml2rfc SOURCE [options] FORMATS...

运行xml2rfc --help获得命令行选项的完整列表。

更改日志

版本2.25.0(2019年8月26日)

This rounds up the remaining known issues raised by the RFC Editor staff. Commit log excerpt:

  • Rolled back an earlier requirements change, and added a restriction on pycountry due to a buggy release.
  • Fixed a number of issues with the xml generated for ToC and Index. This makes the ToC output from prepped files the same as from unprepped files, which was not the case earlier.
  • Fixed an log() argument error.
  • Modified test input files to silence known issues with legacy rfc xml test files, in order to more easily be able to see newly appearing errors.
  • Fixed a string formatting error. Fixes issue #417.
  • Changed processing progress messages to more consistently obey –quiet, and to be visually distinct from errors and warnings.
  • Modified the PI stripping so as to be able to silence warnings during preptool processing.
  • Added indentation handling for variations of <ol> on request from the rfc-editor staff.
  • Moved the check for appropriate <bcp14> content from the text renderer to the preptool, and tweaked it to permit &nbsp;, e.g., ‘MUST&nbsp;NOT’.
  • Added a base_url setting to avoid an error message during pdf generation.
  • Added an option –id-reference-base-url to set base url for rendering of <xref> with I-D section references, with a sensible default; and set a default value for –rfc-reference-base-url for <xref> with section= ease of use.
  • Tweaked the conditions for a preptool warning about missing docName to only apply in non-rfc mode, and added generation of any missing <link rel=’prev’> element from docName if present.
  • Widened the search for seriesInfo elements when handling the –rfc-reference-base-url option, in order to handle all possible placements, and fixed a bug in the creation of target URL when using this option.
  • Added a warning for <vspace> elements without proper v3 alternatives during v2v3 conversion.
  • Fixed a bug introduced in [3201] when stabilizing attribute order, which could cause errors when running v2v3 conversion with XInclude insertion.
  • Changed the code for –info dump to work for both py27 and py3x.
  • The –legacy-list-symbols option was checked for validity before the version attribute of the input file was seen. Moved this check (and some similar cases) later, in order to permit it to be used with v3 input without giving the –v3 option. Fixes issue #414.

版本2.24.0(2019年8月10日)

This release addresses a number of issues and minor feature requests from the RFC Editor. Excerpt from the commit log:

  • Added a switch –rfc-reference-base-url to specify an alternative base url when using <xref> section links.
  • Stabilized XML and HTML output attribute order. With lxml 4.40, the handling of attribute order changed for Py 3.6 and higher, to match the use of ordered dictionaries in Py3.6+. Initial attributes set on an element are now sorted by key value. This matches what lxml did previously, and still does for Py 2.7 and Py 3.[0-5]. Enforcing sorted initial attributes under Py 3.6+ makes our output more stable under varying versions of lxml and Python.
  • Added support for <xref> section references in the v3 text formatter. Refactored some of the xref handling in preptool. Added warnings for some xref attribute and content combinations that don’t make sense.
  • Tweaked the error message for use of -o with multiple output formats.
  • Tweaked the layout of v3 text front page to correctly handle unicode codepoints of different width than 1, in order to get correct line lengths for authors with CJK names.
  • Handled a problem with an unwanted space between year and the following comma in HTML <reference><date> rendering.
  • When using the built-in lxml Element remove() method, it unexpectedly removes not only the element, but also the element’s tail. Dealt with this by using our own remove() where needed.
  • Added pilcrows on <dd>, to match pilcrows on other list entries.
  • Removed address lines with only punctuation from the author address rendering, eliminating for instance lines containing only a comma.
  • Added a viewport meta tag, to improve rendering on some devices.
  • Added class ‘selfRef’ on some Figure and Table links that were missing it.
  • Changed the address format to always start with the author name, according to a conversation with the RFC-Editor staff in Prague.
  • Changed the V3 writer note() method to obey quiet and verbose in the same manner as log.note().
  • Changed the v3 validate() from being separate methods for the v2v3 converter and the preptool to a common method on BaseV3Writer.
  • Tweaked the <date> handling to make year ranges and fuzzy dates possible.
  • Fixed an issue where text was lost when immediately preceded by <xref>.
  • Added a –bom text format option, to insert a BOM mark at the beginning of the text format output. Also added a BOM test, and removed some irrelevant switches.
  • Made the line spacing of <sourcecode> the same as for <artwork>.
  • Removed stripping of horizontal whitespace at the start of artwork in list items.
  • Removed an unwanted attribute inheritance of ‘ulEmpty’ for <ul>.
  • Fixed an issue with the CSS stylesheet for compact <dl> lists.
  • Removed an unintentional change that would permit a ‘contributor’ author role.

版本2.23.1(2019年7月7日)

  • Fixed a bug in the handling of sha1 and base64 methods when generating cache names for references with query arguments.
  • Updated the license file to more strictly follow the BSD 3-Clause license, and changed the license field in the setup.py file to be more precise.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java对ServiceListener和ServiceTracker调用提供了哪些排序保证?   java找不到方法格式的符号(DateTimeFormatter)?   mysql有没有一种方法可以将TCPDump输出到一个文件中,并用Java对其进行过滤,每5秒钟用新数据覆盖一次该文件?   java如何最好地配置用户上传支持文件的上传位置   java我在Android上使用OData4j,我无法获取实体   JPA实体关系简单示例中的java获取错误   JAVANoClassDefFoundError:安卓。应用程序。用法安卓中的UsageStatsManager   Eclipse中javaoo代码分析   java MethodVisitor抛出类格式错误   java为什么在从ViewModel调用时,改型排队不起作用?   调试小程序Java控制台:删除跟踪消息大小限制   java复杂安卓活动动画   java如何在使用JDOM2解析XML时忽略注释内容   java通过循环创建文本字段   即使在bufferedwriter关闭后也未发现java文件异常   单链表恢复中的java错误