[
https://issues.apache.org/jira/browse/DOXIA-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17827225#comment-17827225
]
ASF GitHub Bot commented on DOXIA-734:
--------------------------------------
michael-o commented on code in PR #204:
URL: https://github.com/apache/maven-doxia/pull/204#discussion_r1525401870
##########
doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml1BaseParser.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.maven.doxia.parser;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.UnaryOperator;
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
+import org.codehaus.plexus.util.xml.pull.XmlPullParser;
+
+/**
+ * Acts as bridge between legacy parsers relying on <a
href="https://www.w3.org/TR/xhtml1/">XHTML 1.0 Transitional (based on HTML4)</a>
+ * and the {@link Xhtml5BaseParser} only supporting (X)HTML5
elements/attributes.
+ *
+ * Adds support for elements/attributes which <a
href="https://html.spec.whatwg.org/#non-conforming-features">became obsolete in
HTML5</a> but are
+ * commonly used for XDoc/FML.
+ *
+ * @see <a href="https://www.w3.org/TR/html5-diff/">HTML5 Differences from
HTML4</a>.
+ */
+public class Xhtml1BaseParser extends Xhtml5BaseParser {
+
+ private static final class AttributeMapping {
+ private final String sourceName;
+ private final String targetName;
+ private final UnaryOperator<String> valueMapper;
+ private final MergeSemantics mergeSemantics;
+
+ enum MergeSemantics {
+ OVERWRITE,
+ IGNORE,
+ PREPEND
Review Comment:
Do we need append as well?
> anchor element with "name" attribute no longer detected by
> XdocParser/FmlParser
> -------------------------------------------------------------------------------
>
> Key: DOXIA-734
> URL: https://issues.apache.org/jira/browse/DOXIA-734
> Project: Maven Doxia
> Issue Type: Bug
> Components: Module - Apt, Module - Fml
> Reporter: Konrad Windszus
> Priority: Major
>
> Currently only {{<a id=...>}} is translated into a proper
> {{Sink.anchor(...)}} call.
> The obsolete {{<a name=...>}} is currently not calling an according
> {{Sink.anchor(...)}} method but may be still used in ancient markups which
> derive from the XHtml5BaseParser.
> For example XDoc and FML both stem from the time where
> https://www.w3.org/TR/xhtml1/ was the most recent XHTML spec and therefore
> support {{a name}} (according to
> https://maven.apache.org/doxia/doxia/doxia-modules/doxia-module-xdoc/xsddoc/http___maven.apache.org_XDOC_2.0/element/a.html
> and
> https://maven.apache.org/doxia/doxia/doxia-modules/doxia-module-fml/xsddoc/http___maven.apache.org_FML_1.0.1/element/a.html)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)