diff --git a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/sample.adoc b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/sample.adoc index 880c00ab..f1edc352 100644 --- a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/sample.adoc +++ b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/src/site/asciidoc/sample.adoc @@ -91,3 +91,16 @@ Linux::: BSD::: . FreeBSD . NetBSD + +=== Examples + +.Optional title (1) +==== +This is an example of an example block (1). +==== + +.Optional title (2) +[example] +This is an example of an example block (2). +*dadsas* https://dasd.com + diff --git a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/validate.groovy b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/validate.groovy index 6d7d5b50..5dcbbda1 100644 --- a/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/validate.groovy +++ b/asciidoctor-parser-doxia-module/src/it/maven-site-plugin/validate.groovy @@ -58,6 +58,10 @@ new HtmlAsserter(htmlContent).with { asserter -> asserter.containsUnorderedList("Desktop", "Server") asserter.descriptionListTerm("BSD") asserter.containsOrderedList("FreeBSD", "NetBSD") + + asserter.containsSectionTitle("Examples", 3) + asserter.containsExampleDiv() + asserter.containsExampleDiv() } String strong(String text) { @@ -224,8 +228,15 @@ class HtmlAsserter { } } + void containsExampleDiv() { + final def key = "
", key, found) + } + void assertTableCaption(String htmlBlock, String caption) { - def start = htmlBlock.indexOf("") + "".length() + def start = htmlBlock.indexOf("", start) + 1 def end = htmlBlock.indexOf("") if (start < 0 || end < 0) fail("Caption not found ($start, $end)") @@ -239,11 +250,11 @@ class HtmlAsserter { void assertTableHeaders(String htmlBlock, List headers) { def actualHeaders = Arrays.stream(htmlBlock.split("<")) - .filter(line -> line.startsWith("th>")) - .map(line -> { - return line.substring("th>".length()) - }) - .collect(Collectors.toList()) + .filter(line -> line.startsWith("th>")) + .map(line -> { + return line.substring("th>".length()) + }) + .collect(Collectors.toList()) if (actualHeaders != headers) fail("Table headers not valid. Found: $actualHeaders, expected: $headers") @@ -266,8 +277,8 @@ class HtmlAsserter { // Removes linebreaks to validate to avoid OS dependant issues. private String clean(String value) { return value.replaceAll("\r\n", "") - .replaceAll("\n", "") - .trim(); + .replaceAll("\n", "") + .trim(); } }