This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
The following commit(s) were added to refs/heads/master by this push: new 1b32ad45 [DOXIA-695] Support heading level 6 (#193) 1b32ad45 is described below commit 1b32ad456fdf6fa6342cb08dfeb4e35bed25c739 Author: Konrad Windszus <k...@apache.org> AuthorDate: Fri Jan 5 21:31:09 2024 +0100 [DOXIA-695] Support heading level 6 (#193) --- .../org/apache/maven/doxia/index/IndexEntry.java | 6 +-- .../org/apache/maven/doxia/markup/HtmlMarkup.java | 3 ++ .../maven/doxia/parser/Xhtml5BaseParser.java | 29 ++++-------- .../apache/maven/doxia/sink/impl/AbstractSink.java | 20 ++++++++ .../maven/doxia/sink/impl/Xhtml5BaseSink.java | 32 +++++++------ .../maven/doxia/sink/impl/AbstractSinkTest.java | 33 +++++++++++++ .../org/apache/maven/doxia/module/apt/AptSink.java | 4 ++ .../apache/maven/doxia/module/apt/AptSinkTest.java | 6 +++ .../doxia/module/markdown/MarkdownSinkTest.java | 5 ++ .../src/test/resources/test.md | 4 ++ .../apache/maven/doxia/module/xdoc/XdocParser.java | 10 +--- .../apache/maven/doxia/module/xdoc/XdocSink.java | 18 +++++--- .../maven/doxia/module/xdoc/XdocSinkTest.java | 5 ++ .../maven/doxia/module/xhtml5/Xhtml5Parser.java | 2 +- .../maven/doxia/module/xhtml5/Xhtml5SinkTest.java | 5 ++ .../java/org/apache/maven/doxia/sink/Sink.java | 54 ++++++++++++++++++++-- 16 files changed, 180 insertions(+), 56 deletions(-) diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexEntry.java b/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexEntry.java index 178e403c..f85fe519 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexEntry.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexEntry.java @@ -70,7 +70,7 @@ public class IndexEntry { SECTION_3(Sink.SECTION_LEVEL_3), SECTION_4(Sink.SECTION_LEVEL_4), SECTION_5(Sink.SECTION_LEVEL_5), - SECTION_6(), + SECTION_6(Sink.SECTION_LEVEL_6), DEFINED_TERM(), FIGURE(), TABLE(); @@ -86,9 +86,9 @@ public class IndexEntry { } static Type fromSectionLevel(int level) { - if (level < Sink.SECTION_LEVEL_1 || level > Sink.SECTION_LEVEL_5) { + if (level < Sink.SECTION_LEVEL_1 || level > Sink.SECTION_LEVEL_6) { throw new IllegalArgumentException("Level must be between " + Sink.SECTION_LEVEL_1 + " and " - + Sink.SECTION_LEVEL_5 + " but is " + level); + + Sink.SECTION_LEVEL_6 + " but is " + level); } return Arrays.stream(Type.values()) .filter(t -> level == t.sectionLevel) diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/markup/HtmlMarkup.java b/doxia-core/src/main/java/org/apache/maven/doxia/markup/HtmlMarkup.java index c46ed090..28ccd818 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/markup/HtmlMarkup.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/markup/HtmlMarkup.java @@ -321,6 +321,9 @@ public interface HtmlMarkup extends XmlMarkup { /** HTML5 tag for <code>h5</code>. */ Tag H5 = Tag.H5; + /** HTML5 tag for <code>h6</code>. */ + Tag H6 = Tag.H6; + /** HTML5 tag for <code>head</code>. */ Tag HEAD = Tag.HEAD; diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java index 24d6c7f8..4574264d 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java @@ -209,6 +209,8 @@ public class Xhtml5BaseParser extends AbstractXmlParser implements HtmlMarkup { handleHeadingStart(sink, Sink.SECTION_LEVEL_4, attribs); } else if (parser.getName().equals(HtmlMarkup.H5.toString())) { handleHeadingStart(sink, Sink.SECTION_LEVEL_5, attribs); + } else if (parser.getName().equals(HtmlMarkup.H6.toString())) { + handleHeadingStart(sink, Sink.SECTION_LEVEL_6, attribs); } else if (parser.getName().equals(HtmlMarkup.HEADER.toString())) { sink.header(attribs); } else if (parser.getName().equals(HtmlMarkup.MAIN.toString())) { @@ -507,6 +509,8 @@ public class Xhtml5BaseParser extends AbstractXmlParser implements HtmlMarkup { sink.sectionTitle4_(); } else if (parser.getName().equals(HtmlMarkup.H5.toString())) { sink.sectionTitle5_(); + } else if (parser.getName().equals(HtmlMarkup.H6.toString())) { + sink.sectionTitle6_(); } else if (parser.getName().equals(HtmlMarkup.HEADER.toString())) { sink.header_(); } else if (parser.getName().equals(HtmlMarkup.MAIN.toString())) { @@ -648,6 +652,7 @@ public class Xhtml5BaseParser extends AbstractXmlParser implements HtmlMarkup { * * @param newLevel the new section level, all upper levels have to be closed. * @param sink the sink to receive the events. + * @param enforceNewSection whether to enforce a new section or not */ protected void emitHeadingSections(int newLevel, Sink sink, boolean enforceNewSection) { int lowerBoundSectionLevel = newLevel; @@ -682,16 +687,8 @@ public class Xhtml5BaseParser extends AbstractXmlParser implements HtmlMarkup { */ private void closeOpenHeadingSections(int newLevel, Sink sink) { while (this.headingLevel > newLevel) { - if (headingLevel == Sink.SECTION_LEVEL_5) { - sink.section5_(); - } else if (headingLevel == Sink.SECTION_LEVEL_4) { - sink.section4_(); - } else if (headingLevel == Sink.SECTION_LEVEL_3) { - sink.section3_(); - } else if (headingLevel == Sink.SECTION_LEVEL_2) { - sink.section2_(); - } else if (headingLevel == Sink.SECTION_LEVEL_1) { - sink.section1_(); + if (headingLevel >= Sink.SECTION_LEVEL_1 && headingLevel <= Sink.SECTION_LEVEL_6) { + sink.section_(headingLevel); } this.headingLevel--; @@ -709,16 +706,8 @@ public class Xhtml5BaseParser extends AbstractXmlParser implements HtmlMarkup { while (this.headingLevel < newLevel) { this.headingLevel++; - if (headingLevel == Sink.SECTION_LEVEL_5) { - sink.section5(); - } else if (headingLevel == Sink.SECTION_LEVEL_4) { - sink.section4(); - } else if (headingLevel == Sink.SECTION_LEVEL_3) { - sink.section3(); - } else if (headingLevel == Sink.SECTION_LEVEL_2) { - sink.section2(); - } else if (headingLevel == Sink.SECTION_LEVEL_1) { - sink.section1(); + if (headingLevel >= Sink.SECTION_LEVEL_1 && headingLevel <= Sink.SECTION_LEVEL_6) { + sink.section(headingLevel, null); } } } diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java index a4d81cbd..35184c32 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java @@ -185,6 +185,26 @@ public abstract class AbstractSink implements Sink, Markup { sectionTitle_(5); } + @Override + public final void section6() { + section(6, null); + } + + @Override + public final void section6_() { + section_(6); + } + + @Override + public final void sectionTitle6() { + sectionTitle(6, null); + } + + @Override + public final void sectionTitle6_() { + sectionTitle_(6); + } + @Override public final void header() { header(null); diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java index b62d24e1..03693d3a 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java @@ -322,7 +322,7 @@ public class Xhtml5BaseSink extends AbstractXmlSink implements HtmlMarkup { * @param attributes some attributes. May be null. */ protected void onSection(int depth, SinkEventAttributes attributes) { - if (depth >= SECTION_LEVEL_1 && depth <= SECTION_LEVEL_5) { + if (depth >= SECTION_LEVEL_1 && depth <= SECTION_LEVEL_6) { MutableAttributeSet att = new SinkEventAttributeSet(); att.addAttributes(SinkUtils.filterAttributes(attributes, SinkUtils.SINK_BASE_ATTRIBUTES)); @@ -334,10 +334,10 @@ public class Xhtml5BaseSink extends AbstractXmlSink implements HtmlMarkup { * Ends a section. * * @param depth The level of the section. - * @see javax.swing.text.html.HTML.Tag#DIV + * @see #SECTION */ protected void onSection_(int depth) { - if (depth >= SECTION_LEVEL_1 && depth <= SECTION_LEVEL_5) { + if (depth >= SECTION_LEVEL_1 && depth <= SECTION_LEVEL_6) { writeEndTag(HtmlMarkup.SECTION); } } @@ -347,11 +347,12 @@ public class Xhtml5BaseSink extends AbstractXmlSink implements HtmlMarkup { * * @param depth The level of the section title. * @param attributes some attributes. May be null. - * @see javax.swing.text.html.HTML.Tag#H1 - * @see javax.swing.text.html.HTML.Tag#H2 - * @see javax.swing.text.html.HTML.Tag#H3 - * @see javax.swing.text.html.HTML.Tag#H4 - * @see javax.swing.text.html.HTML.Tag#H5 + * @see #H1 + * @see #H2 + * @see #H3 + * @see #H4 + * @see #H5 + * @see #H6 */ protected void onSectionTitle(int depth, SinkEventAttributes attributes) { MutableAttributeSet atts = SinkUtils.filterAttributes(attributes, SinkUtils.SINK_SECTION_ATTRIBUTES); @@ -366,6 +367,8 @@ public class Xhtml5BaseSink extends AbstractXmlSink implements HtmlMarkup { writeStartTag(HtmlMarkup.H4, atts); } else if (depth == SECTION_LEVEL_5) { writeStartTag(HtmlMarkup.H5, atts); + } else if (depth == SECTION_LEVEL_6) { + writeStartTag(HtmlMarkup.H6, atts); } } @@ -373,11 +376,12 @@ public class Xhtml5BaseSink extends AbstractXmlSink implements HtmlMarkup { * Ends a section title. * * @param depth The level of the section title. - * @see javax.swing.text.html.HTML.Tag#H1 - * @see javax.swing.text.html.HTML.Tag#H2 - * @see javax.swing.text.html.HTML.Tag#H3 - * @see javax.swing.text.html.HTML.Tag#H4 - * @see javax.swing.text.html.HTML.Tag#H5 + * @see #H1 + * @see #H2 + * @see #H3 + * @see #H4 + * @see #H5 + * @see #H6 */ protected void onSectionTitle_(int depth) { if (depth == SECTION_LEVEL_1) { @@ -390,6 +394,8 @@ public class Xhtml5BaseSink extends AbstractXmlSink implements HtmlMarkup { writeEndTag(HtmlMarkup.H4); } else if (depth == SECTION_LEVEL_5) { writeEndTag(HtmlMarkup.H5); + } else if (depth == SECTION_LEVEL_6) { + writeEndTag(HtmlMarkup.H6); } } diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java index 2b8e4152..90df6f9d 100644 --- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java +++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java @@ -410,6 +410,31 @@ public abstract class AbstractSinkTest extends AbstractModuleTest { assertEquals(expected, actual, "Wrong section5 block!"); } + /** + * Checks that the sequence <code>[section6(), sectionTitle6(), + * text(title), sectionTitle6_(), section6_()]</code>, + * invoked on the current sink, produces the same result as + * {@link #getSection6Block}. + */ + @Test + public void testSection6() { + String title = "Title6"; + sink.section6(); + sink.header(); + sink.sectionTitle6(); + sink.text(title); + sink.sectionTitle6_(); + sink.header_(); + sink.section6_(); + sink.flush(); + sink.close(); + + String actual = testWriter.toString(); + String expected = getSection6Block(title); + + assertEquals(expected, actual, "Wrong section6 block!"); + } + /** * Checks that the sequence <code>[header(), header_()]</code>, * invoked on the current sink, produces the same result as @@ -1271,6 +1296,14 @@ public abstract class AbstractSinkTest extends AbstractModuleTest { */ protected abstract String getSection5Block(String title); + /** + * Returns a Section6 block generated by this sink. + * @param title The title to use. + * @return The result of invoking a Section6 block on the current sink. + * @see #testSection6() + */ + protected abstract String getSection6Block(String title); + /** * Returns a header block generated by this sink. * @return The result of invoking a header block on the current sink. diff --git a/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java b/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java index 58a2a0ec..6a1854cb 100644 --- a/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java +++ b/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java @@ -264,6 +264,10 @@ public class AptSink extends AbstractTextSink implements AptMarkup { @Override public void sectionTitle(int level, SinkEventAttributes attributes) { + if (level > 5) { + LOGGER.warn("Replacing unsupported section title level {} in APT with level 5", level); + level = 5; + } if (level == 1) { write(EOL); } else if (level > 1) { diff --git a/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java b/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java index be5c520f..3e23c073 100644 --- a/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java +++ b/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java @@ -126,6 +126,12 @@ public class AptSinkTest extends AbstractSinkTest { return EOL + StringUtils.repeat(AptMarkup.SECTION_TITLE_START_MARKUP, 4) + title + EOL + EOL + EOL; } + /** {@inheritDoc} */ + protected String getSection6Block(String title) { + // Everything above level 5 is automatically converted to level 5 (as APT doesn't support deeper nesting) + return EOL + StringUtils.repeat(AptMarkup.SECTION_TITLE_START_MARKUP, 4) + title + EOL + EOL + EOL; + } + /** {@inheritDoc} */ protected String getHeaderBlock() { return ""; diff --git a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownSinkTest.java b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownSinkTest.java index 229a66af..1a3b38f8 100644 --- a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownSinkTest.java +++ b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownSinkTest.java @@ -134,6 +134,11 @@ public class MarkdownSinkTest extends AbstractSinkTest { return getSectionBlock(title, 5); } + /** {@inheritDoc} */ + protected String getSection6Block(String title) { + return getSectionBlock(title, 6); + } + /** {@inheritDoc} */ protected String getHeaderBlock() { return ""; diff --git a/doxia-modules/doxia-module-markdown/src/test/resources/test.md b/doxia-modules/doxia-module-markdown/src/test/resources/test.md index 2922caf4..451e1600 100644 --- a/doxia-modules/doxia-module-markdown/src/test/resources/test.md +++ b/doxia-modules/doxia-module-markdown/src/test/resources/test.md @@ -18,3 +18,7 @@ code |b **bold** im|test|test|  + +###### heading level 6 + +some paragraph \ No newline at end of file diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java index b826b123..8cc9a068 100644 --- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java +++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java @@ -266,14 +266,8 @@ public class XdocParser extends Xhtml5BaseParser implements XdocMarkup { */ private void closeOpenSections(int newLevel, Sink sink) { while (getSectionLevel() >= newLevel) { - if (getSectionLevel() == Sink.SECTION_LEVEL_5) { - sink.section5_(); - } else if (getSectionLevel() == Sink.SECTION_LEVEL_4) { - sink.section4_(); - } else if (getSectionLevel() == Sink.SECTION_LEVEL_3) { - sink.section3_(); - } else if (getSectionLevel() == Sink.SECTION_LEVEL_2) { - sink.section2_(); + if (getSectionLevel() > Sink.SECTION_LEVEL_1) { + sink.section_(getSectionLevel()); } setSectionLevel(getSectionLevel() - 1); diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java index e84ef1fc..f4e55b96 100644 --- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java +++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java @@ -286,9 +286,10 @@ public class XdocSink extends Xhtml5BaseSink implements XdocMarkup { * {@inheritDoc} * * Starts a section title. - * @see javax.swing.text.html.HTML.Tag#H3 - * @see javax.swing.text.html.HTML.Tag#H4 - * @see javax.swing.text.html.HTML.Tag#H5 + * @see #H3 + * @see #H4 + * @see #H5 + * @see #H6 */ protected void onSectionTitle(int depth, SinkEventAttributes attributes) { MutableAttributeSet atts = SinkUtils.filterAttributes(attributes, SinkUtils.SINK_SECTION_ATTRIBUTES); @@ -299,6 +300,8 @@ public class XdocSink extends Xhtml5BaseSink implements XdocMarkup { writeStartTag(H4, atts); } else if (depth == SECTION_LEVEL_5) { writeStartTag(H5, atts); + } else if (depth == SECTION_LEVEL_6) { + writeStartTag(H6, atts); } } @@ -306,9 +309,10 @@ public class XdocSink extends Xhtml5BaseSink implements XdocMarkup { * {@inheritDoc} * * Ends a section title. - * @see javax.swing.text.html.HTML.Tag#H3 - * @see javax.swing.text.html.HTML.Tag#H4 - * @see javax.swing.text.html.HTML.Tag#H5 + * @see #H3 + * @see #H4 + * @see #H5 + * @see #H6 */ protected void onSectionTitle_(int depth) { if (depth == SECTION_LEVEL_1 || depth == SECTION_LEVEL_2) { @@ -319,6 +323,8 @@ public class XdocSink extends Xhtml5BaseSink implements XdocMarkup { writeEndTag(H4); } else if (depth == SECTION_LEVEL_5) { writeEndTag(H5); + } else if (depth == SECTION_LEVEL_6) { + writeEndTag(H6); } } diff --git a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java index 8f2a570e..60491aba 100644 --- a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java +++ b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java @@ -162,6 +162,11 @@ public class XdocSinkTest extends AbstractSinkTest { return "<header>" + EOL + "<h5>" + title + "</h5></header>"; } + /** {@inheritDoc} */ + protected String getSection6Block(String title) { + return "<header>" + EOL + "<h6>" + title + "</h6></header>"; + } + /** {@inheritDoc} */ protected String getHeaderBlock() { return "<header></header>"; diff --git a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java index 0af57d1e..643746b2 100644 --- a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java +++ b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java @@ -158,7 +158,7 @@ public class Xhtml5Parser extends Xhtml5BaseParser implements Xhtml5Markup { } else if (parser.getName().equals(TITLE.toString())) { sink.title_(); } else if (parser.getName().equals(BODY.toString())) { - consecutiveSections(0, sink, null); + emitHeadingSections(0, sink, false); sink.body_(); } else if (parser.getName().equals(ADDRESS.toString())) { diff --git a/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java b/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java index 930aeaaf..8d262e0a 100644 --- a/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java +++ b/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java @@ -149,6 +149,11 @@ public class Xhtml5SinkTest extends AbstractSinkTest { return "<section><header>\n<h5>" + title + "</h5></header></section>"; } + /** {@inheritDoc} */ + protected String getSection6Block(String title) { + return "<section><header>\n<h6>" + title + "</h6></header></section>"; + } + /** {@inheritDoc} */ protected String getHeaderBlock() { return "<header></header>"; diff --git a/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java b/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java index 6e981cf1..f7d73952 100644 --- a/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java +++ b/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java @@ -114,6 +114,13 @@ public interface Sink extends AutoCloseable { */ int SECTION_LEVEL_5 = 5; + /** + * A level 6 section. + * @see #section(int,SinkEventAttributes) + * @since 2.0.0 + */ + int SECTION_LEVEL_6 = 6; + /** * Center alignment for table cells. * @see #tableRows(int[], boolean) @@ -503,7 +510,7 @@ public interface Sink extends AutoCloseable { /** * Starts a 5th heading element which contains the topic of the section. - * This has to be contained within a {@link #section4()} element. + * This has to be contained within a {@link #section5()} element. * <p> * Shortcut for {@link #section(int, SinkEventAttributes)} with first argument being {@code 5} and second argument being {@code null}. * @@ -528,9 +535,46 @@ public interface Sink extends AutoCloseable { /** * Ends a 5th title heading element. Shortcut for {@link #sectionTitle_(int)} with argument being {@code 5}. + * @since 2.0.0 */ void sectionTitle5_(); + /** + * Starts a 6th heading element which contains the topic of the section. + * This has to be contained within a {@link #section6()} element. + * <p> + * Shortcut for {@link #section(int, SinkEventAttributes)} with first argument being {@code 6} and second argument being {@code null}. + * + * @see #section(int,SinkEventAttributes) + * @since 2.0.0 + */ + void section6(); + + /** + * Ends a 6th heading element. Shortcut for {@link #section_(int)} with argument being {@code 6}. + * + * @since 2.0.0 + */ + void section6_(); + + /** + * Starts a 6th title heading element. This element is optional, but if it exists, + * it has to be contained, and be the first element, within a {@link #section5()} element. + * <p> + * Shortcut for {@link #sectionTitle(int, SinkEventAttributes)} with first argument being {@code 6} and second argument being {@code null}. + * + * @see #sectionTitle(int,SinkEventAttributes) + * @since 2.0.0 + */ + void sectionTitle6(); + + /** + * Ends a 6th title heading element. Shortcut for {@link #sectionTitle_(int)} with argument being {@code 6}. + * + * @since 2.0.0 + */ + void sectionTitle6_(); + /** * Start a new section at the given level. * @@ -541,7 +585,7 @@ public interface Sink extends AutoCloseable { * Supported attributes are the {@link SinkEventAttributes base attributes}. * </p> * - * @param level the section level. + * @param level the section level (must be a value between {@value #SECTION_LEVEL_1} and {@value #SECTION_LEVEL_6}). * @param attributes A set of {@link SinkEventAttributes}, may be <code>null</code>. * @since 1.1 */ @@ -550,7 +594,7 @@ public interface Sink extends AutoCloseable { /** * Ends a section at the given level. * - * @param level the section level. + * @param level the section level (must be a value between {@value #SECTION_LEVEL_1} and {@value #SECTION_LEVEL_6}). * @since 1.1 */ void section_(int level); @@ -576,7 +620,7 @@ public interface Sink extends AutoCloseable { * {@link SinkEventAttributes#ALIGN ALIGN}. * </p> * - * @param level the section title level. + * @param level the section title level (must be a value between {@value #SECTION_LEVEL_1} and {@value #SECTION_LEVEL_6}). * @param attributes A set of {@link SinkEventAttributes}, may be <code>null</code>. * @since 1.1 */ @@ -585,7 +629,7 @@ public interface Sink extends AutoCloseable { /** * Ends a section title at the given level. * - * @param level the section title level. + * @param level the section title level (must be a value between {@value #SECTION_LEVEL_1} and {@value #SECTION_LEVEL_6}). * @since 1.1 */ void sectionTitle_(int level);