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

Show the corresponding element when noheader is true #20

Open mcruzdev opened 1 month ago

mcruzdev commented 1 month ago
          I have a doubt, I am working on this [pull request](https://github.com/quarkiverse/quarkus-qute-web/pull/102) to make a PoC with this tooling (thank you for this great job)!

I have a test here:

    @Test
    public void testH1() {
        Engine engine = Engine.builder().addDefaults()
                .addSectionHelper(new AsciidocSectionHelperFactory()).build();

        String result = engine.parse("{#ascii}= Quarkus and Roq{/ascii}").render();

        assertThat(result).contains("<h1>Quarkus and Roq</h1>");
    }

The result is "" but the expected is to have <h1>..., It happens when I add noheader attribute, is it the expected behavior?

I think it should be <h1>... no?

Originally posted by @mcruzdev in https://github.com/yupiik/tools-maven-plugin/issues/18#issuecomment-2289398129

rmannibucau commented 1 month ago

Seems it is right for asciidoctor (https://github.com/asciidoctor/asciidoctor/blob/main/lib/asciidoctor/converter/html5.rb#L193) but we also consider noheader there (https://github.com/yupiik/tools-maven-plugin/blob/master/asciidoc-java/src/main/java/io/yupiik/asciidoc/renderer/html/AsciidoctorLikeHtmlRenderer.java#L299). We should probably add to the configuration a backward compatible toggle to keep current behavior since the reasoning was that when embed the title (=) was managed by the embedder and not the renderer.

One way is to consider the notitle value instead of just testing the presence maybe? if false we use it whatever noheader is?