You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2022/12/28 18:06:01 UTC

[maven-doxia] branch DOXIA-617 updated (94df91bb -> 3fe4c07e)

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a change to branch DOXIA-617
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git


    omit 94df91bb [DOXIA-617] support yaml metadata
     add 539428bd [DOXIA-684] avoid flexmark-all: declare used extensions only
     new 3fe4c07e [DOXIA-617] support yaml metadata

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (94df91bb)
            \
             N -- N -- N   refs/heads/DOXIA-617 (3fe4c07e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 doxia-modules/doxia-module-markdown/pom.xml | 61 ++++++++++++++++++++++++-----
 pom.xml                                     |  1 +
 2 files changed, 53 insertions(+), 9 deletions(-)


[maven-doxia] 01/01: [DOXIA-617] support yaml metadata

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch DOXIA-617
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git

commit 3fe4c07eb778706bab83f232f8be1cd1485783ca
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Dec 22 08:12:41 2022 +0100

    [DOXIA-617] support yaml metadata
---
 .../maven/doxia/module/markdown/MarkdownParser.java   |  7 +++++++
 .../doxia/module/markdown/MarkdownParserTest.java     | 19 ++++++++++++++++++-
 .../src/test/resources/metadata-yaml.md               | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java b/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
index 33057eaf..462939c6 100644
--- a/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
+++ b/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
@@ -198,6 +198,13 @@ public class MarkdownParser
         html.append( "<html>" );
         html.append( "<head>" );
 
+        // detect yaml style metadata
+        if ( text.startsWith( "---" ) )
+        {
+            // remove the enclosing --- to get back to classical metadata
+            text = text.replaceFirst( "---", "" ).replaceFirst( "---", "" );
+        }
+
         // First, we interpret the "metadata" section of the document and add the corresponding HTML headers
         Matcher metadataMatcher = METADATA_SECTION_PATTERN.matcher( text );
         boolean haveTitle = false;
diff --git a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
index 11e4da53..35b3799f 100644
--- a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
+++ b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
@@ -300,7 +300,24 @@ public class MarkdownParserTest
     public void testMetadataSinkEvent()
         throws Exception
     {
-        List<SinkEventElement> eventList = parseFileToEventTestingSink( "metadata" ).getEventList();
+        testMetadataSinkEvent( "metadata" );
+    }
+
+    /**
+     * Assert the metadata is passed through when parsing "metadata-yaml.md".
+     *
+     * @throws Exception if the event list is not correct when parsing the document
+     */
+    public void testMetadataYamlSinkEvent()
+        throws Exception
+    {
+        testMetadataSinkEvent( "metadata-yaml" );
+    }
+
+    private void testMetadataSinkEvent( String doc )
+        throws Exception
+    {
+        List<SinkEventElement> eventList = parseFileToEventTestingSink( doc ).getEventList();
         Iterator<SinkEventElement> it = eventList.iterator();
 
         assertEquals( it, "head", "title", "text", "text", "text", "title_", "author", "text", "author_", "date", "text", "date_",
diff --git a/doxia-modules/doxia-module-markdown/src/test/resources/metadata-yaml.md b/doxia-modules/doxia-module-markdown/src/test/resources/metadata-yaml.md
new file mode 100644
index 00000000..406c74ff
--- /dev/null
+++ b/doxia-modules/doxia-module-markdown/src/test/resources/metadata-yaml.md
@@ -0,0 +1,14 @@
+---
+title: A Title & a 'Test'
+author: Somebody 'Nickname' Great <so...@somewhere.org>
+date: 2013 © Copyleft
+keywords: maven,doxia,markdown
+---
+
+# The document with look-alike header
+
+copyright: none
+
+## A subheading
+
+Some more text
\ No newline at end of file