生产epub从xml2rfc以编程方式

2024-04-29 11:56:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用xml2rfcNetJSON编写RFC,我发现可以通过在线服务xml2rfc.ietf.org以epub格式导出RFC,但我还没有找到一种不使用联机服务的简单方法以编程方式完成此操作。在

我使用一个脚本来自动更新链接到网站上的HTML版本的RFC草稿,我真的很想为ePub版本做同样的事情,目前我没有在网站上链接ePub版本,因为我必须手动更新它,这是很耗时的,所以我偶尔会这样做。在

在这种情况下有什么工具可以帮助我吗?在


Tags: 方法org版本脚本网站链接rfc格式
1条回答
网友
1楼 · 发布于 2024-04-29 11:56:53

xml2rfc不支持epub,webpage提到

EPub support is provided using version 0.8 of ebook-convert.

PS and RTF support are provided using a combination of wkhtmltopdf, pdf2ps and/or GNU enscript.

您可以尝试像EbookLib(通过pip安装)之类的库,也可以将calibre作为一个进程运行。在

更新:实际上,这毕竟是一行命令。在

安装calibre(在我的例子中是Ubuntu 15.10):

sudo apt-get install calibre  

运行命令(doc)(这是从epub到其他格式的,但是您可以用另一种方式来做)

^{pr2}$

您可以从各种输出格式中进行选择。(http://manual.calibre-ebook.com/cli/ebook-convert.html#epub-output-options


输出:

1% Converting input to HTML...
InputFormatPlugin: EPUB Input running
on /home/<user>/other/xml2rfc/Metamorphosis-jackson.epub
Found HTML cover OEBPS/front-cover.html
Parsing all content...
MediaQuery: Unknown media type "amzn-kf8".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
MediaQuery: Unknown media type "amzn-mobi".
34% Running transforms on ebook...
Merging user specified metadata...
Detecting structure...
        Detected chapter: CHAPTER I
        Detected chapter: CHAPTER II
        Detected chapter: CHAPTER III
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Cleaning up manifest...
Trimming unused files from manifest...
Creating PDF Output...
67% Running PDF Output plugin
The cover image has an id != "cover". Renaming to work around bug in Nook Color
71% Rendered title-page.html
76% Rendered copyright.html
81% Rendered table-of-contents.html
85% Rendered pressbooks-promo.html
90% Rendered chapter-001-chapter-i.html
95% Rendered chapter-002-chapter-ii.html
100% Rendered chapter-003-chapter-iii.html
Rendered PDF in 0.915601 seconds:
PDF output written to /home/<user>/other/xml2rfc/something.pdf
Output saved to   /home/<user>/other/xml2rfc/something.pdf

相关问题 更多 >