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/29 11:16:11 UTC

[maven-doxia] branch DOXIA-617 updated (3fe4c07e -> 97889f33)

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


 discard 3fe4c07e [DOXIA-617] support yaml metadata
     add 47a1bb25 [DOXIA-641] AprParser throws exception if title is not present
     add ceb77298 [DOXIA-650] Make MarkdownParser to be a text parser with text markup
     add 51922943 [DOXIA-671] Double quotes contained in markdown page are removed in HTML output
     add 24f0066c [DOXIA-662] Non unique IDs generated by IndexingSink
     new 97889f33 [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   (3fe4c07e)
            \
             N -- N -- N   refs/heads/DOXIA-617 (97889f33)

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:
 .../org/apache/maven/doxia/index/IndexingSink.java | 36 ++++++++++++++++++++--
 .../maven/doxia/parser/AbstractXmlParser.java      | 34 +++++++++++++++++++-
 .../apache/maven/doxia/index/IndexingSinkTest.java | 23 ++++++--------
 .../apache/maven/doxia/module/apt/AptParser.java   | 10 ------
 .../doxia/module/markdown/MarkdownParser.java      | 17 +++-------
 5 files changed, 81 insertions(+), 39 deletions(-)
 copy doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlock.java => doxia-core/src/test/java/org/apache/maven/doxia/index/IndexingSinkTest.java (65%)


[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 97889f333138b148ae8994aafc03d9916bd9230d
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 a066c508..b4fd58ca 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
@@ -189,6 +189,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