【问题标题】:Custom CSS with JBoss jDocBook maven plugin使用 JBoss jDocBook maven 插件自定义 CSS
【发布时间】:2014-07-18 11:19:31
【问题描述】:

我正在尝试将自定义 CSS 文件包含到 jDocBook 插件生成的 HTML 中。 这是插件配置:

<plugin>
    <groupId>org.jboss.maven.plugins</groupId>
    <artifactId>maven-jdocbook-plugin</artifactId>
    <version>2.3.7</version>
    <extensions>true</extensions>
    <configuration>
        <sourceDocumentName>book.xml</sourceDocumentName>
        <imageResource>
            <directory>${basedir}/src/main/images</directory>
        </imageResource>
        <cssResource>
            <directory>${basedir}/src/main/css</directory>
        </cssResource>
        <formats>
            <format>
                <formatName>pdf</formatName>
                <stylesheetResource>classpath:/docbook/fo/docbook.xsl</stylesheetResource>
            </format>
            <format>
                <formatName>html</formatName>
                <stylesheetResource>classpath:/docbook/html/chunk.xsl</stylesheetResource>
            </format>
        </formats>
    </configuration>
</plugin>

我的src/main/css 中有一个名为driver.css 的文件。 构建后,此文件出现在 target/docbook/publish/en-US/html 旁边 book.html 下,但未包含在内。

我也试过添加

<?xml-stylesheet href="driver.css" type="text/css"?>

book.xml,但这似乎没有帮助。

我这里缺少任何配置参数吗?

【问题讨论】:

    标签: css maven plugins jboss docbook


    【解决方案1】:

    为了使用自定义 CSS 设置 HTML 输出样式,必须将 html.stylesheet=&lt;path to css file&gt; 传递给 XSLT 处理器。要使用 JDocBook 插件做到这一点,必须在 &lt;configuration&gt; 下添加以下内容:

    <configuration>
        ...
        <options>
            <transformerParameters>
                <html.stylesheet>driver.css</html.stylesheet>
            </transformerParameters>
        </options>
        ...
    </configuration>
    

    可惜plugin documentation中没有描述

    为了清楚起见,xml-stylesheet 是无关紧要的

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 2016-05-11
      • 1970-01-01
      • 2022-01-18
      • 1970-01-01
      • 2011-12-04
      相关资源
      最近更新 更多