/asciidoctor-block-switch

Provide multiple block switches for AsciiDoctor.

Primary LanguageJavaScript

asciidoctor-block-switch

Provide block switches for asciidoctor (only works in HTML).
Inspired from spring-asciidoctor-extensions.

git clone https://github.com/jjyyjjyy/asciidoctor-block-switch.git
cd asciidoctor-block-switch
mvn clean package

Copy the generated jar file into your project, eg: lib directory .

pom.xml
    <build>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>2.1.0</version>
                <dependencies>
                    <dependency>
                        <groupId>io.github.jjyy</groupId>
                        <artifactId>asciidoctor-block-switch</artifactId>
                        <version>1.1.0</version>
                        <systemPath>${project.basedir}/lib/asciidoctor-block-switch-1.1.0.jar</systemPath>
                        <scope>system</scope>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
[source, role="primary"] (1)
.Maven
----
<dependency>
    <groupId>com.example</groupId>
    <artifactId>some-library</artifactId>
    <version>1.2.3</version>
</dependency>
----

[source, role="secondary-a"] (2)
.Gradle
----
compile 'com.example:some-library:1.2.3
----

[source, role="secondary-b"] (3)
.Ivy
----
<dependency org="com.example" name="some-library" rev="1.2.3"/>
----
  1. ClassName of the first block must be primary.

  2. ClassName of the rest blocks must start with secondary.