An open API service indexing awesome lists of open source software.

https://github.com/forge/asciidoctorj-addon

AsciidoctorJ add-on for Forge 2
https://github.com/forge/asciidoctorj-addon

Last synced: 12 months ago
JSON representation

AsciidoctorJ add-on for Forge 2

Awesome Lists containing this project

README

          

== asciidoctorj-addon
:idprefix: id_

image:https://travis-ci.org/forge/asciidoctorj-addon.svg?branch=master["Build Status", link="https://travis-ci.org/forge/asciidoctorj-addon"]

This addon provides *standalone* functionality, and *exports services* for use in other addons.

=== Depends on
[options="header"]
|===
|Addon |Exported |Optional
|resources
|yes
|no
|===

== Setup

This Addon requires the following installation steps.

=== Add configuration to pom.xml

To use this addon, you must add it as a dependency in the *pom.xml* of your `forge-addon` classified artifact:
[source,xml]
----

org.jboss.forge.addon
asciidoctorj-addon
forge-addon
${version}

----
== Features
AsciidocFileResource for Asciidoc files::
Allows easy manipulation of asciidoc data
+
[source,java]
----
@Inject private ResourceFactory factory;
...
AsciidocFileResource resource = factory.createResource(AsciidocFileResource.class, new File("document.adoc"));
Document document = resource.getDocument();
Section section = (Section) document.blocks().get(1);
// More info in https://github.com/asciidoctor/asciidoctorj#jruby-wrapping-classes
...
----
+
[TIP]
====
If your addon uses a container that does not support "@Inject" annotations, services such as the `ResourceFactory` may also be
accessed via the `AddonRegistry`:
----
Imported imported = addonRegistry.getServices(ResourceFactory.class);
ResourceFactory factory = imported.get();
----
====