[ 
https://issues.apache.org/jira/browse/MSITE-1000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17807467#comment-17807467
 ] 

Abel Salgado Romero edited comment on MSITE-1000 at 1/16/24 10:08 PM:
----------------------------------------------------------------------

If I understand, this story is to allow clean configuration of other modules. 
If it helps, you can have a look at how we hacked our way around the 
limitations. It's similar to the proposal. This improvement is very appreciated 
and I look forward to seeing this completed.

Here is how we do it, we added a custom element `<asciidoc>` to the 
configuration, which we simply parsed by hand accessing the POM's XML 
(obviously IDE complain, but it works):
 * Get Xpp3Dom 
[https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/80c699035933aae133afaf9592bcc065c3d41b74/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java#L106-L108]
 * Parse XML by hand to generate converted API object 
[https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/80c699035933aae133afaf9592bcc065c3d41b74/src/main/java/org/asciidoctor/maven/site/SiteConversionConfigurationParser.java#L46-L80]
 * Pass the specific API object to the converter 
[https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/80c699035933aae133afaf9592bcc065c3d41b74/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java#L79]

The parser configuration is varied, strings (some could be enums), booleans, 
and free key-value maps.

My only issue with the example is `parserConfigurations`, there should be a way 
to identify the config owner, you could have AsciiDoc and MarkDown and each one 
requires different configuation. I like having the tag be called `<asciidoc>`

{{<parserConfigurations>}}
{{  <asciidoc>}}
{{    <patterns>}}
{{      <pattern>*{*}/apt/{*}*</pattern>}}
{{    </patterns>}}
{{  </asciidoc>}}
{{  <markdown>}}
{{    <patterns>}}
{{      <pattern>*{*}/apt/{*}*</pattern>}}
{{    </patterns>}}
{{  </markdown>}}
{{<parserConfigurations>}}

 

Instead of something with a tag like:

 

{{<parserConfigurations>}}
{{  <parserConfiguration>}}
{{    <parser>asciidoc</parser>}}
{{    <patterns>}}
{{      <pattern>*{*}/apt/{*}*</pattern>}}
{{    </patterns>}}
{{  </parserConfiguration>}}
{{  <parserConfiguration>}}
{{    <parser>markdownc</parser>}}
{{    <patterns>}}
{{      <pattern>*{*}/apt/{*}*</pattern>}}
{{    </patterns>}}
{{  </parserConfiguration>}}
{{<parserConfigurations>}}


was (Author: abel s.romero):
If I understand, this story is to allow clean configuration of other modules. 
If it helps, you can have a look at how we hacked our way around the 
limitations. It's similar to the proposal. This improvement is very appreciated 
and I look forward to seeing this completed.

Here is how we do it, we added a custom element `<asciidoc>` to the 
configuration, which we simply parsed by hand accessing the POM's XML 
(obviously IDE complain, but it works):
 * Get Xpp3Dom 
[https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/80c699035933aae133afaf9592bcc065c3d41b74/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java#L106-L108]
 * Parse XML by hand to generate converted API object 
[https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/80c699035933aae133afaf9592bcc065c3d41b74/src/main/java/org/asciidoctor/maven/site/SiteConversionConfigurationParser.java#L46-L80]
 * Pass the specific API object to the converter 
[https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/80c699035933aae133afaf9592bcc065c3d41b74/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java#L79]

The parser configuration is varied, strings (some could be enums), booleans, 
and free key-value maps.

My only issue with the example is `parserConfigurations`, there should be a way 
to identify the config owner, you could have AsciiDoc and MarkDown and each one 
requires different configuation. I like having the tag be called `<asciidoc>`
<parserConfigurations>
  <asciidoc>
    <patterns>
      <pattern>**/apt/**</pattern>
    </patterns>
  </asciidoc>
  <markdown>
   <patterns>
     <pattern>**/apt/**</pattern>
   </patterns>
 </markdown>
<parserConfigurations>


Instead of something with a tag like:
<parserConfigurations>
  <parserConfiguration>
    <parser>asciidoc</parser>
    <patterns>
      <pattern>**/apt/**</pattern>
    </patterns>
  </parserConfiguration>
  <parserConfiguration>
    <parser>markdownc</parser>
    <patterns>
      <pattern>**/apt/**</pattern>
    </patterns>
  </parserConfiguration>
<parserConfigurations>

> 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
>          Components: doxia integration
>            Reporter: Konrad Windszus
>            Assignee: 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-722 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)

Reply via email to