Skip to content

Commit

Permalink
Merge pull request #129 from melloware/128-asciidoc
Browse files Browse the repository at this point in the history
Fix #128 AsciiDoc native support
  • Loading branch information
mkouba authored Oct 30, 2024
2 parents 0b336f7 + b6dd42e commit c74a1f1
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package io.quarkiverse.qute.web.asciidoc.deployment;

import java.util.ArrayList;
import java.util.List;

import io.quarkiverse.qute.web.asciidoc.runtime.AsciidocSectionHelperFactory;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

class QuteWebAsciidocProcessor {

Expand All @@ -19,4 +24,15 @@ FeatureBuildItem feature() {
void process(BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
additionalBeans.produce(new AdditionalBeanBuildItem(AsciidocSectionHelperFactory.class));
}

@BuildStep
void registerOpenPdfForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
CombinedIndexBuildItem combinedIndex) {
final List<String> classNames = new ArrayList<>();
classNames.add(io.yupiik.tools.ascii2svg.Svg.class.getName());

reflectiveClass.produce(
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods().fields().build());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,41 @@
<version>\{project-version}</version>
</dependency>
----

[%collapsible]
====
You can do that using several ways :

[qanda]
Manually::
[source,xml]
.pom.xml
----
<dependency>
<groupId>io.quarkiverse.roq</groupId>
<artifactId>quarkus-roq-plugin-asciidoc</artifactId>
<version>$\{quarkus-roq.version\}</version>
</dependency>
----

Using the Quarkus cli::
[source,shell]
----
quarkus extension add io.quarkiverse.roq:quarkus-roq-plugin-asciidoc
----

Using the Maven::
[source,shell]
----
./mvnw quarkus:add-extension -Dextensions="io.quarkiverse.roq:quarkus-roq-plugin-asciidoc"
----

Using the Gradle::
[source,shell]
----
./gradlew addExtension --extensions="io.quarkiverse.roq:quarkus-roq-plugin-asciidoc"
----
====
{/}
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void testTemplates() {
.when().get("/hello")
.then()
.statusCode(200)
.log().all()
.log().ifValidationFails()
.body("html.body.p[0]", equalTo("Hello world!"))
.body("html.body.div.div.div.ul.li[0].p", equalToCompressingWhiteSpace("Joe"))
.body("html.body.div.h2", equalTo("Installation"))
Expand Down
7 changes: 6 additions & 1 deletion asciidoc/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<artifactId>asciidoc-java</artifactId>
<version>${asciidoc.java.version}</version>
</dependency>
<dependency>
<groupId>io.yupiik.maven</groupId>
<artifactId>ascii2svg</artifactId>
<version>${asciidoc.java.version}</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -54,4 +59,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

0 comments on commit c74a1f1

Please sign in to comment.