如何在使用 DITA-OT 3.0.4 转换的 html5 中覆盖默认值 css?

How can I override default css in html5 converting with DITA-OT 3.0.4?

我正在使用 DITA-OT 3.0.4。

我正在尝试使用以下命令将我的降价文件转换为 html5。

dita --input="note.ditamap" --output="out" --format=html5 --args.css=style.css --args.cssroot=metadata --args.copycss=yes --args.csspath=css

我有这些目录结构。

├── note.ditamap
├── metadata
│   ├── note.properties
│   └── style.css(this is my custom CSS)

上述命令的结果,转换成功,但输出html(即index.html)不包含自定义CSS.

我也尝试了这些命令和属性,但结果和以前一样。

dita --input="note.ditamap" --output="out" --format=html5 --propertyfile="metadata/note.properties"

这里是note.properties内容。

args.csspath = css
args.copycss = YES
args.css = style.css
args.cssroot = metadata

我发现输出 html 引用 ${DITA_INSTALL_DIR}/dita-ot-3.0.4/plugins/org.dita.html5/css/commonltr.css,所以我将我的 CSS 附加到它,我的预期输出即将到来,但我认为这不好,因为这些更改会影响所有其他项目。

我在GitHub上查看了一些文档和问题,但我还没有找到解决方案。你有什么建议吗?

参考文献:

您的 "args.cssroot" 是作为相对位置给出的 "metadata"。 该参数的文档说明如下:

   The value you enter here will be interpreted relative to the location of the input map file.

但从我在构建文件中看到的情况来看,这不是真的,相对位置似乎是相对于发布过程开始的当前文件夹(可能是 "DITA-OT\bin")。 所以也许你可以尝试将 args.cssroot 作为绝对路径传递,看看它是否更适合你。

通常在这种情况下,我不传递 args.cssroot,而是直接传递 "args.css" 作为绝对路径,这似乎也适用于我。