You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2018/12/09 01:18:33 UTC
[1/4] tomee-site-generator git commit: Adjust heading levels
Repository: tomee-site-generator
Updated Branches:
refs/heads/master 686e6e5b7 -> e1f56acdd
Adjust heading levels
Project: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/commit/76ca4b54
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/76ca4b54
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/76ca4b54
Branch: refs/heads/master
Commit: 76ca4b54ff2ff1a205b2a2fa681985fdafad5c0b
Parents: 686e6e5
Author: David Blevins <da...@gmail.com>
Authored: Sat Dec 8 17:00:54 2018 -0800
Committer: David Blevins <da...@gmail.com>
Committed: Sat Dec 8 17:00:54 2018 -0800
----------------------------------------------------------------------
.../website/AsciidocAdjustHeadingLevels.java | 143 +++++++++++++++++++
.../AsciidocAdjustHeadingLevelsTest.java | 123 ++++++++++++++++
2 files changed, 266 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/76ca4b54/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java b/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
new file mode 100644
index 0000000..95912ce
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+package org.apache.tomee.website;
+
+import org.apache.openejb.loader.IO;
+import org.apache.openejb.util.Join;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Consumer;
+import java.util.regex.Pattern;
+
+public class AsciidocAdjustHeadingLevels {
+
+ private final List<String> completed = new ArrayList<String>();
+ private HeadingLevel headingLevel;
+ private Consumer<String> processor;
+
+ public AsciidocAdjustHeadingLevels() {
+ this.headingLevel = new HeadingLevel(null, "", "");
+ this.processor = headingLevel::process;
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ final File docs = new File("repos/tomee-8.0/docs/");
+
+ Files.walk(docs.toPath())
+ .map(Path::toFile)
+ .filter(File::isFile)
+ .filter(path -> path.getName().endsWith(".adoc"))
+ .forEach(AsciidocAdjustHeadingLevels::process);
+
+ }
+
+ public static void process(final File file) {
+ final AsciidocAdjustHeadingLevels fix = new AsciidocAdjustHeadingLevels();
+
+ try {
+ final List<String> lines = new ArrayList<>();
+ Collections.addAll(lines, IO.slurp(file).split("\n"));
+
+ for (final String line : lines) {
+ fix.process(line);
+ }
+
+ // Update the destination readme file
+ IO.copy(IO.read(Join.join("\n", fix.completed) + "\n"), file);
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void process(final String line) {
+ processor.accept(line);
+ }
+
+ public class EndCodeblock {
+ private final String delimiter;
+
+ public EndCodeblock(final String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ public void findEnd(final String line) {
+ completed.add(line);
+
+ if (line.equals(delimiter)) {
+ processor = headingLevel::process;
+ }
+ }
+ }
+
+ private final Pattern codeblockStart = Pattern.compile("^(----|....|````)$");
+
+ public class HeadingLevel {
+ private final HeadingLevel parent;
+ private final String used;
+ private final String current;
+
+ public HeadingLevel(final HeadingLevel parent, final String used, final String current) {
+ this.parent = parent;
+ this.used = used;
+ this.current = current;
+ }
+
+ private void process(String line) {
+ if (line.startsWith("=")) {
+
+ final HeadingLevel adjusted = headingLevel.adjust(line);
+
+ if (adjusted != this) {
+ headingLevel = adjusted;
+ headingLevel.process(line);
+ return;
+ }
+
+ line = fix(line);
+ }
+
+ completed.add(line);
+ }
+
+
+ public HeadingLevel adjust(final String line) {
+ final String heading = line.replaceAll("^([=#]*).*", "$1");
+
+ if (heading.length() > used.length()) {
+ return new HeadingLevel(this, heading, this.current + "=");
+ }
+
+ if (heading.length() < used.length()) {
+ return parent.adjust(line);
+ }
+
+ return this;
+ }
+
+ public String fix(final String line) {
+ return line.replaceAll("^[=#]*", current);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/76ca4b54/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java b/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
new file mode 100644
index 0000000..1ed9dc8
--- /dev/null
+++ b/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
@@ -0,0 +1,123 @@
+package org.apache.tomee.website;
+
+import org.apache.openejb.loader.IO;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.File;
+
+public class AsciidocAdjustHeadingLevelsTest extends Assert {
+
+ @Test
+ public void testProcess() throws Exception {
+
+ final File content = File.createTempFile("content-", ".adoc");
+
+ IO.copy(IO.read("== Colors\n" +
+ "Some random text\n" +
+ "==== Reds\n" +
+ "More random text\n" +
+ "===== Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "===== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "=== Greens\n" +
+ "===== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "==== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n" +
+ "\n\n"
+ ), content);
+
+ AsciidocAdjustHeadingLevels.process(content);
+
+ final String expected = "= Colors\n" +
+ "Some random text\n" +
+ "== Reds\n" +
+ "More random text\n" +
+ "=== Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "=== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "== Greens\n" +
+ "=== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "=== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n";
+
+ final String actual = IO.slurp(content);
+
+ assertEquals(expected, actual);
+ }
+
+ @Ignore
+ @Test
+ public void testIgnoreCodeblocks() throws Exception {
+
+ final File content = File.createTempFile("content-", ".adoc");
+
+ IO.copy(IO.read("= Colors\n" +
+ "Some random text\n" +
+ "== Reds\n" +
+ "More random text\n" +
+ "----\n" +
+ "More random text\n" +
+ "===== Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "----\n" +
+ "===== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "=== Greens\n" +
+ "===== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "==== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n" +
+ "\n\n"
+ ), content);
+
+ AsciidocAdjustHeadingLevels.process(content);
+
+ final String expected = "= Colors\n" +
+ "Some random text\n" +
+ "== Reds\n" +
+ "More random text\n" +
+ "----\n" +
+ "More random text\n" +
+ "===== Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "----\n" +
+ "=== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "== Greens\n" +
+ "=== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "=== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n"
+ ;
+
+ final String actual = IO.slurp(content);
+
+ assertEquals(expected, actual);
+ }
+}
\ No newline at end of file
[2/4] tomee-site-generator git commit: Handle = or # as heading
Posted by db...@apache.org.
Handle = or # as heading
Project: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/commit/35c172db
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/35c172db
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/35c172db
Branch: refs/heads/master
Commit: 35c172db0866cf05c7921ab4b9e26ad7d491bf53
Parents: 76ca4b5
Author: David Blevins <da...@gmail.com>
Authored: Sat Dec 8 17:03:13 2018 -0800
Committer: David Blevins <da...@gmail.com>
Committed: Sat Dec 8 17:03:13 2018 -0800
----------------------------------------------------------------------
.../website/AsciidocAdjustHeadingLevels.java | 2 +-
.../AsciidocAdjustHeadingLevelsTest.java | 52 ++++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/35c172db/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java b/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
index 95912ce..39808fe 100644
--- a/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
+++ b/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
@@ -105,7 +105,7 @@ public class AsciidocAdjustHeadingLevels {
}
private void process(String line) {
- if (line.startsWith("=")) {
+ if (line.startsWith("=") || line.startsWith("#")) {
final HeadingLevel adjusted = headingLevel.adjust(line);
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/35c172db/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java b/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
index 1ed9dc8..1b0f80c 100644
--- a/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
+++ b/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
@@ -61,6 +61,58 @@ public class AsciidocAdjustHeadingLevelsTest extends Assert {
assertEquals(expected, actual);
}
+ @Test
+ public void testHandlesMixedCharacters() throws Exception {
+
+ final File content = File.createTempFile("content-", ".adoc");
+
+ IO.copy(IO.read("## Colors\n" +
+ "Some random text\n" +
+ "==== Reds\n" +
+ "More random text\n" +
+ "##### Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "===== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "### Greens\n" +
+ "===== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "==== Forrest Green\n" +
+ "More random text\n" +
+ "# Shapes\n" +
+ "More random text\n" +
+ "\n\n"
+ ), content);
+
+ AsciidocAdjustHeadingLevels.process(content);
+
+ final String expected = "= Colors\n" +
+ "Some random text\n" +
+ "== Reds\n" +
+ "More random text\n" +
+ "=== Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "=== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "== Greens\n" +
+ "=== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "=== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n";
+
+ final String actual = IO.slurp(content);
+
+ assertEquals(expected, actual);
+ }
+
@Ignore
@Test
public void testIgnoreCodeblocks() throws Exception {
[4/4] tomee-site-generator git commit: Trim whitespace on headings
Posted by db...@apache.org.
Trim whitespace on headings
Project: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/commit/e1f56acd
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/e1f56acd
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/e1f56acd
Branch: refs/heads/master
Commit: e1f56acdd154d2a28eedfb996b67bfad646fd14b
Parents: 04c3ce6
Author: David Blevins <da...@gmail.com>
Authored: Sat Dec 8 17:18:08 2018 -0800
Committer: David Blevins <da...@gmail.com>
Committed: Sat Dec 8 17:18:08 2018 -0800
----------------------------------------------------------------------
.../website/AsciidocAdjustHeadingLevels.java | 2 +-
.../AsciidocAdjustHeadingLevelsTest.java | 53 ++++++++++++++++++++
2 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/e1f56acd/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java b/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
index 03f2cb6..7c7a397 100644
--- a/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
+++ b/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
@@ -141,7 +141,7 @@ public class AsciidocAdjustHeadingLevels {
}
public String fix(final String line) {
- return line.replaceAll("^[=#]*", current);
+ return line.trim().replaceAll("^[=#]* *", current + " ");
}
}
}
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/e1f56acd/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java b/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
index 7cde793..429189f 100644
--- a/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
+++ b/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
@@ -225,4 +225,57 @@ public class AsciidocAdjustHeadingLevelsTest extends Assert {
assertEquals(expected, actual);
}
+
+ @Test
+ public void testAdjustPadding() throws Exception {
+
+ final File content = File.createTempFile("content-", ".adoc");
+
+ IO.copy(IO.read("==Colors\n" +
+ "Some random text\n" +
+ "==== Reds\n" +
+ "More random text\n" +
+ "===== Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "===== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "===Greens\n" +
+ "#####Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "==== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n" +
+ "\n\n"
+ ), content);
+
+ AsciidocAdjustHeadingLevels.process(content);
+
+ final String expected = "= Colors\n" +
+ "Some random text\n" +
+ "== Reds\n" +
+ "More random text\n" +
+ "=== Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "=== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "== Greens\n" +
+ "=== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "=== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n";
+
+ final String actual = IO.slurp(content);
+
+ assertEquals(expected, actual);
+ }
+
}
\ No newline at end of file
[3/4] tomee-site-generator git commit: Skip = or # in codeblocks
Posted by db...@apache.org.
Skip = or # in codeblocks
Project: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/commit/04c3ce62
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/04c3ce62
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/04c3ce62
Branch: refs/heads/master
Commit: 04c3ce626b8becf57c900ee89fdfa3150b800adb
Parents: 35c172d
Author: David Blevins <da...@gmail.com>
Authored: Sat Dec 8 17:10:43 2018 -0800
Committer: David Blevins <da...@gmail.com>
Committed: Sat Dec 8 17:10:43 2018 -0800
----------------------------------------------------------------------
.../website/AsciidocAdjustHeadingLevels.java | 10 +-
.../AsciidocAdjustHeadingLevelsTest.java | 105 ++++++++++++++-----
2 files changed, 86 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/04c3ce62/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java b/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
index 39808fe..03f2cb6 100644
--- a/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
+++ b/src/main/java/org/apache/tomee/website/AsciidocAdjustHeadingLevels.java
@@ -75,10 +75,10 @@ public class AsciidocAdjustHeadingLevels {
processor.accept(line);
}
- public class EndCodeblock {
+ public class Codeblock {
private final String delimiter;
- public EndCodeblock(final String delimiter) {
+ public Codeblock(final String delimiter) {
this.delimiter = delimiter;
}
@@ -105,7 +105,11 @@ public class AsciidocAdjustHeadingLevels {
}
private void process(String line) {
- if (line.startsWith("=") || line.startsWith("#")) {
+ if (codeblockStart.matcher(line).matches()) {
+
+ processor = new Codeblock(line)::findEnd;
+
+ } else if (line.startsWith("=") || line.startsWith("#")) {
final HeadingLevel adjusted = headingLevel.adjust(line);
http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/04c3ce62/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java b/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
index 1b0f80c..7cde793 100644
--- a/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
+++ b/src/test/java/org/apache/tomee/website/AsciidocAdjustHeadingLevelsTest.java
@@ -2,7 +2,6 @@ package org.apache.tomee.website;
import org.apache.openejb.loader.IO;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
@@ -113,18 +112,17 @@ public class AsciidocAdjustHeadingLevelsTest extends Assert {
assertEquals(expected, actual);
}
- @Ignore
@Test
public void testIgnoreCodeblocks() throws Exception {
+
final File content = File.createTempFile("content-", ".adoc");
- IO.copy(IO.read("= Colors\n" +
+ IO.copy(IO.read("== Colors\n" +
"Some random text\n" +
- "== Reds\n" +
+ "==== Reds\n" +
"More random text\n" +
"----\n" +
- "More random text\n" +
"===== Crimson is a kind of Red\n" +
"More random text\n" +
"----\n" +
@@ -146,27 +144,82 @@ public class AsciidocAdjustHeadingLevelsTest extends Assert {
AsciidocAdjustHeadingLevels.process(content);
final String expected = "= Colors\n" +
- "Some random text\n" +
- "== Reds\n" +
- "More random text\n" +
- "----\n" +
- "More random text\n" +
- "===== Crimson is a kind of Red\n" +
- "More random text\n" +
- "----\n" +
- "=== Ruby Red\n" +
- "More random text\n" +
- "More random text\n" +
- "== Greens\n" +
- "=== Emerald\n" +
- "\n" +
- "More random text\n" +
- "\n" +
- "=== Forrest Green\n" +
- "More random text\n" +
- "= Shapes\n" +
- "More random text\n"
- ;
+ "Some random text\n" +
+ "== Reds\n" +
+ "More random text\n" +
+ "----\n" +
+ "===== Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "----\n" +
+ "=== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "== Greens\n" +
+ "=== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "=== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n";
+
+ final String actual = IO.slurp(content);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testIgnoreCodeblocks2() throws Exception {
+
+
+ final File content = File.createTempFile("content-", ".adoc");
+
+ IO.copy(IO.read("== Colors\n" +
+ "Some random text\n" +
+ "==== Reds\n" +
+ "More random text\n" +
+ "````\n" +
+ "# Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "````\n" +
+ "===== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "=== Greens\n" +
+ "===== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "==== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n" +
+ "\n\n"
+ ), content);
+
+ AsciidocAdjustHeadingLevels.process(content);
+
+ final String expected = "= Colors\n" +
+ "Some random text\n" +
+ "== Reds\n" +
+ "More random text\n" +
+ "````\n" +
+ "# Crimson is a kind of Red\n" +
+ "More random text\n" +
+ "````\n" +
+ "=== Ruby Red\n" +
+ "More random text\n" +
+ "More random text\n" +
+ "== Greens\n" +
+ "=== Emerald\n" +
+ "\n" +
+ "More random text\n" +
+ "\n" +
+ "=== Forrest Green\n" +
+ "More random text\n" +
+ "= Shapes\n" +
+ "More random text\n";
final String actual = IO.slurp(content);