Jérémie Bresson – 03.11.2015 Writing documentation with Asciidoctor
AsciiDoc
AsciiDoc example = Getting Started with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc].
AsciiDoc example
AsciiDoc example = Getting Started with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc].
Headings = Getting Started with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. Document Title Section Level 1
= Getting Started with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. Lists Unordered list items
Inline formatting = Getting Started with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. bold italic code
= Getting Started with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. Links link with title
= Getting Started with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. Admonition
Asciidoctor
 Asciidoctor is publishing toolchain for the AsciiDoc writing format.  Written in Ruby (and transpiled to JavaScript) (can be used with JRuby in the JVM)  Open Source (MIT Licence) Asciidoctor
Multiple Outputs  PDF  HTML pages  Eclipse Help guides
«Why is asciidoctor a great tool?»
Source code listings
A code snippet in your documentation == Usage of Mylyn wikitext With the method `toHtml(String)` in <<lst-wikitext1>> you can convert a text from Mediawiki Language to HTML. [[lst-wikitext1, Listing 1]] [source,java] ---- public static String toHtml(String mediawikiText) { StringWriter writer = new StringWriter(); MarkupParser parser = new MarkupParser(new MediaWikiLanguage(), n parser.parse(mediawikiText); return writer.toString(); } ----
Callout == Usage of Mylyn wikitext With the method `toHtml(String)` in <<lst-wikitext1>> you can convert a text from Mediawiki Language to HTML. [[lst-wikitext1, Listing 1]] [source,java] ---- public static String toHtml(String mediawikiText) { StringWriter writer = new StringWriter(); MarkupParser parser = new MarkupParser(new MediaWikiLanguage(), n parser.parse(mediawikiText); // <1> return writer.toString(); } ---- <1> Main call of the Mylyn Wikitext framework
Callout
Callout – Copy paste friendly
 code snippets corresponding to source code under control − Always up-to-date − Ease maintenance Real source code in your documentation == Usage of Mylyn wikitext With the method `toHtml(String)` in <<lst-wikitext1>> you can convert a text from Mediawiki Language to HTML. [[lst-wikitext1, Listing 1]] [source,java] ---- include::src/main/java/MediawikiTest.java[tags=method] ---- <1> Main call of the Mylyn Wikitext framework
Real source code in your documentation public class MediawikiTest { //tag::method[] public static String toHtml(String mediawikiText) { StringWriter writer = new StringWriter(); MarkupParser parser = new MarkupParser(new MediaWikiLanguage(), new H parser.parse(mediawikiText); // <1> return writer.toString(); } //end::method[] @Test public void test() { StringBuilder sb = new StringBuilder(); sb.append("= Heading 1 =n"); sb.append("n"); sb.append("Hello World!n"); sb.append("n"); sb.append("* Loremn");
Single source your documents
«AsciiDoc lets me do variable substitution and conditional inclusion» Wayne Beaton, Eclipse Foundation https://waynebeaton.wordpress.com/2015/08/10/new-eclipse-project-handbook/
One source, multiple output Eclipse Fundation Handbook LocationTech Handbook PolarSys Handbook …
Variable substitution Open source projects at the Eclipse Foundation are required to make use of certain Eclipse Foundation services: * All project issues must be tracked in the {bugzillaUrl}[{forgeName} Bugzilla]instance; :forgeName: Eclipse :bugzillaUrl: https://bugs.eclipse.org/bugs Eclipse Project Handbook ======================== include::chapters/resources.adoc[] eclipse.adoc resources.adoc
Variable substitution Open source projects at the Eclipse Foundation are required to make use of certain Eclipse Foundation services: * All project issues must be tracked in the {bugzillaUrl}[{forgeName} Bugzilla]instance; :forgeName: LocationTech :bugzillaUrl: https://www.locationtech.org/bugs LocationTech Project Handbook ============================= include::chapters/resources.adoc[] locationtech.adoc resources.adoc
Conditional inclusion ifeval::["{forgeName}"=="Eclipse"] _The Eclipse Foundation strongly encourages all projects to create an maintain and http://marketplace.eclipse.org[Eclipse Marketplace] presence._ endif::[]
Simple Tools (no setup)
Any text editor
 Extension for Chrome: Asciidoctor.js Live Preview Live preview in Chrome
JavaFX Codeeditors – Tom Schindl
Build
«Generating the documentation with Asciidoctor is always a straightforward experience» Julien Ponge, Eclipse Golo project https://julien.ponge.org/blog/an-experiment-in-maven-to-gradle-migration/
 Ruby, JavaScript, JVM environments  Integration with a lot of build systems: − Maven − Gradle  Dependencies available in several repositories − Maven central − JCenter − NPM  You can build on every machine, without a complex setup Build system
Edit on GitHub
Edit on GitHub
GitHub Editor
GitHub Preview
Eclipse Scout 2015 Thanks /@j2r2b /+JeremieBresson /jmini jeremie.bresson@bsi-software.com

Writing documentation with Asciidoctor

  • 1.
    Jérémie Bresson –03.11.2015 Writing documentation with Asciidoctor
  • 2.
  • 3.
    AsciiDoc example = GettingStarted with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc].
  • 4.
  • 5.
    AsciiDoc example = GettingStarted with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc].
  • 6.
    Headings = Getting Startedwith Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. Document Title Section Level 1
  • 7.
    = Getting Startedwith Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. Lists Unordered list items
  • 8.
    Inline formatting = GettingStarted with Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. bold italic code
  • 9.
    = Getting Startedwith Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. Links link with title
  • 10.
    = Getting Startedwith Java Author Name <author@example.org> == Hello World example Copy the *HelloWorld.java* file. TIP: The application prints _Hello World!_ to the console. * Compile this source to a class file using `javac`. * Run the compiled class file using `java`. If you need help with the Java syntax check the link:http://docs.oracle.com/javase/8/docs/[Java 8 Javadoc]. Admonition
  • 11.
  • 12.
     Asciidoctor ispublishing toolchain for the AsciiDoc writing format.  Written in Ruby (and transpiled to JavaScript) (can be used with JRuby in the JVM)  Open Source (MIT Licence) Asciidoctor
  • 13.
    Multiple Outputs  PDF HTML pages  Eclipse Help guides
  • 14.
    «Why is asciidoctora great tool?»
  • 15.
  • 16.
    A code snippetin your documentation == Usage of Mylyn wikitext With the method `toHtml(String)` in <<lst-wikitext1>> you can convert a text from Mediawiki Language to HTML. [[lst-wikitext1, Listing 1]] [source,java] ---- public static String toHtml(String mediawikiText) { StringWriter writer = new StringWriter(); MarkupParser parser = new MarkupParser(new MediaWikiLanguage(), n parser.parse(mediawikiText); return writer.toString(); } ----
  • 17.
    Callout == Usage ofMylyn wikitext With the method `toHtml(String)` in <<lst-wikitext1>> you can convert a text from Mediawiki Language to HTML. [[lst-wikitext1, Listing 1]] [source,java] ---- public static String toHtml(String mediawikiText) { StringWriter writer = new StringWriter(); MarkupParser parser = new MarkupParser(new MediaWikiLanguage(), n parser.parse(mediawikiText); // <1> return writer.toString(); } ---- <1> Main call of the Mylyn Wikitext framework
  • 18.
  • 19.
    Callout – Copypaste friendly
  • 20.
     code snippetscorresponding to source code under control − Always up-to-date − Ease maintenance Real source code in your documentation == Usage of Mylyn wikitext With the method `toHtml(String)` in <<lst-wikitext1>> you can convert a text from Mediawiki Language to HTML. [[lst-wikitext1, Listing 1]] [source,java] ---- include::src/main/java/MediawikiTest.java[tags=method] ---- <1> Main call of the Mylyn Wikitext framework
  • 21.
    Real source codein your documentation public class MediawikiTest { //tag::method[] public static String toHtml(String mediawikiText) { StringWriter writer = new StringWriter(); MarkupParser parser = new MarkupParser(new MediaWikiLanguage(), new H parser.parse(mediawikiText); // <1> return writer.toString(); } //end::method[] @Test public void test() { StringBuilder sb = new StringBuilder(); sb.append("= Heading 1 =n"); sb.append("n"); sb.append("Hello World!n"); sb.append("n"); sb.append("* Loremn");
  • 22.
  • 23.
    «AsciiDoc lets medo variable substitution and conditional inclusion» Wayne Beaton, Eclipse Foundation https://waynebeaton.wordpress.com/2015/08/10/new-eclipse-project-handbook/
  • 24.
    One source, multipleoutput Eclipse Fundation Handbook LocationTech Handbook PolarSys Handbook …
  • 25.
    Variable substitution Open sourceprojects at the Eclipse Foundation are required to make use of certain Eclipse Foundation services: * All project issues must be tracked in the {bugzillaUrl}[{forgeName} Bugzilla]instance; :forgeName: Eclipse :bugzillaUrl: https://bugs.eclipse.org/bugs Eclipse Project Handbook ======================== include::chapters/resources.adoc[] eclipse.adoc resources.adoc
  • 26.
    Variable substitution Open sourceprojects at the Eclipse Foundation are required to make use of certain Eclipse Foundation services: * All project issues must be tracked in the {bugzillaUrl}[{forgeName} Bugzilla]instance; :forgeName: LocationTech :bugzillaUrl: https://www.locationtech.org/bugs LocationTech Project Handbook ============================= include::chapters/resources.adoc[] locationtech.adoc resources.adoc
  • 27.
    Conditional inclusion ifeval::["{forgeName}"=="Eclipse"] _The EclipseFoundation strongly encourages all projects to create an maintain and http://marketplace.eclipse.org[Eclipse Marketplace] presence._ endif::[]
  • 28.
  • 29.
  • 30.
     Extension forChrome: Asciidoctor.js Live Preview Live preview in Chrome
  • 31.
  • 32.
  • 33.
    «Generating the documentation with Asciidoctoris always a straightforward experience» Julien Ponge, Eclipse Golo project https://julien.ponge.org/blog/an-experiment-in-maven-to-gradle-migration/
  • 34.
     Ruby, JavaScript,JVM environments  Integration with a lot of build systems: − Maven − Gradle  Dependencies available in several repositories − Maven central − JCenter − NPM  You can build on every machine, without a complex setup Build system
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.