Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOXIA-618] import tests from maven-site-plugin #52

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DOXIA-473

But 'quotes' and "double quotes" were stripped from HTML result with DOXIA 1.3:
see [DOXIA-473](https://issues.apache.org/jira/browse/DOXIA-473).
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DOXIA-535

\*.markdown files are processed just like \*.md files.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
Expand All @@ -19,19 +17,15 @@ specific language governing permissions and limitations
under the License.
-->

<project name="${project.name} from site.xml">

<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.9</version>
</skin>

<body>
# DOXIA-571

<menu name="Testing">
<item name="Fenced Code Block" href="fenced-code-block.html" />
</menu>
Missing code block color [DOXIA-571](https://issues.apache.org/jira/browse/DOXIA-571):

</body>
</project>
```
code block
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: D:\apache-maven-3.6.3\apache-maven\bin\..
Java version: 1.8.0_232, vendor: AdoptOpenJDK, runtime: C:\Program Files\AdoptOpenJDK\jdk-8.0.232.09-hotspot\jre
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DOXIA-597

Missing `monospaced` support [DOXIA-597](https://issues.apache.org/jira/browse/DOXIA-597)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
author: Bertrand Martin

# Fenced Code Block
# DOXIA-616: Fenced Code Block

This is Java code and must be tagged so such.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ under the License.

<project name="${project.name} from site.xml">

<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.9</version>
</skin>

<body>

<menu name="Getting Started">
Expand All @@ -30,6 +36,11 @@ under the License.
<menu name="Testing">
<item name="Metadata" href="metadata.html" />
<item name="Quotes" href="quotes.html" />
<item name="DOXIA-473" href="DOXIA-473.html" />
<item name="DOXIA-535" href="DOXIA-535.html" />
<item name="DOXIA-571" href="DOXIA-571.html" />
<item name="DOXIA-597" href="DOXIA-597.html" />
<item name="DOXIA-616 (fenced code block)" href="DOXIA-616-fenced-code-block.html" />
</menu>

</body>
Expand Down
71 changes: 57 additions & 14 deletions doxia-modules/doxia-module-markdown/src/it/general/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,88 @@
// Verify index.html

// File was produced
File resultFile = new File(basedir, "target/site/index.html")
assert resultFile.isFile()
File resultFile = new File( basedir, "target/site/index.html" )
assert resultFile.isFile() : "index.html exists"


// Verify metadata.html

// File was produced
resultFile = new File(basedir, "target/site/metadata.html")
assert resultFile.isFile()
resultFile = new File( basedir, "target/site/metadata.html" )
assert resultFile.isFile() : "metadata.html exists"

// Check the content
String content = resultFile.text;

// <title> must contain the specified title in the metadata, not in the first heading
assert content =~ '<title>.*Title from Header.*</title>'
assert content =~ '<title>.*Title from Header.*</title>' : "title set from metadata"

// Author is Bertrand, yours truly
// Apostrophe must have been interpreted properly
assert content =~ '<meta name="Author" content="Bertrand \'Yours, Truly\' Martin" />'
assert content =~ '<meta name="Author" content="Bertrand \'Yours, Truly\' Martin" />' : "author is set"

// Keywords do support utf-8 smileys
assert content =~ '<meta name="Keywords" content="smile,&#x1f609;,utf-8" />'
assert content =~ '<meta name="Keywords" content="smile,&#x1f609;,utf-8" />' : "keywords are set"

// Meta are properly trimmed
assert content =~ '<meta name="Weird" content="Spacing" />'
assert content =~ '<meta name="Weird" content="Spacing" />' : "header spaces are trimmed"

// Empty is empty
assert content =~ '<meta name="Empty" content="" />'
assert content =~ '<meta name="Empty" content="" />' : "empty header can be set"

// No description is provided, as it was not part of the metadata at the beginning of the doc
assert !(content =~ '<meta name="description"')
assert !( content =~ '<meta name="description"' ) : "description is not set in the header"


// Verify quotes.html

resultFile = new File(basedir, "target/site/quotes.html")
assert resultFile.isFile()
resultFile = new File( basedir, "target/site/quotes.html" )
assert resultFile.isFile() : "quotes.html exists"

content = resultFile.text;
assert content =~ /This ain't a quote, but an apostrophe./
assert content =~ /This &#x2018;quoted text&#x2019; isn't surrounded with apostrophes./
assert content =~ /This ain't a quote, but an apostrophe./ : "DOXIA-542: apostrophes remain intact"
assert content =~ /This &#x2018;quoted text&#x2019; isn't surrounded with apostrophes./ : "surrounding quotes are stylized"


// Verify DOXIA-473
content = new File( basedir, "target/site/DOXIA-473.html" ).text
assert !content.contains( ' quotes and double quotes were stripped' ) : "DOXIA-473: quotes are not stripped"


// Verify DOXIA-535
assert new File( basedir, "target/site/DOXIA-535.html" ).exists() : "DOXIA-535: *.markdown source files are processed"

// Verify DOXIA-571
content = new File( basedir, "target/site/DOXIA-571.html" ).text
assert content.contains( '<div class="source"><pre class="prettyprint"><code>code block' ) : "DOXIA-571: code block is pretty"


// Verify DOXIA-597
content = new File( basedir, "target/site/DOXIA-597.html" ).text
assert content.contains( '<code>monospaced</code> support' ) : "DOXIA-597: inline code is marked as such"


// Verify DOXIA-616-fenced-code-block.html

// File was produced
resultFile = new File( basedir, "target/site/DOXIA-616-fenced-code-block.html" )
assert resultFile.isFile() : "DOXIA-616-fenced-code-block.html exists"

// Check the content
content = resultFile.text;

// Our first fenced code block is <div class="source"><pre><code class="language-java">...</code></pre></div>
assert content =~ '<div class="source">.*<pre.*>.*<code.*class=".*language-java.*">.*// Fenced Code Block 1' : "DOXIA-616: Fenced Code Block 1 is pretty"

// Our second fenced code block doesn't specify a language
assert content =~ '<div class="source">.*<pre.*>.*<code.*># Fenced Code Block 2'
assert !( content =~ '<div class="source">.*<pre.*>.*<code.*language-.*># Fenced Code Block 2' ) : "DOXIA-616: Fenced Code Block 2 is pretty"

// Our third code block is indented, and it shows the same way
assert content =~ '<div class="source">.*<pre.*>.*<code.*>// Indented Code Block' : "DOXIA-616: Indented Code Block is pretty"

// Then we have inline code, which must be in simple <code>
assert content =~ 'inline code: <code>System.out.println' : "DOXIA-616: Inline code is marked as such"

// The last one is inline "fenced" code block which must be in simple <code>
assert content =~ 'And what about <code>System.out.println' : "DOXIA-616: Inline 'fenced' code block is marked as code"
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ under the License.
<exclude>src/test/resources/**/*.twiki</exclude>
<exclude>src/test/resources/**/*.md</exclude>
<exclude>src/it/**/site/**/*.md</exclude>
<exclude>src/it/**/site/**/*.markdown</exclude>
</excludes>
</configuration>
</plugin>
Expand Down