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

Hervé Boutemy edited comment on DOXIASITETOOLS-94 at 1/3/16 10:50 AM:
----------------------------------------------------------------------

here is the use case: when the documentation of a component requires code 
execution

example: http://maven.apache.org/ref/3.3.9/maven-embedder/cli.html
for this one, I had to create [a JUnit unit 
test|https://github.com/apache/maven/blob/maven-3.3.9/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java]
 that generates a temporary .html file, then [use snippet macro in an apt 
file|https://github.com/apache/maven/blob/maven-3.3.9/maven-embedder/src/site/apt/cli.apt.vm]
 to include the content

this is quite convoluted

then I'm looking for better alternatives:
- writing Doxia macros: was a failure at the moment, the new macro is not found 
(notice: creating test jar and adding it to maven-site-plugin dependencies is 
quite long also)
- this idea with any Plexus component (which will require the same dependency 
addition to maven-site-plugin)
- a way for maven-site-plugin to configure objects to inject into Velocity 
context? (like attributes, but with arbitrary Objects as value, and not only 
Strings)?
- some way to add a Velocity Tool?

any other idea to inject custom local code into a documents' Velocity context?



was (Author: hboutemy):
here is the use case: when the documentation of a component requires code 
execution

example: http://maven.apache.org/ref/3.3.9/maven-embedder/cli.html
for this one, I had to create [a JUnit unit 
test|https://github.com/apache/maven/blob/maven-3.3.9/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java]
 that generates a temporary .html file, then [use snippet macro in an apt 
file|https://github.com/apache/maven/blob/maven-3.3.9/maven-embedder/src/site/apt/cli.apt.vm]
 to include the content

this is quite convoluted

then I'm looking for better alternatives:
- writing Doxia macros: was a failure at the moment, the new macro is not found 
(notice: creating test jar and adding it to maven-site-plugin dependencies is 
quite long also)
- this idea with any Plexus component (which will require the same dependency 
addition to maven-site-plugin)

any other idea to inject custom local code into a documents' Velocity context?


> add plexus container to Velocity context
> ----------------------------------------
>
>                 Key: DOXIASITETOOLS-94
>                 URL: https://issues.apache.org/jira/browse/DOXIASITETOOLS-94
>             Project: Maven Doxia Sitetools
>          Issue Type: Improvement
>          Components: Site renderer
>    Affects Versions: 1.6
>            Reporter: Hervé Boutemy
>             Fix For: 1.7
>
>
> this will permit plexus components retrieving



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to