kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090522411


##########
doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java:
##########
@@ -156,6 +178,86 @@ public void parse(Reader source, Sink sink, String 
reference) throws ParseExcept
         }
     }
 
+    private boolean processMetadataForHtml(StringBuilder html, StringBuilder 
source) {
+        final Map<String, List<String>> metaData;
+        final int endOffset; // end of metadata within source
+        // support two types of metadata:
+        if (source.toString().startsWith("---")) {
+            // 1. YAML front matter 
(https://github.com/vsch/flexmark-java/wiki/Extensions#yaml-front-matter)
+            Node documentRoot = 
FLEXMARK_METADATA_PARSER.parse(source.toString());
+            YamlFrontMatterVisitor visitor = new YamlFrontMatterVisitor();
+            visitor.visit(documentRoot);
+            metaData = visitor.getData();
+            endOffset = visitor.getEndOffset();
+        } else {
+            // 2. Multimarkdown metadata 
(https://fletcher.github.io/MultiMarkdown-5/metadata.html), not yet supported
+            // by Flexmark (https://github.com/vsch/flexmark-java/issues/550)
+            metaData = new LinkedHashMap<>();
+            Matcher metadataMatcher = METADATA_SECTION_PATTERN.matcher(source);
+            if (metadataMatcher.find()) {
+                String entry = metadataMatcher.group(0) + '\n';

Review Comment:
   For consistency reasons used the platform separator now in 
https://github.com/apache/maven-doxia/pull/141/commits/168071b3d8e0434ce73d668746e6c78f5f2051f2.



##########
doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java:
##########
@@ -156,6 +178,86 @@ public void parse(Reader source, Sink sink, String 
reference) throws ParseExcept
         }
     }
 
+    private boolean processMetadataForHtml(StringBuilder html, StringBuilder 
source) {
+        final Map<String, List<String>> metaData;

Review Comment:
   fixed in 
https://github.com/apache/maven-doxia/pull/141/commits/168071b3d8e0434ce73d668746e6c78f5f2051f2.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to