预处理Docbook文件内容
我目前正在使用一个文档工具链,它具有以下步骤:
- 以 Textile 格式编写文档
- 将 Textile 文档转换为 Docbook ( Mylyn WikiText )
- 将 Docbook 转换为 PDF ( maven docbkx 插件 )
我对这个过程非常满意,我想自定义表格和图像在 PDF 中的呈现方式。也就是说,我想应用以下转换:
informaltable -> informabletable 规则=“全部”
imagedata -> imagedata scalefit="1" width="100%" contentdepth="100%"
我已经设置了自定义样式表,但我不确定是否或如何执行这些转换。
给定现有的文档文件,如何应用这些转换?
I am currently using a documentation toolchain which has the following steps:
- Write documentation in Textile format
- Convert Textile documentation to Docbook ( Mylyn WikiText )
- Convert Docbook to PDF ( maven docbkx plugin )
I am mostly satisfied with the process, and I'd like to customise how the tables and the images are rendered in the PDF. Namely, I'd like to apply the following transformations:
informaltable -> informaltable rules="all"
imagedata -> imagedata scalefit="1" width="100%" contentdepth="100%"
I've already set up a custom stylesheet, but I'm not sure if or how these transformations can be performed.
How can I apply these transformations, given an existing docbook file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能对你来说已经太晚了,但我想我还是会回复。
如果您有一个覆盖常规样式表某些行为的 XSL 样式表(Bob Stayton 称之为“自定义层”),您只需在 pom 文件中添加一行,告诉 docbkx 插件使用它。对于 XHTML 转换,它是htmlCustomization 元素,例如
src/main/docbkx/custom-article-html.xsl
对于 PDF 输出,它将是 foCustomization 元素:
src/main/docbkx/custom-article-print.xsl
诀窍是,在该自定义文件中,您必须更改导入语句以使用插件期望的符号路径:
这记录在 http://docbkx-tools.sourceforge.net/advanced.html
我的问题是,我也在使用自己的自定义标题页,这些标题页也导入到我的自定义层中,并且我一生都不知道如何告诉插件在哪里可以找到它。我可能能够接受 HTML 输出中的默认标题页布局,但不能接受打印。我最终放弃了,现在正在尝试 Maven XML 插件并直接应用 XSLT 转换。不过,我再次陷入困境。一旦我获得 PDF 中间步骤的 fo 文件,我似乎找不到可以将 FOP 应用于它们的 Maven 插件。实际上,我确实在 Maven Central 上找到了一个插件,但我找不到任何有关如何实际使用它的文档。只是这样:http://mavenhub.com/mvn/central/org。 apache.xmlgraphics/fop/1.0
This is probably too late to be useful to you, but I thought I'd reply anyway.
If you have an XSL stylesheet that overrides certain behaviors of the regular stylesheets (what Bob Stayton calls a "customization layer," you can simply add a line to your pom file that tells the docbkx plugin to use it. For the XHTML transformation, it's the htmlCustomization element. For example,
src/main/docbkx/custom-article-html.xsl
For PDF output it would be the foCustomization element:
src/main/docbkx/custom-article-print.xsl
The trick then is that in that customization file, you have to change your import statement to use the symbolic path that the plugin expects:
This is documented at http://docbkx-tools.sourceforge.net/advanced.html
My problem was that I was also using my own custom titlepages, which are also imported into my customization layer, and for the life of me I could not figure out how to tell the plugin where to find it. I might have been able to live with the default title page layout in my HTML output, but not for the print. I finally gave up and am now in the middle of trying the Maven XML plugin and applying the XSLT transformation directly. Once again I'm stuck, though. Once I get the fo files for the intermediate step to PDF, I can't seem to find a Maven plugin that can apply FOP to them. Actually I did find a plugin on Maven Central but I can't find any documentation of how to actually use it. Just this: http://mavenhub.com/mvn/central/org.apache.xmlgraphics/fop/1.0