简体   繁体   English

摇篮和asciidoc

[英]Gradle and asciidoc

I am a bit confused about the options to use Gradle to convert my asciidoc files to PDF. 我对使用Gradle将asciidoc文件转换为PDF的选项有些困惑。 There is this GitHub repo with a set of examples using the following Gradle build file style (excerpt): GitHub存储库包含使用以下Gradle构建文件样式(摘录)的一组示例:

apply plugin: 'org.asciidoctor.convert'

asciidoctor {
  ...
}

using the Asciidoctor Gradle Plugin from here (github). 此处 (github)使用Asciidoctor Gradle插件。

On the other hand we have a description of an Asciidoctor Gradle Plugin here (official docs) or here (mrhaki) using this style: 另一方面,我们在这里 (官方文档)或在这里 (mrhaki)使用以下样式描述了Asciidoctor Gradle插件:

apply plugin: 'org.asciidoctor.gradle.asciidoctor'

asciidoctor {
  ...
}

So which one is the current (and correct) syntax? 那么当前(正确的)语法是哪一种? Which one am I supposed to use if I want to generate PDFs and include diagrams? 如果要生成PDF并包含图表,应该使用哪一个?

(Just to make it clear: I have only very limited Gradle experience ;) (只是要说清楚:我只有非常有限的Gradle经验;)

My build.gradle reads 我的build.gradle

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0'
        classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.11'
    }
}

apply plugin: 'org.asciidoctor.gradle.asciidoctor'

asciidoctor {
    backends = ['pdf']
    options = [
        attributes: [
            'pdf-stylesdir': file('src/docs/theme'),
            'pdf-style': 'myowntheme'
        ]
    ]
}

You can use search.maven.org to figure out the latest versions of the artifacts within group org.asciidoctor . 您可以使用search.maven.org来找出org.asciidoctor组中工件的最新版本。

Looking at apply plugin: 'org.asciidoctor.gradle.asciidoctor' the org.asciidoctor.gradle.asciidoctor is the pluginId . 查看apply plugin: 'org.asciidoctor.gradle.asciidoctor' org.asciidoctor.gradle.asciidoctorpluginId The pluginId is picked by the plugin developer. pluginId由插件开发人员选择。 I would use the recommendation from the official documentation. 我会使用官方文档中的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM