diff --git a/livingdoc-examples/aggregate/aggregate-cargo/pom.xml b/livingdoc-examples/aggregate/aggregate-cargo/pom.xml
index bc5d24f..c1d8bd7 100644
--- a/livingdoc-examples/aggregate/aggregate-cargo/pom.xml
+++ b/livingdoc-examples/aggregate/aggregate-cargo/pom.xml
@@ -7,7 +7,7 @@
ch.ifocusit.livingdoc.example
aggregate
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
aggregate-cargo
diff --git a/livingdoc-examples/aggregate/aggregate-handling/pom.xml b/livingdoc-examples/aggregate/aggregate-handling/pom.xml
index 4b7481d..e805e2d 100644
--- a/livingdoc-examples/aggregate/aggregate-handling/pom.xml
+++ b/livingdoc-examples/aggregate/aggregate-handling/pom.xml
@@ -7,7 +7,7 @@
ch.ifocusit.livingdoc.example
aggregate
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
aggregate-handling
diff --git a/livingdoc-examples/aggregate/aggregate-location/pom.xml b/livingdoc-examples/aggregate/aggregate-location/pom.xml
index 2783141..0eb5fd3 100644
--- a/livingdoc-examples/aggregate/aggregate-location/pom.xml
+++ b/livingdoc-examples/aggregate/aggregate-location/pom.xml
@@ -7,7 +7,7 @@
ch.ifocusit.livingdoc.example
aggregate
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
aggregate-location
diff --git a/livingdoc-examples/aggregate/aggregate-shared/pom.xml b/livingdoc-examples/aggregate/aggregate-shared/pom.xml
index 63c8067..94e5f25 100644
--- a/livingdoc-examples/aggregate/aggregate-shared/pom.xml
+++ b/livingdoc-examples/aggregate/aggregate-shared/pom.xml
@@ -7,7 +7,7 @@
ch.ifocusit.livingdoc.example
aggregate
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
aggregate-shared
diff --git a/livingdoc-examples/aggregate/aggregate-sharedhandling/pom.xml b/livingdoc-examples/aggregate/aggregate-sharedhandling/pom.xml
index 55e9a9c..ccbcde0 100644
--- a/livingdoc-examples/aggregate/aggregate-sharedhandling/pom.xml
+++ b/livingdoc-examples/aggregate/aggregate-sharedhandling/pom.xml
@@ -7,7 +7,7 @@
ch.ifocusit.livingdoc.example
aggregate
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
aggregate-sharedhandling
diff --git a/livingdoc-examples/aggregate/aggregate-voyage/pom.xml b/livingdoc-examples/aggregate/aggregate-voyage/pom.xml
index 0caa599..e401a7f 100644
--- a/livingdoc-examples/aggregate/aggregate-voyage/pom.xml
+++ b/livingdoc-examples/aggregate/aggregate-voyage/pom.xml
@@ -7,7 +7,7 @@
ch.ifocusit.livingdoc.example
aggregate
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
aggregate-voyage
diff --git a/livingdoc-examples/aggregate/aggregate-zz-livingdoc/pom.xml b/livingdoc-examples/aggregate/aggregate-zz-livingdoc/pom.xml
index d934052..24994cd 100644
--- a/livingdoc-examples/aggregate/aggregate-zz-livingdoc/pom.xml
+++ b/livingdoc-examples/aggregate/aggregate-zz-livingdoc/pom.xml
@@ -6,7 +6,7 @@
ch.ifocusit.livingdoc.example
aggregate
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
aggregate-zz-livingdoc
diff --git a/livingdoc-examples/aggregate/pom.xml b/livingdoc-examples/aggregate/pom.xml
index 6d302dd..0bae810 100644
--- a/livingdoc-examples/aggregate/pom.xml
+++ b/livingdoc-examples/aggregate/pom.xml
@@ -6,7 +6,7 @@
ch.ifocusit.livingdoc.example
livingdoc-examples
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
aggregate
diff --git a/livingdoc-examples/ddd-annotated/pom.xml b/livingdoc-examples/ddd-annotated/pom.xml
index a643a9b..6bafb4c 100644
--- a/livingdoc-examples/ddd-annotated/pom.xml
+++ b/livingdoc-examples/ddd-annotated/pom.xml
@@ -6,7 +6,7 @@
ch.ifocusit.livingdoc.example
livingdoc-examples
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
ddd-annotated
diff --git a/livingdoc-examples/ddd/pom.xml b/livingdoc-examples/ddd/pom.xml
index e8437ce..6d72993 100644
--- a/livingdoc-examples/ddd/pom.xml
+++ b/livingdoc-examples/ddd/pom.xml
@@ -6,7 +6,7 @@
ch.ifocusit.livingdoc.example
livingdoc-examples
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
ddd
@@ -72,7 +72,6 @@
= Glossary
= Use Case - Invoice management -
true
- withoutTitle=true,withChildSeparator=true
adoc
confluence
diff --git a/livingdoc-examples/microservice/pom.xml b/livingdoc-examples/microservice/pom.xml
index b5696c2..5539c87 100644
--- a/livingdoc-examples/microservice/pom.xml
+++ b/livingdoc-examples/microservice/pom.xml
@@ -6,7 +6,7 @@
ch.ifocusit.livingdoc.example
livingdoc-examples
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
microservice
jar
diff --git a/livingdoc-examples/pom.xml b/livingdoc-examples/pom.xml
index e7a7dc3..b8e4c44 100644
--- a/livingdoc-examples/pom.xml
+++ b/livingdoc-examples/pom.xml
@@ -5,7 +5,7 @@
ch.ifocusit.livingdoc.example
livingdoc-examples
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
pom
Living Documentation example
diff --git a/livingdoc-maven-plugin/pom.xml b/livingdoc-maven-plugin/pom.xml
index 7c150cf..a93e2ea 100644
--- a/livingdoc-maven-plugin/pom.xml
+++ b/livingdoc-maven-plugin/pom.xml
@@ -5,7 +5,7 @@
ch.ifocusit.livingdoc
livingdoc-maven-plugin
- 2.9-SNAPSHOT
+ 2.10-SNAPSHOT
maven-plugin
Living Documentation maven plugin
@@ -112,6 +112,11 @@
compiler
0.9.11
+
+ io.cucumber
+ gherkin
+ 27.0.0
+
diff --git a/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/GherkinMojo.java b/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/GherkinMojo.java
index 2acc254..1b7fca1 100644
--- a/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/GherkinMojo.java
+++ b/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/GherkinMojo.java
@@ -4,19 +4,19 @@
* Copyright (C) 2024 Focus IT
*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -25,7 +25,6 @@
import static java.nio.charset.Charset.defaultCharset;
import static org.apache.commons.io.FileUtils.readFileToString;
import static org.apache.commons.lang3.StringUtils.EMPTY;
-
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -36,7 +35,6 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;
-
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
@@ -44,7 +42,6 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
-
import ch.ifocusit.asciidoctor.gherkin.GherkinAsciidocBuilder;
import ch.ifocusit.asciidoctor.gherkin.GherkinExtensionHelper;
import ch.ifocusit.livingdoc.plugin.baseMojo.AbstractDocsGeneratorMojo;
@@ -54,27 +51,40 @@
/**
* @author Julien Boz
*/
-@Mojo(name = "gherkin", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM, defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES)
+@Mojo(name = "gherkin", requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM,
+ defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES)
public class GherkinMojo extends AbstractDocsGeneratorMojo {
/**
- * List of source directories to browse
+ * List of source directories to browse.
*/
@Parameter(property = "livingdoc.gherkin.features", defaultValue = "${project.basedir}/src/test/resources/features")
private List features;
/**
- * Options like use a custom template (template=path_to_my_template.erb).
+ * Add or not the page title. Default true.
+ */
+ @Parameter(property = "livingdoc.gherkin.withTitle")
+ private Boolean gherkinWithTitle;
+
+ /**
+ * Separate gherkin element with a line. Default false.
+ */
+ @Parameter(property = "livingdoc.gherkin.withChildSeparator", defaultValue = "false")
+ private boolean gherkinWithChildSeparator;
+
+ /**
+ * Append child element keyword before title (Scenario, Rule, Background, ...). Default false.
*/
- @Parameter(property = "livingdoc.gherkin.options")
- private String gherkinOptions;
+ @Parameter(property = "livingdoc.gherkin.withKeyword", defaultValue = "false")
+ private boolean gherkinWithKeyword;
@Parameter(property = "livingdoc.gherkin.output.filename", defaultValue = "gherkin", required = true)
private String gherkinOutputFilename;
/**
- * Page title or page title prefix when use in combinaison with
- * {@link #gerkinSeparateFeature} option to true
+ * Page title or page title prefix when use in combinaison with {@link #gerkinSeparateFeature}
+ * option to true
*/
@Parameter(property = "livingdoc.gherkin.title")
private String gherkinTitle;
@@ -86,15 +96,18 @@ public class GherkinMojo extends AbstractDocsGeneratorMojo {
private boolean gerkinSeparateFeature;
/**
- * Flag to indicate if generated asciidoc file must use the asciidoc gherkin
- * macro (like include macro)
+ * Flag to indicate if generated asciidoc file must use the asciidoc gherkin macro (like include
+ * macro).
*/
@Parameter(property = "livingdoc.gherkin.gherkinAsciidocMacro", defaultValue = "false")
private boolean gherkinAsciidocMacro;
/**
- * Replace gherkin processor default template. Must be used with
- * gherkinAsciidocPlugin option to false
+ * Replace gherkin processor default template.
+ * Default is used from https://github.com/jboz/asciidoctor-gherkin-extension.
+ *
+ * @see
+ * https://github.com/jboz/asciidoctor-gherkin-extension/blob/main/src/main/resources/ch/ifocusit/asciidoctor/gherkin/default_template.erb
*/
@Parameter(property = "livingdoc.gherkin.gherkinAsciidocTemplate")
private File gherkinAsciidocTemplate;
@@ -116,6 +129,9 @@ protected String getTitle() {
@Override
public void executeMojo() {
+ if (gherkinWithTitle == null) {
+ gherkinWithTitle = !gerkinSeparateFeature;
+ }
if (!gerkinSeparateFeature) {
appendTitle(getDocBuilder(pageCount.get()));
@@ -126,22 +142,24 @@ public void executeMojo() {
getLog().info("Gherkin goal - read " + path);
if (gerkinSeparateFeature && StringUtils.isNotBlank(getTitle())) {
- // read feature title
try {
- Feature feature = GherkinExtensionHelper
- .parse(readFileToString(FileUtils.getFile(path), defaultCharset()));
- String title = StringUtils.defaultString(getTitle(), EMPTY) + " " + feature.getName();
+ Feature feature = GherkinExtensionHelper.parse(readFileToString(FileUtils.getFile(path), defaultCharset()));
+ String title = getTitle() + " " + feature.getName();
appendTitle(getDocBuilder(pageCount.get()), title);
} catch (IOException e) {
throw new IllegalStateException("Error reading " + path, e);
}
}
+ if (gherkinWithTitle) {
+ getDocBuilder(pageCount.get()).textLine(":leveloffset: +1");
+ }
if (gherkinAsciidocMacro) {
- getDocBuilder(pageCount.get()).textLine(String.format("gherkin::%s[%s]", path, gherkinOptions));
+ getDocBuilder(pageCount.get()).textLine(String.format("gherkin::%s[withTitle=%s,withChildSeparator=%s,withKeyword=%s]",
+ path, gherkinWithTitle, gherkinWithChildSeparator, gherkinWithKeyword));
} else {
try {
getDocBuilder(pageCount.get()).textLine(
- gherkinBuilder(gherkinOptions)
+ gherkinBuilder()
.featureContent(readFileToString(FileUtils.getFile(path), defaultCharset()))
.build());
} catch (IOException e) {
@@ -170,25 +188,15 @@ public void executeMojo() {
}
}
- public static GherkinAsciidocBuilder gherkinBuilder(String input) throws IOException {
+ public GherkinAsciidocBuilder gherkinBuilder() throws IOException {
GherkinAsciidocBuilder builder = GherkinAsciidocBuilder.builder();
- String[] optionsString = input.split(",");
- for (String option : optionsString) {
- String[] pair = option.split("=");
- if (pair.length == 2) {
- if ("withChildSeparator".equalsIgnoreCase(pair[0])) {
- builder.withChildSeparator(Boolean.valueOf(pair[1]));
- } else if ("withKeyword".equalsIgnoreCase(pair[0])) {
- builder.withKeyword(Boolean.valueOf(pair[1]));
- } else if ("withTitle".equalsIgnoreCase(pair[0])) {
- builder.withTitle(Boolean.valueOf(pair[1]));
- } else if ("template".equalsIgnoreCase(pair[0])) {
- builder.templateContent(readFileToString(FileUtils.getFile(pair[1]), Charset.defaultCharset()));
- }
- }
+ builder.withChildSeparator(gherkinWithChildSeparator);
+ builder.withKeyword(gherkinWithKeyword);
+ builder.withTitle(gherkinWithTitle);
+ if (gherkinAsciidocTemplate != null) {
+ builder.templateContent(readFileToString(gherkinAsciidocTemplate, Charset.defaultCharset()));
}
-
return builder;
}
diff --git a/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/PublishMojo.java b/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/PublishMojo.java
index 362cc25..e30b6d7 100644
--- a/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/PublishMojo.java
+++ b/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/PublishMojo.java
@@ -4,37 +4,24 @@
* Copyright (C) 2024 Focus IT
*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package ch.ifocusit.livingdoc.plugin;
-import ch.ifocusit.livingdoc.plugin.baseMojo.AbstractAsciidoctorMojo;
-import ch.ifocusit.livingdoc.plugin.domain.Publish;
-import ch.ifocusit.livingdoc.plugin.publish.HtmlPostProcessor;
-import ch.ifocusit.livingdoc.plugin.publish.PublishProvider;
-import ch.ifocusit.livingdoc.plugin.publish.confluence.ConfluenceProvider;
-import ch.ifocusit.livingdoc.plugin.publish.model.Page;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang3.NotImplementedException;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -44,6 +31,18 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.NotImplementedException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import ch.ifocusit.livingdoc.plugin.baseMojo.AbstractAsciidoctorMojo;
+import ch.ifocusit.livingdoc.plugin.domain.Publish;
+import ch.ifocusit.livingdoc.plugin.publish.HtmlPostProcessor;
+import ch.ifocusit.livingdoc.plugin.publish.PublishProvider;
+import ch.ifocusit.livingdoc.plugin.publish.confluence.ConfluenceProvider;
+import ch.ifocusit.livingdoc.plugin.publish.model.Page;
/**
* @author Julien Boz
@@ -115,8 +114,6 @@ private HtmlPostProcessor getPostProcessor() {
private void publish(PublishProvider provider, List pages) {
pages.stream().sorted().forEach(page -> {
- // check if parent exists
- // check if page exists
if (provider.exists(page)) {
getLog().info("Publish goal - update " + page);
provider.update(page);
diff --git a/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/publish/HtmlPostProcessor.java b/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/publish/HtmlPostProcessor.java
index c72d8e0..b7a11b5 100644
--- a/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/publish/HtmlPostProcessor.java
+++ b/livingdoc-maven-plugin/src/main/java/ch/ifocusit/livingdoc/plugin/publish/HtmlPostProcessor.java
@@ -4,33 +4,27 @@
* Copyright (C) 2024 Focus IT
*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package ch.ifocusit.livingdoc.plugin.publish;
-import com.google.common.base.Charsets;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.text.StringEscapeUtils;
-import org.asciidoctor.Asciidoctor;
-import org.asciidoctor.Options;
-
-import java.io.File;
+import static ch.ifocusit.livingdoc.plugin.utils.AsciidocUtil.isAdoc;
+import static java.util.Arrays.stream;
+import static java.util.regex.Pattern.DOTALL;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -42,16 +36,20 @@
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
-import static ch.ifocusit.livingdoc.plugin.utils.AsciidocUtil.isAdoc;
-import static java.util.Arrays.stream;
-import static java.util.regex.Pattern.DOTALL;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.text.StringEscapeUtils;
+import org.asciidoctor.Asciidoctor;
+import org.asciidoctor.Options;
+import com.google.common.base.Charsets;
/**
* @author Julien Boz
*/
public class HtmlPostProcessor {
+ private static final Pattern HR_PATTERN = Pattern.compile("
");
private static final Pattern CDATA_PATTERN = Pattern.compile("", DOTALL);
private static final Pattern ATTACHMENT_PATH_PATTERN = Pattern.compile(" attachmentCollector) throws
return postProcessContent(processedContent,
replaceCrossReferenceTargets(path),
collectAndReplaceAttachmentFileNames(attachmentCollector),
- unescapeCdataHtmlContent());
+ unescapeCdataHtmlContent(),
+ fixHrTags());
+ }
+
+ private Function fixHrTags() {
+ return (content) -> replaceAll(content, HR_PATTERN, (matchResult) -> "
");
}
private Function unescapeCdataHtmlContent() {
@@ -155,10 +158,6 @@ private String tagText(String content, String tag) {
}
}
- private File parentFolder(Path pagePath) {
- return pagePath.getParent().toFile();
- }
-
private Function replaceCrossReferenceTargets(Path pagePath) {
return (content) -> replaceAll(content, PAGE_TITLE_PATTERN, (matchResult) -> {
String htmlTarget = matchResult.group(1);
diff --git a/livingdoc-maven-plugin/src/test/java/ch/ifocusit/livingdoc/plugin/publish/HtmlPostProcessorTest.java b/livingdoc-maven-plugin/src/test/java/ch/ifocusit/livingdoc/plugin/publish/HtmlPostProcessorTest.java
index f925277..13e6764 100644
--- a/livingdoc-maven-plugin/src/test/java/ch/ifocusit/livingdoc/plugin/publish/HtmlPostProcessorTest.java
+++ b/livingdoc-maven-plugin/src/test/java/ch/ifocusit/livingdoc/plugin/publish/HtmlPostProcessorTest.java
@@ -2,7 +2,6 @@
import static org.asciidoctor.SafeMode.UNSAFE;
import static org.assertj.core.api.Assertions.assertThat;
-
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
@@ -10,25 +9,23 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
-
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.Attributes;
import org.asciidoctor.Options;
+import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
-
import ch.ifocusit.livingdoc.plugin.baseMojo.AbstractAsciidoctorMojo;
@ExtendWith(MockitoExtension.class)
class HtmlPostProcessorTest {
- // @Test
+ @Test
void usePlantumlMacroShouldReplaceContent() throws IOException, URISyntaxException {
// given
Asciidoctor asciidoctor = new AbstractAsciidoctorMojo() {
@Override
- public void executeMojo() {
- }
+ public void executeMojo() {}
}.createAsciidoctor();
Options options = Options.builder()
@@ -47,14 +44,15 @@ public void executeMojo() {
Map attachmentCollector = new HashMap<>();
Path diagram = Path.of(Objects.requireNonNull(getClass().getResource("/diagram.adoc")).toURI());
- String expected = "this include plantuml diagram will be convert to confluence plantuml macro\n"
- +
- "\n"
- +
- " INLINE\n" +
- " \n" +
- "\n" +
- "";
+ String expected =
+ "this include plantuml diagram will "
+ + "be convert to confluence plantuml macro\n"
+ + "\n"
+ + " INLINE\n"
+ + " \n"
+ + "\n"
+ + "";
// when
String processed = processor.process(diagram, attachmentCollector);