Maven plugin - a way to incorporate a maven property in asciidoc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Jmm
Reply | Threaded
Open this post in threaded view
|

Maven plugin - a way to incorporate a maven property in asciidoc

Jmm
Hello,

I probably overlooked it while searching the docmentation, so sorry if it is an obvious answer.

Having used the maven docbkx plugin up to now (where this feature was available), I am looking for a way to incorporate the project version number (a maven property) and pass it to a macro in asciidoc.

What would be the best way to achieve that result ?

Jmm
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin - a way to incorporate a maven property in asciidoc

wdrai
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor.version}</version>
                <configuration>
                    <doctype>article</doctype>
                    <backend>html5</backend>
                    <attributes>
                        <copycss>true</copycss>
                 <version>${myproject.version}</version>
                        <source-highlighter>highlightjs</source-highlighter>
                        <idprefix></idprefix>
                        <idseparator>-</idseparator>
                    </attributes>
                </configuration>
            </plugin>


Then in the document you can use:

Document version: {version}
Jmm
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin - a way to incorporate a maven property in asciidoc

Jmm
Thanks. It looks like what I am looking for. I will try it out.

Jmm
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin - a way to incorporate a maven property in asciidoc

mojavelinux
Administrator
In reply to this post by Jmm

Good news! This is possible using a custom attribute. The attribute is defined in the same way as built-in attributes the the source highlighter. The only difference is that the value needs to be a Maven property / variable reference. It should work just like you define other properties in Maven.

Then you refer to it in AsciiDoc like {project-version}.

I can get more specific if you need once I'm at my laptop.

-Dan

On Nov 14, 2013 2:04 PM, "Jmm [via Asciidoctor :: Discussion]" <[hidden email]> wrote:
Hello,

I probably overlooked it while searching the docmentation, so sorry if it is an obvious answer.

Having used the maven docbkx plugin up to now (where this feature was available), I am looking for a way to incorporate the project version number (a maven property) and pass it to a macro in asciidoc.

What would be the best way to achieve that result ?

Jmm


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Maven-plugin-a-way-to-incorporate-a-maven-property-in-asciidoc-tp992.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Jmm
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin - a way to incorporate a maven property in asciidoc

Jmm
It works as advertised

Thanks for the hints.

Jmm
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin - a way to incorporate a maven property in asciidoc

mojavelinux
Administrator

Awesome!

We'll get that documented. Jason, can you add that to the readme when you update it for the upcoming release?

-Dan

On Nov 14, 2013 9:43 PM, "Jmm [via Asciidoctor :: Discussion]" <[hidden email]> wrote:
It works as advertised

Thanks for the hints.

Jmm


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Maven-plugin-a-way-to-incorporate-a-maven-property-in-asciidoc-tp992p1001.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin - a way to incorporate a maven property in asciidoc

LightGuardjp
I see the issue, I'll get it out there (in the documentation) for 0.1.4 or 0.1.4.1


On Sat, Nov 16, 2013 at 2:32 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Awesome!

We'll get that documented. Jason, can you add that to the readme when you update it for the upcoming release?

-Dan

On Nov 14, 2013 9:43 PM, "Jmm [via Asciidoctor :: Discussion]" <[hidden email]> wrote:
It works as advertised

Thanks for the hints.

Jmm


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Maven-plugin-a-way-to-incorporate-a-maven-property-in-asciidoc-tp992p1001.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Maven-plugin-a-way-to-incorporate-a-maven-property-in-asciidoc-tp992p1002.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin - a way to incorporate a maven property in asciidoc

jpraet
I'm trying to pass the maven ${project.version} to asciidoctor this way, and want to use it in my document header

If I put

{version}, 2014-11-05

The variable does not get resolved.

When I put

{version} 2014-11-05

The variable *does* get resolved but this is not the standard revision line format so the document date no longer gets recognized properly.
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin - a way to incorporate a maven property in asciidoc

mojavelinux
Administrator
I've added this use case to the examples repository. You can see where I define the project-version attribute here:


And where I use it in the document here:


Unfortunately, attributes _are not_ resolved in the revnumber position in the implicit revision line:

 v{project-version}, 2014-01-01

Therefore, you have to assign the project-version to the revnumber attribute explicitly instead:

 2014-01-01
 :revnumber: {project-version}

Then, the revision number of the document will match the version of the project.

Cheers,

-Dan

On Wed, Nov 5, 2014 at 2:31 PM, jpraet [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I'm trying to pass the maven ${project.version} to asciidoctor this way, and want to use it in my document header

If I put

{version}, 2014-11-05

The variable does not get resolved.

When I put

{version} 2014-11-05

The variable *does* get resolved but this is not the standard revision line format so the document date no longer gets recognized properly.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Maven-plugin-a-way-to-incorporate-a-maven-property-in-asciidoc-tp992p2434.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--