Skip to content

Commit

Permalink
Merge branch 'release/7.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Mar 4, 2023
2 parents 90a98c3 + 1acb9af commit 49eadcc
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 34 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ For pratical samples refer to folder/module [test-publishing](https://github.com

## News

Date | Release | Info
--- | --- | ---
| **Jan 4, 2023** | [Release 7.9](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.9) | Fix problem Problem parsing `%` character from markdown to wiki. Refer to [#282](https://github.com/bsorrentino/maven-confluence-plugin/issues/282) |
| **Dec 9, 2022** | [Release 7.8](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.8) | Merged PR [#281](https://github.com/bsorrentino/maven-confluence-plugin/pull/281) that fix [#280](https://github.com/bsorrentino/maven-confluence-plugin/issue/280) "**allows specifying additional HTTP headers in the servers section of settings.xml**". Thanks to [DirkMahler](https://github.com/DirkMahler) for contribution. |
| **Jul 3, 2022** | [Release 7.7](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.7) | Merged PR [#266](https://github.com/bsorrentino/maven-confluence-plugin/pull/266) "**Adding JSON Support**". Thanks to [jksevend](https://github.com/jksevend) for contribution. |
| **Jun 3, 2022** | [Release 7.6](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.6) | Merged PR [#267](https://github.com/bsorrentino/maven-confluence-plugin/pull/267) "**added function to define jira instance baseurl**", that fix issue [#136](https://github.com/bsorrentino/maven-confluence-plugin/issues/136). Thanks to [tspindler](https://github.com/tspindler) for contribution. |
| **Apr 1, 2022** | [Release 7.5](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.5) | Fix empty table cell not handled properly. Refer to [#264](https://github.com/bsorrentino/maven-confluence-plugin/issues/ |
| **Jan 10, 2022** | [Release 7.4](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.4) | Fix problem with **encoding**. Refer to [#261](https://github.com/bsorrentino/maven-confluence-plugin/issues/261). |
Date | Release | Info
------------------|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| **Mar 4, 2023** | [Release 7.10](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.10) | Allow to skip html tags in markdown processing. Refer to [#284](https://github.com/bsorrentino/maven-confluence-plugin/issues/284) |
| **Jan 4, 2023** | [Release 7.9](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.9) | Fix problem Problem parsing `%` character from markdown to wiki. Refer to [#282](https://github.com/bsorrentino/maven-confluence-plugin/issues/282) |
| **Dec 9, 2022** | [Release 7.8](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.8) | Merged PR [#281](https://github.com/bsorrentino/maven-confluence-plugin/pull/281) that fix [#280](https://github.com/bsorrentino/maven-confluence-plugin/issue/280) "**allows specifying additional HTTP headers in the servers section of settings.xml**". Thanks to [DirkMahler](https://github.com/DirkMahler) for contribution. |
| **Jul 3, 2022** | [Release 7.7](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.7) | Merged PR [#266](https://github.com/bsorrentino/maven-confluence-plugin/pull/266) "**Adding JSON Support**". Thanks to [jksevend](https://github.com/jksevend) for contribution. |
| **Jun 3, 2022** | [Release 7.6](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.6) | Merged PR [#267](https://github.com/bsorrentino/maven-confluence-plugin/pull/267) "**added function to define jira instance baseurl**", that fix issue [#136](https://github.com/bsorrentino/maven-confluence-plugin/issues/136). Thanks to [tspindler](https://github.com/tspindler) for contribution. |
| **Apr 1, 2022** | [Release 7.5](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.5) | Fix empty table cell not handled properly. Refer to [#264](https://github.com/bsorrentino/maven-confluence-plugin/issues/ |
| **Jan 10, 2022** | [Release 7.4](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v7.4) | Fix problem with **encoding**. Refer to [#261](https://github.com/bsorrentino/maven-confluence-plugin/issues/261). |

### [Release History](HISTORY.md)
2 changes: 1 addition & 1 deletion addon-scrollversions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ public static String processMarkdown(
final Optional<String> pagePrefixToApply) throws IOException {

return MarkdownProcessor.shared.processMarkdown(new MarkdownParserContext() {
@Override
public boolean isSkipHtml() {
return MarkdownProcessor.shared.isSkipHtml();
}

@Override
public Optional<Site> getSite() {
return Optional.of(site);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
*/
public interface MarkdownParserContext {

/**
* skip html tag parsing
*
* @return true|false
*/
boolean isSkipHtml();

/**
* The Site Model Object
*
Expand Down
38 changes: 26 additions & 12 deletions core/src/main/java/org/bsc/markdown/MarkdownProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ public interface MarkdownProcessor {
*/
String processMarkdown( MarkdownParserContext context, String content ) throws IOException;

/**
* default method
*
* @param content
* @return
* @throws IOException
*/
default String processMarkdown( String content ) throws IOException {
return processMarkdown(new MarkdownParserContext() {
}, content);
}

/**
* factory method
*
Expand All @@ -63,6 +51,21 @@ class Shared implements MarkdownProcessor {
private String name = "commonmark";
private MarkdownProcessor processor;

private boolean skipHtml = false;

public boolean isSkipHtml() {
return skipHtml;
}

/**
* set skip html tag processing
*
* @return true|false
*/
public void setSkipHtml(boolean skipHtml) {
this.skipHtml = skipHtml;
}

@Override
public String getName() {
return ofNullable(shared.name)
Expand All @@ -76,6 +79,15 @@ public String processMarkdown(MarkdownParserContext context, String content) thr
.processMarkdown( context, content);
}

public String processMarkdown(String content) throws IOException {
return ofNullable(processor)
.orElseThrow( () -> new IllegalStateException( "processor has not been initialized yet!" ))
.processMarkdown( new MarkdownParserContext() {
@Override
public boolean isSkipHtml() { return isSkipHtml(); }
}, content);
}

public void setName(String value) {
name = ofNullable(value)
.orElseThrow( () -> new IllegalArgumentException( "processor's name cannot be null!" ));
Expand All @@ -92,6 +104,8 @@ public MarkdownProcessor init( ) {
}
return processor;
}


}

Shared shared = new Shared();
Expand Down
2 changes: 1 addition & 1 deletion gitlog+jira/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion plugin-reporting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>

<prerequisites>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public class ConfluenceDeployMojo extends AbstractConfluenceDeployMojo {
* Markdown processor Info<br>
* <pre>
* &lt;markdownProcessor>
* &lt;name>processor name&lt;/name> &lt;git branch!-- default: pegdown -->
* &lt;name>processor name&lt;/name> &lt;-- default: pegdown -->
* &lt;skipHtml>true | false&lt;/skipHtml> &lt;-- default: false -->
* &lt;/markdownProcessor>
* </pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@
*/
public class MarkdownProcessorInfo {

public String getName() {
public boolean isSkipHtml() {
return MarkdownProcessor.shared.isSkipHtml();
}

/**
* set skip html tags parsing
* @param skipHtml
*/
public void setSkipHtml(boolean skipHtml) {
MarkdownProcessor.shared.setSkipHtml( skipHtml );
}

public String getName() {
return MarkdownProcessor.shared.getName();
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>org.bsc.maven</groupId>
<artifactId>maven-confluence-parent</artifactId>
<packaging>pom</packaging>
<version>7.9</version>
<version>7.10</version>
<name>CONFLUENCE-REPORTING::Parent</name>
<description>Maven's plugin that allow to generate "project's documentation" directly to confluence allowing, in the
same time, to keep in-sync both project &amp; documentation
Expand Down
2 changes: 1 addition & 1 deletion processor-commonmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ public void visit( TableCell node ) {

@Override
public void visit(HtmlBlock node) {
// GUARD
if( parseContext.isSkipHtml() ) return;

final String literal = node.getLiteral();

final Matcher m = parseHTMLComment(literal);
Expand All @@ -342,6 +345,9 @@ public void visit(HtmlBlock node) {

@Override
public void visit(HtmlInline node) {
// GUARD
if( parseContext.isSkipHtml() ) return;

processChildren(node)
//.pre("<<HTMI>>").post("<</HTMI>>")
.process().nl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import org.apache.commons.io.IOUtils
import org.bsc.confluence.model.Site
import org.bsc.markdown.MarkdownParserContext
import org.bsc.markdown.commonmark.CommonmarkConfluenceWikiVisitor
import org.junit.jupiter.api.Assertions.fail
import org.junit.jupiter.api.fail
import java.nio.charset.Charset
import java.util.*
Expand All @@ -15,6 +14,7 @@ fun parseContent(site: Site, content: String, linkPrefixEnabled: Boolean = true)
val root = CommonmarkConfluenceWikiVisitor.parser().parse(content)

val visitor = CommonmarkConfluenceWikiVisitor(object : MarkdownParserContext {
override fun isSkipHtml() = false

override fun getSite() = Optional.of(site)

Expand Down
2 changes: 1 addition & 1 deletion processor-freemarker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-confluence-parent</artifactId>
<version>7.9</version>
<version>7.10</version>
</parent>
<artifactId>maven-confluence-processor-freemarker</artifactId>
<name>CONFLUENCE-REPORTING::Freemaker::Processor</name>
Expand Down
2 changes: 1 addition & 1 deletion service-rest-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion service-xmlrpc-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion test-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>

<!-- TEST ISSUE 263 -->
Expand Down
22 changes: 21 additions & 1 deletion test-publishing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>maven-confluence-parent</artifactId>
<groupId>org.bsc.maven</groupId>
<version>7.9</version>
<version>7.10</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -428,6 +428,26 @@
<siteDescriptor>${basedir}/src/site/confluence/issue261/site.yml</siteDescriptor>
</configuration>
</execution>
<!--
mvn confluence-reporting:deploy@issue284
mvn confluence-reporting:delete@issue284
-->
<execution>
<id>issue284</id>
<goals>
<goal>deploy</goal>
<goal>delete</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<failOnError>true</failOnError>
<siteDescriptor>${basedir}/src/site/confluence/issue284/site.yml</siteDescriptor>
<markdownProcessor>
<skipHtml>true</skipHtml>
</markdownProcessor>

</configuration>
</execution>

</executions>
</plugin>
Expand Down
9 changes: 9 additions & 0 deletions test-publishing/src/site/confluence/issue284/issue284.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## TEST ISSUE 284

<!-- markdownlint-disable -->

Take a look [here](https://github.com/bsorrentino/maven-confluence-plugin/issues/284)

<!-- markdownlint-enable -->


4 changes: 4 additions & 0 deletions test-publishing/src/site/confluence/issue284/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
home:
uri: issue284.md
parentPageTitle: "Home"
name: "Issue #284"

0 comments on commit 49eadcc

Please sign in to comment.