Hi everyone,
I'm trying to add properties like :linkattrs: and :source-highlighter: to asciidoc files in a global way. One way to do this would be to add these to header element of some sort, but it's unclear to me how I would do this via the pom.xml (see code example below): <plugin> <groupId>org.asciidoctor</groupId> <artifactId>asciidoctor-maven-plugin</artifactId> <version>1.5.2.1</version> <configuration> <sourceHighlighter>coderay</sourceHighlighter> <doctype>book</doctype> <backend>html5</backend> <preserveDirectories>true</preserveDirectories> <sourceDirectory> ${basedir}/src/site/asciidoc </sourceDirectory> <templateDir> ${basedir}/src/site/templates </templateDir> <templateEngine>velocity</templateEngine> <templateDir>${basedir}/src/site/templates</templateDir> <outputDirectory> ${basedir}/target/site </outputDirectory> <headerFooter>true</headerFooter> <attributes> <linkattrs>true</linkattrs> <source-highlighter>coderay</source-highlighter> <coderay-css>class</coderay-css> </attributes> </configuration> <executions> <execution> <id>output-html</id> <phase>site</phase> <goals> <goal>process-asciidoc</goal> </goals> </execution> </executions> </plugin> I can add these properties to individual *.adoc files and have it work, but there must be some way to configure this globally. Am I missing something? Anything that I might be overlooking? Thanks! |
Administrator
|
You are correct that you can add these properties to the pom.xml. What you have looks right to me at first glace, but to sure I recommend comparing it with the examples. Cheers, -Dan On Mon, Oct 5, 2015 at 7:33 AM, ruaanvds [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi everyone, Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen |
Hi Dan,
Thanks for this. I seem to have missed the canonical pom configuration examples - these are immensely helpful. Ruaan |
This post was updated on .
In reply to this post by mojavelinux
Hey Dan,
I'm having immense difficulty in getting the above to work. I've noticed that when I switch to version 3.3 of maven-site the <linkattrs> work, but I lose the Velocity template (see default.vm in the included example). When I switch back to 3.4, I get the Velocity template, but none of the Asciidoctor <attributes> seem to work. The coderay source highlighting also seems to get lost. Is the way I'm using Apache Velocity wrong? Is there some simple configuration step that I'm missing? This is running on the latest version of the Maven Asciidoctor plugin. Also, see sample maven-site attached. Please let me know if I need to provide some more detail. Ruaan EDIT: Just realised I attached the same image twice - updated to reflect the two states. EDIT2: Okay, I'm unable to add two different images for some reason. velocity-mvn.zip |
In reply to this post by ruaanvds
Hi Ruaan, did you get any further with this? I'm trying to add support for generating the Asciidoctor TOC in a Maven site skin, and running into difficulties in how to get started.
|
I figured it out! I just need to use toc:macro and toc::macro[].
|
In reply to this post by misty
Hi Misty,
No, it's been a real pain. I've had to mainly add directives to the top of asciidoc pages, like: :linkattrs: :source-highlighter: coderay To get <configuration> properties to work. This is problematic, since I'm running into errors like "only book doctypes can contain level 0 sections", even though the doctype is declared as "book", amongst other issues. |
Are you using the asciidoc maven plugin directly or via the site plugin ?
I'm not 100% shure but I think that configuration properties/Attributes do NOT work if you are using the site plugin. |
I'm using this in conjunction with maven-site, as stipulated here: http://asciidoctor.org/docs/asciidoctor-maven-plugin/#maven-site-integration.
Is this a short-coming of the maven asciidoctor implementation as it currently stands? |
Administrator
|
On Fri, Nov 13, 2015 at 1:20 AM, ruaanvds [via Asciidoctor :: Discussion] <[hidden email]> wrote: Is this a short-coming of the maven asciidoctor implementation as it currently stands? Correct. The site plugin is a completely different invocation of Asciidoctor and currently has no ability to be configured externally. (Hence why you have to define the attributes in the document itself). It's unclear to those of us working on the plugin how the parser module is supposed to access the information from the pom. (Any links to docs is appreciated). Once we figure that out, then we can honor Asciidoctor configuration in the pom.xml. Basically, all that works right now in the site plugin is vanilla Asciidoctor (no external configuration). |
Administrator
|
In reply to this post by ruaanvds
On Fri, Oct 16, 2015 at 7:36 AM, ruaanvds [via Asciidoctor :: Discussion] <[hidden email]> wrote:
My understanding is that Maven site is undergoing some significant changes and this is causing our plugin to behave differently. I don't know much more than that. |
Free forum by Nabble | Edit this page |