[
https://issues.apache.org/jira/browse/MSITE-1000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17801932#comment-17801932
]
ASF GitHub Bot commented on MSITE-1000:
---------------------------------------
kwin commented on code in PR #171:
URL: https://github.com/apache/maven-site-plugin/pull/171#discussion_r1439879467
##########
src/main/java/org/apache/maven/plugins/site/render/ParserConfiguration.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.plugins.site.render;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.maven.shared.utils.io.MatchPattern;
+import org.apache.maven.shared.utils.io.MatchPatterns;
+
+public class ParserConfiguration {
+
+ /**
+ * List of {@link MatchPattern} strings. If not set this configurations
applies to all documents.
+ */
+ private final List<String> patterns;
+ /**
+ * @see {@link Parser#setEmitComments(boolean)}
+ */
+ private boolean emitComments;
+ /**
+ * @see {@link Parser#setEmitAnchorsForIndexableEntries(boolean)}
+ */
+ private boolean emitAnchorsForIndexableEntries;
+
+ public ParserConfiguration() {
+ patterns = new LinkedList<>();
+ }
+
+ public boolean isEmitComments() {
+ return emitComments;
+ }
+
+ public void setEmitComments(boolean emitComments) {
+ this.emitComments = emitComments;
+ }
+
+ public boolean isEmitAnchorsForIndexableEntries() {
+ return emitAnchorsForIndexableEntries;
+ }
+
+ public void setEmitAnchorsForIndexableEntries(boolean
emitAnchorsForIndexableEntries) {
+ this.emitAnchorsForIndexableEntries = emitAnchorsForIndexableEntries;
+ }
+
+ public void addPattern(String pattern) {
+ patterns.add(pattern);
+ }
+
+ public MatchPatterns getPatterns() {
Review Comment:
Returning a Predicate on the file name is probably better instead of
exposing the impl here.
> Allow parametrisation of Doxia parser per file
> ----------------------------------------------
>
> Key: MSITE-1000
> URL: https://issues.apache.org/jira/browse/MSITE-1000
> Project: Maven Site Plugin
> Issue Type: New Feature
> Reporter: Konrad Windszus
> Priority: Major
>
> Currently only the attributes used for rendering the site can be
> parameterized in
> https://maven.apache.org/plugins/maven-site-plugin/site-mojo.html#attributes.
> There is no possibility to configure the parser in
> https://github.com/apache/maven-doxia-sitetools/blob/dacaa552c1b8e89eed84db0f43b6b0a72be91d0c/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java#L322
> per document.
> This would be nice in the context of
> https://issues.apache.org/jira/browse/DOXIA-710 where generation of anchors
> should be switched on/off for certain documents. Also generation of comments
> may be desirable for certain documents.
> I propose the following additional plugin goal parameter:
> {code}
> <parserConfigurations>
> <parserConfiguration>
> <patterns>
> <pattern>**/apt/**</pattern>
> </patterns>
> <emitAnchorsForIndexableEntries>false</emitAnchorsForIndexableEntries>
> <emitComments>true</emitComments>
> </parserConfiguration>
> <parserConfigurations>
> {code}
> where {{parserConfigurations}} is an array of a complex type with (include)
> patterns on the source path (String array) and boolean methods for features.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)