yupiik / tools-maven-plugin

An Apache Maven plugin set of tools.
https://www.yupiik.io/tools-maven-plugin
Apache License 2.0
13 stars 4 forks source link

asciidoc-java does not seem to like ifdef/ifndef blocks #10

Closed maxandersen closed 10 months ago

maxandersen commented 10 months ago

https://github.com/jbangdev/jbang/blob/main/readme.adoc as a ifndef/ifdef section that trips asciidoc-java

 jbang -m io.yupiik.asciidoc.launcher.Main io.yupiik.maven:asciidoc-java:1.2.0-SNAPSHOT --input %{https://raw.githubusercontent.com/jbangdev/jbang/main/readme.adoc}
Exception in thread "main" java.lang.IllegalStateException: Invalid state at line #5
    at io.yupiik.asciidoc.parser.Parser.parse(Parser.java:132)
    at io.yupiik.asciidoc.parser.Parser.parse(Parser.java:124)
    at io.yupiik.asciidoc.launcher.Main.main(Main.java:72)
Caused by: java.lang.IllegalArgumentException: Unknown line: 'ifndef::env-github[]'
    at io.yupiik.asciidoc.parser.Parser.readAttributes(Parser.java:1247)
    at io.yupiik.asciidoc.parser.Parser.parseHeader(Parser.java:172)
    at io.yupiik.asciidoc.parser.Parser.parse(Parser.java:130)
    ... 2 more

if I remove the ifdef/ifndef section it renders.

rmannibucau commented 10 months ago

Hi @maxandersen , thanks for the report, can you give it another try, added support for conditional blocks in attributes.

maxandersen commented 10 months ago

passes with latest main!