This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch bugfix/unclosed-sections in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
commit 2d1c3f4abe0ede52a78f0e7bbb866fd29b603fcc Author: Konrad Windszus <[email protected]> AuthorDate: Wed Mar 1 20:28:01 2023 +0100 [DOXIA-699] Add failing test case --- .../maven/doxia/module/xhtml5/Xhtml5SinkTest.java | 30 ++++ .../src/test/resources/test-sections.html | 154 +++++++++++++++++++++ 2 files changed, 184 insertions(+) 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 f1dc2916..5fdb12d3 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 @@ -18,20 +18,32 @@ */ package org.apache.maven.doxia.module.xhtml5; +import javax.inject.Inject; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import org.apache.maven.doxia.markup.HtmlMarkup; +import org.apache.maven.doxia.parser.ParseException; +import org.apache.maven.doxia.parser.Parser; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.impl.AbstractSinkTest; import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; +import org.apache.maven.doxia.sink.impl.SinkEventTestingSink; import org.junit.jupiter.api.Test; +import org.opentest4j.AssertionFailedError; import static org.apache.maven.doxia.util.HtmlTools.escapeHTML; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; public class Xhtml5SinkTest extends AbstractSinkTest { + @Inject + private Xhtml5Parser parser; + /** {@inheritDoc} */ protected String outputExtension() { return "html"; @@ -385,4 +397,22 @@ public class Xhtml5SinkTest extends AbstractSinkTest { protected String getCommentBlock(String text) { return "<!--" + toXmlComment(text) + "-->"; } + + @Test + public void testRoundtrip() throws IOException, ParseException { + parseFile(parser, "test-sections", getSink()); + + final SinkEventTestingSink regeneratedSink = new SinkEventTestingSink(); + try (Reader reader = new StringReader(getSinkContent())) { + parser.parse(reader, regeneratedSink); + } + + } + + private void parseFile(Parser parser, String file, Sink sink) throws ParseException, IOException { + try (Reader reader = getTestReader(file)) { + parser.parse(reader, sink); + } + } + } diff --git a/doxia-modules/doxia-module-xhtml5/src/test/resources/test-sections.html b/doxia-modules/doxia-module-xhtml5/src/test/resources/test-sections.html new file mode 100644 index 00000000..215c59d5 --- /dev/null +++ b/doxia-modules/doxia-module-xhtml5/src/test/resources/test-sections.html @@ -0,0 +1,154 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.9.1 from content/apt/maven-features.apt at 2019-11-02 + | Rendered using Apache Maven Fluido Skin 1.8 +--> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="generator" content="Apache Maven Doxia Site Renderer 1.9.1" /> + <meta name="author" content="Jason van Zyl" /> + <meta name="date" content="2005-10-12" /> + <title>Maven – Maven Features</title> + <link rel="stylesheet" href="./css/apache-maven-fluido-1.8.min.css" /> + <link rel="stylesheet" href="./css/site.css" /> + <link rel="stylesheet" href="./css/print.css" media="print" /> + <script src="./js/apache-maven-fluido-1.8.min.js"></script> + <!-- Google Analytics --> + <script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + ga('create', 'UA-140879-1', 'auto'); + ga('send', 'pageview'); + ga('set', 'anonymizeIp', true); + ga('set', 'forceSSL', true); + </script> + </head> + <body class="topBarDisabled"> + <div class="container-fluid"> + <header> + <div id="banner"> + <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><img src="images/apache-maven-project.png" alt="Apache Maven Site"/></a></div> + <div class="pull-right"><a href="./" id="bannerRight"><img src="images/maven-logo-black-on-white.png" alt=""/></a></div> + <div class="clear"><hr/></div> + </div> + + <div id="breadcrumbs"> + <ul class="breadcrumb"> + <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> + <li class=""><a href="index.html" title="Maven">Maven</a><span class="divider">/</span></li> + <li class="active ">Maven Features <a href="https://github.com/apache/maven-site/tree/master/content/apt/maven-features.apt"><img src="./images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2019-11-02</li> + <li class="pull-right"><span class="divider">|</span> +<a href="scm.html" title="Get Sources">Get Sources</a></li> + <li class="pull-right"><a href="download.cgi" title="Download">Download</a></li> + </ul> + </div> + </header> + <div class="row-fluid"> + <header id="leftColumn" class="span2"> + <nav class="well sidebar-nav"> + <ul class="nav nav-list"> + <li><a href="index.html" title="Welcome"><span class="none"></span>Welcome</a></li> + <li><a href="https://www.apache.org/licenses/" class="externalLink" title="License"><span class="none"></span>License</a></li> + <li class="nav-header">About Maven</li> + <li><a href="what-is-maven.html" title="What is Maven?"><span class="none"></span>What is Maven?</a></li> + <li class="active"><a href="#"><span class="none"></span>Features</a></li> + <li><a href="download.html" title="Download"><span class="none"></span>Download</a></li> + <li><a href="users/index.html" title="Use"><span class="icon-chevron-right"></span>Use</a></li> + <li><a href="docs/history.html" title="Release Notes"><span class="none"></span>Release Notes</a></li> + <li class="nav-header">Documentation</li> + <li><a href="plugins/index.html" title="Maven Plugins"><span class="none"></span>Maven Plugins</a></li> + <li><a href="guides/index.html" title="Index (category)"><span class="none"></span>Index (category)</a></li> + <li><a href="users/index.html" title="User Centre"><span class="icon-chevron-right"></span>User Centre</a></li> + <li><a href="plugin-developers/index.html" title="Plugin Developer Centre"><span class="icon-chevron-right"></span>Plugin Developer Centre</a></li> + <li><a href="repository/index.html" title="Maven Central Repository"><span class="icon-chevron-right"></span>Maven Central Repository</a></li> + <li><a href="developers/index.html" title="Maven Developer Centre"><span class="icon-chevron-right"></span>Maven Developer Centre</a></li> + <li><a href="articles.html" title="Books and Resources"><span class="none"></span>Books and Resources</a></li> + <li><a href="security.html" title="Security"><span class="none"></span>Security</a></li> + <li class="nav-header">Community</li> + <li><a href="community.html" title="Community Overview"><span class="none"></span>Community Overview</a></li> + <li><a href="project-roles.html" title="Project Roles"><span class="none"></span>Project Roles</a></li> + <li><a href="guides/development/guide-helping.html" title="How to Contribute"><span class="none"></span>How to Contribute</a></li> + <li><a href="users/getting-help.html" title="Getting Help"><span class="none"></span>Getting Help</a></li> + <li><a href="issue-management.html" title="Issue Management"><span class="none"></span>Issue Management</a></li> + <li><a href="scm.html" title="Getting Maven Source"><span class="none"></span>Getting Maven Source</a></li> + <li><a href="team.html" title="The Maven Team"><span class="none"></span>The Maven Team</a></li> + <li class="nav-header">Project Documentation</li> + <li><a href="project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a></li> + <li class="nav-header">Maven Projects</li> + <li><a href="archetype/index.html" title="Archetype"><span class="none"></span>Archetype</a></li> + <li><a href="resolver/index.html" title="Artifact Resolver"><span class="none"></span>Artifact Resolver</a></li> + <li><a href="doxia/index.html" title="Doxia"><span class="none"></span>Doxia</a></li> + <li><a href="jxr/index.html" title="JXR"><span class="none"></span>JXR</a></li> + <li><a href="ref/current" title="Maven"><span class="none"></span>Maven</a></li> + <li><a href="pom/index.html" title="Parent POMs"><span class="none"></span>Parent POMs</a></li> + <li><a href="plugins/index.html" title="Plugins"><span class="none"></span>Plugins</a></li> + <li><a href="plugin-testing/index.html" title="Plugin Testing"><span class="none"></span>Plugin Testing</a></li> + <li><a href="plugin-tools/index.html" title="Plugin Tools"><span class="none"></span>Plugin Tools</a></li> + <li><a href="apache-resource-bundles/index.html" title="Resource Bundles"><span class="none"></span>Resource Bundles</a></li> + <li><a href="scm/index.html" title="SCM"><span class="none"></span>SCM</a></li> + <li><a href="shared/index.html" title="Shared Components"><span class="none"></span>Shared Components</a></li> + <li><a href="skins/index.html" title="Skins"><span class="none"></span>Skins</a></li> + <li><a href="surefire/index.html" title="Surefire"><span class="none"></span>Surefire</a></li> + <li><a href="wagon/index.html" title="Wagon"><span class="none"></span>Wagon</a></li> + <li class="nav-header">ASF</li> + <li><a href="https://www.apache.org/foundation/how-it-works.html" class="externalLink" title="How Apache Works"><span class="none"></span>How Apache Works</a></li> + <li><a href="https://www.apache.org/foundation/" class="externalLink" title="Foundation"><span class="none"></span>Foundation</a></li> + <li><a href="https://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsoring Apache"><span class="none"></span>Sponsoring Apache</a></li> + <li><a href="https://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a></li> + </ul> + </nav> + <div class="well sidebar-nav"> +<form id="search-form" action="https://www.google.com/search" method="get" > + <input value="https://maven.apache.org" name="sitesearch" type="hidden"/> + <input class="search-query" name="q" id="query" type="text" /> +</form> +<script>asyncJs( 'https://cse.google.com/brand?form=search-form' )</script> + <hr /> + <div id="poweredBy"> + <div class="clear"></div> + <div id="twitter"> + <a href="https://twitter.com/ASFMavenProject" class="twitter-follow-button" data-show-count="false" data-align="left" data-size="medium" data-show-screen-name="true" data-lang="en">Follow ASFMavenProject</a> + <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> + </div> + <div class="clear"></div> + <div class="clear"></div> +<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a> + </div> + </div> + </header> + <main id="bodyColumn" class="span10" > +<section> +<h2><a name="Feature_Summary"></a>Feature Summary</h2> +<p>The following are the key features of Maven in a nutshell:</p> +<ul> +<li>Simple project setup that follows best practices - get a new project or module started in seconds</li> +<li>Consistent usage across all projects - means no ramp up time for new developers coming onto a project</li> +<li>Superior dependency management including automatic updating, dependency closures (also known as transitive dependencies)</li> +<li>Able to easily work with multiple projects at the same time</li> +<li>A <a href="/repository/">large and growing repository of libraries and metadata</a> to use out of the box, and arrangements in place with the largest Open Source projects for real-time availability of their latest releases</li> +<li>Extensible, with the ability to easily <a href="/plugin-developers/">write plugins</a> in Java or scripting languages</li> +<li>Instant access to new features with little or no extra configuration</li> +<li>Ant tasks for dependency management and deployment outside of Maven</li> +<li>Model based builds: Maven is able to build any number of projects into predefined output types such as a JAR, WAR, or distribution based on metadata about the project, without the need to do any scripting in most cases.</li> +<li>Coherent site of project information: Using the same metadata as for the build process, Maven is able to generate a web site or PDF including any documentation you care to add, and adds to that standard reports about the state of development of the project. Examples of this information can be seen at the bottom of the left-hand navigation of this site under the "Project Information" and "Project Reports" submenus.</li> +<li>Release management and distribution publication: Without much additional configuration, Maven will integrate with your source control system (such as Subversion or Git) and manage the release of a project based on a certain tag. It can also publish this to a distribution location for use by other projects. Maven is able to publish individual outputs such as a JAR, an archive including other dependencies and documentation, or as a source distribution.</li> +<li>Dependency management: Maven encourages the use of a central repository of JARs and other dependencies. Maven comes with a mechanism that your project's clients can use to download any JARs required for building your project from a central JAR repository much like Perl's CPAN. This allows users of Maven to reuse JARs across projects and encourages communication between projects to ensure that backward compatibility issues are dealt with.</li></ul></section> + </main> + </div> + </div> + <hr/> + <footer> + <div class="container-fluid"> + <div class="row-fluid"> + <p>Copyright © 2002–2019<a href="https://www.apache.org/">The Apache Software Foundation</a>. +.</p> + </div> + </div> + </footer> + </body> +</html> \ No newline at end of file
