Skip to content
Complete AsciiDoc to PDF conversion with only one command
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
.gitattributes
.gitignore
LICENSE.txt
README.md
asciidoc-toolchain.gradle

README.md

AsciiDoc Toolchain

This is my AsciiDoc toolchain. I use it to convert my own work written in AsciiDoc to PDF via Saxon and FOP.

The toolchain is fast and reliable. You only need Java installed on your system. Everything else (including AsciiDoc, Saxon, and FOP) will automatically be downloaded by the toolchain. This is perfect if you want to get your AsciiDoc build process up and running in only a couple of seconds with only one command.

Running

The toolchain is built on Gradle. I highly recommend using Gradle Wrapper, so the build process can be triggered with only one command from the directory where your AsciiDoc file is.

./gradlew pdf

This command will compile the AsciiDoc file and generate a PDF.

Installing

You need a Gradle build file in order to use the toolchain. Create a file called build.gradle in the directory where your AsciiDoc source file is. Here's an example:

apply from: 'https://raw.github.com/michel-kraemer/asciidoc-toolchain/0.3/asciidoc-toolchain.gradle'

defaultTasks 'pdf'

task wrapper(type: Wrapper) {
    gradleVersion = '2.10'
}

Additionally, you need to add a file called gradle.properties where you have to define some settings. Here's a sample file:

SOURCE_DIR=src
SOURCE_FILE=src/article.asc
STYLESHEET=src/fo.xsl
FOP_CONF=src/fop.xconf

That's it! After that you can run Gradle to generate a PDF file. Of course, you may also create the Gradle wrapper first.

gradle wrapper

This will generate a file called gradlew in the directory where the build.gradle file is. The Gradle Wrapper is a bootstrap program that automatically downloads Gradle if it's not already installed on the system.

Tasks

The toolchain adds the following tasks to your build.

docbook
Runs AsciiDoc to create a DocBook XML in your `build` directory
fo
Perfoms an XSL transformation to convert the DocBook XML to FO
pdf
Runs FOP to generate a PDF
watch
Watches the source file and executes the `pdf` task if the file has changed

Contribution

This is a very rough version of my toolchain. There's a lot of space for improvements. The current version is configurable but more options may be added in the future.

If you like the toolchain and want to contribute you're more than welcome! Feel free to send me any comments, issues, or pull requests. I would be very glad to improve this little piece of code and to make it suitable for a broader audience. Thanks!

License

The toolchain is licensed under the Apache License, Version 2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You can’t perform that action at this time.