This is a user manual for an example project.
Introduction
This project does something. We just haven’t decided what that is yet.
Source Code
public boolean contains(String haystack, String needle) {
return haystack.contains(needle);
}
This page was built by the following command:
$ ./gradlew asciidoctor
Live Reload Support
The Gradle build also can support Live Reload
Start by running the build with the watch task
$ ./gradlew asciidoctor watch
This ensures if you modify example-manual.adoc then everything is rebuilt.
Open another terminal and run the liveReload task:
$ ./gradlew liveReload
Now you can use the Chrome or Firefox plugins to automatically reload your browser when the build completes.
After installing the Chrome LiveReload extension, you need to check the "Allow access to file URLs" checkbox in Tools > Extensions > LiveReload in order for it to work with local files. |
Now try editing example-manual.adoc and watching your browser. After a brief wait you will observe that the browser is automatically updated with your changes.
Images
Attributes
- asciidoctor-version
-
1.5.4
- safe-mode-name
-
unsafe
- docdir
-
/home/travis/build/rwinch/asciidoctor-gradle-examples/asciidoc-to-html-livereload-example/src/docs/asciidoc
- docfile
-
/home/travis/build/rwinch/asciidoctor-gradle-examples/asciidoc-to-html-livereload-example/src/docs/asciidoc/example-manual.adoc
- imagesdir
-
images
- project-version
-
1.0.0-SNAPSHOT
- sourcedir
-
/home/travis/build/rwinch/asciidoctor-gradle-examples/asciidoc-to-html-livereload-example/src/main/java
- endpoint-url
Includes
content from src/docs/asciidoc/subdir/_b.adoc.
content from src/docs/asciidoc/subdir/c.adoc.
Includes can be tricky! |
build.gradle
plugins {
id 'org.asciidoctor.convert' version '1.5.3'
id 'org.kordamp.gradle.livereload' version '0.2.1'
}
apply plugin: 'java'
apply plugin: 'org.asciidoctor.convert'
apply plugin: 'org.kordamp.gradle.livereload'
version = '1.0.0-SNAPSHOT'
asciidoctorj {
version = '1.5.4'
}
asciidoctor {
def source = project.sourceSets.main.java.srcDirs[0]
def build = file('build.gradle')
// add extra inputs since these include files that are included
inputs.dir source
inputs.dir source
attributes 'build-gradle': file('build.gradle'),
'sourcedir': source,
'endpoint-url': 'http://example.org',
'source-highlighter' : 'coderay',
'imagesdir':'images',
'toc':'left',
'icons': 'font',
'setanchors':'true',
'idprefix':'',
'idseparator':'-',
'docinfo1':'true'
}
liveReload {
docRoot asciidoctor.outputDir.canonicalPath
}