1

我正在使用 DITA-OT 3.0.4。

我正在尝试使用以下命令将我的 markdown 文件转换为 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 上查看了一些文档和问题,但我还没有找到解决方案。你有什么建议吗?

参考:

4

1 回答 1

1

您的“args.cssroot”作为相对位置“元数据”给出。该参数的文档说明如下:

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

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

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

于 2018-05-18T06:29:43.973 回答