You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2023/01/24 18:58:02 UTC

[GitHub] [maven-doxia] kwin opened a new pull request, #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

kwin opened a new pull request, #141:
URL: https://github.com/apache/maven-doxia/pull/141

   MultiMarkdown)
   
   Properly support multiline values in sink and parser. Always emit with normalized separators.


-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] michael-o commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090033038


##########
doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java:
##########
@@ -76,19 +83,23 @@ public class MarkdownParser extends AbstractTextParser implements TextMarkup {
      * In order to ensure that we have minimal risk of false positives when slurping metadata sections, the
      * first key in the metadata section must be one of these standard keys or else the entire metadata section is
      * ignored.
+     * @see <a href="https://fletcher.github.io/MultiMarkdown-5/metadata.html">Multimarkdown Metadata</a>

Review Comment:
   Is this really correct? MultiMarkdown vs CommonMark?



##########
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:
   metadata



##########
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';
+                Matcher entryMatcher = METADATA_ENTRY_PATTERN.matcher(entry);
+                while (entryMatcher.find()) {
+                    String key = entryMatcher.group(1);
+                    String value = normalizeMultilineValue(entryMatcher.group(2));
+                    metaData.put(key, Collections.singletonList(value));
+                }
+                endOffset = metadataMatcher.end(0);
+            } else {
+                endOffset = 0;
+            }
+        }
+        if (endOffset > 0) {
+            // Trim the metadata from the source
+            source.delete(0, endOffset);
+        }
+        return writeHtmlMetadata(html, metaData);
+    }
+
+    static String normalizeMultilineValue(String value) {
+        return value.trim().replaceAll("[ \\t]*[\\r\\n]+[ \\t]*", " ");
+    }
+
+    private boolean writeHtmlMetadata(StringBuilder html, Map<String, List<String>> data) {
+        boolean containsTitle = false;
+        for (Entry<String, List<String>> entry : data.entrySet()) {
+            if (writeHtmlMetadata(html, entry.getKey(), entry.getValue())) {
+                containsTitle = true;
+            }
+        }
+        return containsTitle;
+    }
+
+    private boolean writeHtmlMetadata(StringBuilder html, String key, List<String> values) {
+        if ("title".equalsIgnoreCase(key)) {
+            html.append("<title>");
+            html.append(HtmlTools.escapeHTML(values.stream().collect(Collectors.joining(", ")), false));
+            html.append("</title>");
+            return true;
+        } else {
+            if (key.equalsIgnoreCase("author") && values.size() > 1) {
+                // for multiple authors emit multiple meta tags
+                for (String value : values) {
+                    writeHtmlMetadata(html, key, Collections.singletonList(value));
+                }
+            } else {
+                // every other multivalue should just be concatenated and emitted in a single meta tag
+                final String separator;
+                if (key.equalsIgnoreCase("keywords")) {
+                    separator = ",";
+                } else {
+                    separator = "\n";

Review Comment:
   LS?



##########
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:
   LS?



##########
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("---")) {

Review Comment:
   Empty lines before are not allowed?



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090038734


##########
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:
   doesn't matter in this context, only used for matching (where all platform line separators do actually work).



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] michael-o commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090038580


##########
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:
   Line separator



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090038860


##########
doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java:
##########
@@ -76,19 +83,23 @@ public class MarkdownParser extends AbstractTextParser implements TextMarkup {
      * In order to ensure that we have minimal risk of false positives when slurping metadata sections, the
      * first key in the metadata section must be one of these standard keys or else the entire metadata section is
      * ignored.
+     * @see <a href="https://fletcher.github.io/MultiMarkdown-5/metadata.html">Multimarkdown Metadata</a>

Review Comment:
   No, but Doxia Markdown supports it (since the beginning I guess). Compare also with https://github.com/vsch/flexmark-java/issues/550. I haven't added, only refactored and extended for multiline support and added the underlying spec.



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin merged pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin merged PR #141:
URL: https://github.com/apache/maven-doxia/pull/141


-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090038860


##########
doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java:
##########
@@ -76,19 +83,23 @@ public class MarkdownParser extends AbstractTextParser implements TextMarkup {
      * In order to ensure that we have minimal risk of false positives when slurping metadata sections, the
      * first key in the metadata section must be one of these standard keys or else the entire metadata section is
      * ignored.
+     * @see <a href="https://fletcher.github.io/MultiMarkdown-5/metadata.html">Multimarkdown Metadata</a>

Review Comment:
   No, but Doxia Markdown supports it (since the beginning I guess). Compare also with https://github.com/vsch/flexmark-java/issues/550. I haven't touched that part, only refactored and added the underlying spec.



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090037961


##########
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("---")) {

Review Comment:
   No (although no formal spec, this is not supported by most parsers, see also https://github.com/jonschlinkert/gray-matter/issues/71#issuecomment-382723455).



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090038015


##########
doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java:
##########
@@ -76,19 +83,23 @@ public class MarkdownParser extends AbstractTextParser implements TextMarkup {
      * In order to ensure that we have minimal risk of false positives when slurping metadata sections, the
      * first key in the metadata section must be one of these standard keys or else the entire metadata section is
      * ignored.
+     * @see <a href="https://fletcher.github.io/MultiMarkdown-5/metadata.html">Multimarkdown Metadata</a>

Review Comment:
   CommonMark does not define any metadata format.



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090038399


##########
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:
   What is this comment supposed to mean?



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090522065


##########
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';
+                Matcher entryMatcher = METADATA_ENTRY_PATTERN.matcher(entry);
+                while (entryMatcher.find()) {
+                    String key = entryMatcher.group(1);
+                    String value = normalizeMultilineValue(entryMatcher.group(2));
+                    metaData.put(key, Collections.singletonList(value));
+                }
+                endOffset = metadataMatcher.end(0);
+            } else {
+                endOffset = 0;
+            }
+        }
+        if (endOffset > 0) {
+            // Trim the metadata from the source
+            source.delete(0, endOffset);
+        }
+        return writeHtmlMetadata(html, metaData);
+    }
+
+    static String normalizeMultilineValue(String value) {
+        return value.trim().replaceAll("[ \\t]*[\\r\\n]+[ \\t]*", " ");
+    }
+
+    private boolean writeHtmlMetadata(StringBuilder html, Map<String, List<String>> data) {
+        boolean containsTitle = false;
+        for (Entry<String, List<String>> entry : data.entrySet()) {
+            if (writeHtmlMetadata(html, entry.getKey(), entry.getValue())) {
+                containsTitle = true;
+            }
+        }
+        return containsTitle;
+    }
+
+    private boolean writeHtmlMetadata(StringBuilder html, String key, List<String> values) {
+        if ("title".equalsIgnoreCase(key)) {
+            html.append("<title>");
+            html.append(HtmlTools.escapeHTML(values.stream().collect(Collectors.joining(", ")), false));
+            html.append("</title>");
+            return true;
+        } else {
+            if (key.equalsIgnoreCase("author") && values.size() > 1) {
+                // for multiple authors emit multiple meta tags
+                for (String value : values) {
+                    writeHtmlMetadata(html, key, Collections.singletonList(value));
+                }
+            } else {
+                // every other multivalue should just be concatenated and emitted in a single meta tag
+                final String separator;
+                if (key.equalsIgnoreCase("keywords")) {
+                    separator = ",";
+                } else {
+                    separator = "\n";

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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] kwin commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090723122


##########
doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java:
##########
@@ -76,19 +83,23 @@ public class MarkdownParser extends AbstractTextParser implements TextMarkup {
      * In order to ensure that we have minimal risk of false positives when slurping metadata sections, the
      * first key in the metadata section must be one of these standard keys or else the entire metadata section is
      * ignored.
+     * @see <a href="https://fletcher.github.io/MultiMarkdown-5/metadata.html">Multimarkdown Metadata</a>

Review Comment:
   See also the unmodified line 81 which mentions multimarkdown already.



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-doxia] michael-o commented on a diff in pull request #141: [DOXIA-690] Improved support of metadata (both YAML front matter and

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #141:
URL: https://github.com/apache/maven-doxia/pull/141#discussion_r1090038525


##########
doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java:
##########
@@ -76,19 +83,23 @@ public class MarkdownParser extends AbstractTextParser implements TextMarkup {
      * In order to ensure that we have minimal risk of false positives when slurping metadata sections, the
      * first key in the metadata section must be one of these standard keys or else the entire metadata section is
      * ignored.
+     * @see <a href="https://fletcher.github.io/MultiMarkdown-5/metadata.html">Multimarkdown Metadata</a>

Review Comment:
   But FlexMark does not claim to support MultiMarkdown, does it?



-- 
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-unsubscribe@maven.apache.org

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