Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOXIA-616] Markdown: Properly expose the language specified in fence…
…d code blocks To properly implement this change the following task had to be performed: * Properly expose language class in fenced code blocks * Re-implemente metadata processing * Add unit tests * Add integration tests (with maven-site-plugin) * Fix *XhtmlBaseParser* and *XhtmlBaseSink* to properly expose attributes of the PRE and CODE elements * Fix *AbstractModuleTest* to use UTF-8 for input files * Remove Pegdown emulation profile and embrace CommonMark This closes #49
- Loading branch information
1 parent
d66b461
commit b55285c
Showing
24 changed files
with
715 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
doxia-modules/doxia-module-markdown/src/it/DOXIA-616-fenced-code-block/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?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 | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>it</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<description>Project Description</description> | ||
|
||
<build> | ||
<plugins> | ||
|
||
<!-- site --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.9.1</version> | ||
<configuration> | ||
<generateReports>false</generateReports> | ||
<generateProjectInfo>false</generateProjectInfo> | ||
<inputEncoding>UTF-8</inputEncoding> | ||
<outputEncoding>UTF-8</outputEncoding> | ||
</configuration> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>doxia-core</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>doxia-module-xhtml</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
</project> |
26 changes: 26 additions & 0 deletions
26
...kdown/src/it/DOXIA-616-fenced-code-block/src/site/markdown/fenced-code-block.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
author: Bertrand Martin | ||
|
||
# Fenced Code Block | ||
|
||
This is Java code and must be tagged so such. | ||
|
||
```java | ||
// Fenced Code Block 1 | ||
System.out.println("Hello, Fenced Code Block!"); | ||
``` | ||
|
||
This is non-specified code: | ||
|
||
``` | ||
# Fenced Code Block 2 | ||
ch = fopen("/tmp/test.log", "r"); | ||
``` | ||
|
||
This is similar to indented block: | ||
|
||
// Indented Code Block | ||
System.out.println("Hello, Indented Block"); | ||
|
||
And it is also different from the inline code: `System.out.println("Hello, Inline Code");`, which remains simple. | ||
|
||
And what about ```System.out.println("Inline fenced code");```? |
37 changes: 37 additions & 0 deletions
37
doxia-modules/doxia-module-markdown/src/it/DOXIA-616-fenced-code-block/src/site/site.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?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 | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
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> | ||
|
||
<menu name="Testing"> | ||
<item name="Fenced Code Block" href="fenced-code-block.html" /> | ||
</menu> | ||
|
||
</body> | ||
</project> |
43 changes: 43 additions & 0 deletions
43
doxia-modules/doxia-module-markdown/src/it/DOXIA-616-fenced-code-block/verify.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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 | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
// Verify fenced-code-block.html | ||
|
||
// File was produced | ||
File resultFile = new File(basedir, "target/site/fenced-code-block.html") | ||
assert resultFile.isFile() | ||
|
||
// Check the content | ||
String 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' | ||
|
||
// 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') | ||
|
||
// Our third code block is indented, and it shows the same way | ||
assert content =~ '<div class="source">.*<pre.*>.*<code.*>// Indented Code Block' | ||
|
||
// Then we have inline code, which must be in simple <code> | ||
assert content =~ 'inline code: <code>System.out.println' | ||
|
||
// The last one is inline "fenced" code block which must be in simple <code> | ||
assert content =~ 'And what about <code>System.out.println' |
69 changes: 69 additions & 0 deletions
69
doxia-modules/doxia-module-markdown/src/it/general/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?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 | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>it</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<description>Project Description</description> | ||
|
||
<build> | ||
<plugins> | ||
|
||
<!-- site --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.9.1</version> | ||
<configuration> | ||
<generateReports>false</generateReports> | ||
<generateProjectInfo>false</generateProjectInfo> | ||
<inputEncoding>UTF-8</inputEncoding> | ||
<outputEncoding>UTF-8</outputEncoding> | ||
</configuration> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>doxia-core</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>doxia-module-xhtml</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
</project> |
5 changes: 5 additions & 0 deletions
5
doxia-modules/doxia-module-markdown/src/it/general/src/site/markdown/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# General Integration Tests for Doxia Markdown Module | ||
|
||
Each page is dedicated to one specific feature of the Doxia Markdown Module. | ||
|
||
Everything is tested in **verify.groovy**. |
11 changes: 11 additions & 0 deletions
11
doxia-modules/doxia-module-markdown/src/it/general/src/site/markdown/metadata.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Author: Bertrand 'Yours, Truly' Martin | ||
Title: Title from Header | ||
Keywords: smile,😉,utf-8 | ||
Empty: | ||
|
||
Weird : Spacing | ||
|
||
|
||
# Title from Title | ||
|
||
description: This description must not be included in the header |
Oops, something went wrong.