You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/10/01 22:19:17 UTC
[maven-doxia] branch DOXIA-671 created (now 115e5673)
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a change to branch DOXIA-671
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
at 115e5673 [DOXIA-671] Double quotes contained in markdown page are removed in HTML output
This branch includes the following new commits:
new 115e5673 [DOXIA-671] Double quotes contained in markdown page are removed in HTML output
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven-doxia] 01/01: [DOXIA-671] Double quotes contained in markdown page are removed in HTML output
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch DOXIA-671
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
commit 115e5673f98ecda902460d43dd89bf5678c43efb
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Oct 2 00:18:38 2022 +0200
[DOXIA-671] Double quotes contained in markdown page are removed in HTML output
Ideally, one would use this list in the future:
https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
---
.../maven/doxia/parser/AbstractXmlParser.java | 34 +++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
index 1cf38ad6..7adb8d25 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
@@ -44,6 +44,7 @@ import org.apache.maven.doxia.util.XmlValidator;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
import org.codehaus.plexus.util.xml.pull.MXParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@@ -91,6 +92,18 @@ public abstract class AbstractXmlParser
private boolean validate = false;
+ /**
+ * If set the parser will be loaded with all single characters
+ * from the XHTML specification.
+ * The entities used:
+ * <ul>
+ * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
+ * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
+ * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
+ * </ul>
+ */
+ private boolean addDefaultEntities = true;
+
/** {@inheritDoc} */
public void parse( Reader source, Sink sink, String reference )
throws ParseException
@@ -120,7 +133,9 @@ public abstract class AbstractXmlParser
// 2 second parsing to process
try
{
- XmlPullParser parser = new MXParser();
+ XmlPullParser parser = addDefaultEntities
+ ? new MXParser( EntityReplacementMap.defaultEntityReplacementMap )
+ : new MXParser();
parser.setInput( src );
@@ -569,6 +584,23 @@ public abstract class AbstractXmlParser
this.validate = validate;
}
+ /**
+ * @since 2.0.0-M4
+ */
+ public boolean getAddDefaultEntities()
+ {
+ return addDefaultEntities;
+ }
+
+ /**
+ * @since 2.0.0-M4
+ */
+ public void setAddDefaultEntities( boolean addDefaultEntities )
+ {
+ this.addDefaultEntities = addDefaultEntities;
+ }
+
+
// ----------------------------------------------------------------------
// Private methods
// ----------------------------------------------------------------------