简体   繁体   English

Asciidoctor gradle插件

[英]Asciidoctor gradle plugin

Is there a way to exlude a folder from asciidoctor's gradle plugin so that it doesn't search for .adoc's in it. 有没有一种方法可以从asciidoctor的gradle插件中排除文件夹,以便它不会在其中搜索.adoc。

Here is what i have for now in my build.gradle: 这是我现在在build.gradle中拥有的:

asciidoctor {
    resources {
        from(sourceDir) {
            include 'img/**'
        }
    }
}

I tried something like this but it didn't work: 我尝试了类似的方法,但是没有用:

asciidoctor {
    resources {
        from(sourceDir) {
            include 'img/**'
            exclude 'extensions/**'
        }
    }
}

What you tried does exactly what you asked it to. 您尝试执行的操作完全符合您的要求。 You told the plugin that it should not search for resources in the directory extensions . 您告诉插件它不应在目录extensions搜索资源 This does not affect the sources that are transformed. 这不会影响已转换的 And actually, it has no effect, as only the img folder is included in the first place. 实际上,它没有任何效果,因为首先只包含img文件夹。

What you need instead is this: 您需要的是:

asciidoctor {
    sources {
        exclude 'extensions/**'
    }
}

Thanks to vampire the folder was correctly excluded however the resource folder wasn't copied anymore and is apperently a known bug. 感谢吸血鬼,该文件夹已被正确排除,但是资源文件夹不再被复制,并且显然是一个已知的错误。 This is the workaround I used to make it work how I intended to: 这是我用来使其达到预期目的的解决方法:

asciidoctor {
    sources {
        exclude 'extensions/**'
        exclude 'generated/*.txt'
        exclude 'img/**'
    }
}
task copyResources(type: Copy) {
    from ("src/main/asciidoc/img") {
        include '**'
    }
    into("${buildDir}/asciidoc/html5/img")
}

asciidoctor.dependsOn(copyResources)

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

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