Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instanciate parser with a LocalContentResolver #139

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package io.quarkiverse.qute.web.asciidoc.runtime;

import java.nio.file.Path;
import java.util.Map;

import io.yupiik.asciidoc.model.Body;
import io.yupiik.asciidoc.parser.Parser;
import io.yupiik.asciidoc.parser.resolver.ContentResolver;
import io.yupiik.asciidoc.renderer.html.AsciidoctorLikeHtmlRenderer;

public class AsciidocConverter {
Expand All @@ -17,7 +19,7 @@ public String apply(String asciidoc) {
// AsciiDoc content is not supposed to be indented globally
// In Qute context it might often be indented
final String content = trimIndent(asciidoc);
Body body = parser.parseBody(content, new Parser.ParserContext(null));
Body body = parser.parseBody(content, new Parser.ParserContext(ContentResolver.of(Path.of("."))));
// Renderer is not thread-safe and must not be shared
AsciidoctorLikeHtmlRenderer renderer = new AsciidoctorLikeHtmlRenderer(config);
renderer.visitBody(body);
Expand Down