[ 
https://issues.apache.org/jira/browse/DOXIA-731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17825622#comment-17825622
 ] 

ASF GitHub Bot commented on DOXIA-731:
--------------------------------------

michael-o commented on code in PR #202:
URL: https://github.com/apache/maven-doxia/pull/202#discussion_r1521244407


##########
doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java:
##########
@@ -798,4 +800,24 @@ public void testQuoteVsApostrophe() throws Exception {
                 "This apostrophe isn't a quote." + "This \u2018quoted 
text\u2019 isn't surrounded by apostrophes.",
                 content.toString());
     }
+
+    @Override
+    protected void assertEventPrefix(Iterator<SinkEventElement> eventIterator) 
{
+        assertSinkStartsWith(eventIterator, "head", "head_", "body");
+    }
+
+    @Override
+    protected void assertEventSuffix(Iterator<SinkEventElement> eventIterator) 
{
+        assertSinkEquals(eventIterator, "body_");
+    }
+
+    @Override
+    protected String getVerbatimSource() {
+        return null; // not supported in MD

Review Comment:
   Indeed, CommonMark does not support this. Eventually a link to 
https://spec.commonmark.org/0.31.2/#fenced-code-blocks might make sense?



##########
doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTest.java:
##########
@@ -146,6 +156,91 @@ public final void testSinkWrapper() throws ParseException, 
IOException {
         }
     }
 
+    /**
+     * Override this method if the parser always emits some static prefix for 
incomplete documents
+     * and consume the prefix related events from the given {@link Iterator}.
+     * @param eventIterator the iterator
+     */
+    protected void assertEventPrefix(Iterator<SinkEventElement> eventIterator) 
{
+        // do nothing by default, i.e. assume no prefix
+    }
+
+    /**
+     * Override this method if the parser always emits some static suffix for 
incomplete documents
+     * and consume the suffix related events from the given {@link Iterator}.
+     * @param eventIterator the iterator
+     */
+    protected void assertEventSuffix(Iterator<SinkEventElement> eventIterator) 
{
+        assertFalse(eventIterator.hasNext(), "didn't expect any further events 
but got at least one");
+    }
+
+    /**
+     * @return markup representing the verbatim text {@value 
#TEXT_WITH_SPECIAL_CHARS} (needs to be properly escaped).
+     * {@code null} can be returned to skip the test for a particular parser.
+     */
+    protected abstract String getVerbatimSource();
+
+    /**
+     * Test a verbatim block (no code) given through {@link 
#getVerbatimSource()}
+     * @throws ParseException
+     */
+    @Test
+    public void testVerbatim() throws ParseException {
+        String source = getVerbatimSource();
+        assumeTrue(source != null, "parser does not support simple verbatim 
text");

Review Comment:
   `assertNotNull()` or similiar?





> Simplify HTML emitted from Sink.verbatim(...)
> ---------------------------------------------
>
>                 Key: DOXIA-731
>                 URL: https://issues.apache.org/jira/browse/DOXIA-731
>             Project: Maven Doxia
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.0.0-M9
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>            Priority: Major
>
> The XHTML markup generated from Sink.verbatim(...) should be streamlined to 
> either emit {{<pre>}} or {{<pre><code>}} depending on the given attribute.
> There is no need to generate an additional div nor any additional classes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to