Asciidoctor YAML style file for PDF and maven

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

Asciidoctor YAML style file for PDF and maven

Jeremie Bresson
Is there any example or document about combining the asciidoctor-maven-plugin and the YAML style file.

In the applying your theme section I see how to use the command line and ruby.

Is YAML style supported in Asciidoctorj?
And is this option available in the maven plugin?

If nothing exists, I will look at the java code...

Thank you in advance.

Jérémie
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

abelsromero
Regarding the first question, there isn't any example that I am aware of.

About the support in asciidoctorj/maven I don't see why I should not work.
Command line attributes can be passed using the attributes section in the pom https://github.com/asciidoctor/asciidoctor-maven-plugin#builtin-attributes.

Can you test it?
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

mojavelinux
Administrator

On Wed, Oct 14, 2015 at 5:23 AM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote:
About the support in asciidoctorj/maven I don't see why I should not work.

My thoughts exactly. We just need to sort out the paths and it should work just fine...and to actually give it a shot.

-Dan


--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

Jeremie Bresson
Thank you for the hint. I was able to start something.
https://github.com/jmini/asciidoctor-maven-examples/tree/patch-6/asciidoctor-pdf-book-example

It is not good enough yet to be integrated it to the official repository.
1/ I did not manage to have an appropriate background_image on the title_page (this is my principal motivation for this approach).
2/ I probably need to define some nice colors for the text.

Feedback is welcome.
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

mojavelinux
Administrator

On Thu, Oct 15, 2015 at 1:48 PM, Jeremie Bresson [via Asciidoctor :: Discussion] <[hidden email]> wrote:
1/ I did not manage to have an appropriate background_image on the title_page (this is my principal motivation for this approach).

Aha! I figured out what the problem is. AsciidoctorJ PDF bundles Prawn 1.3.0. In Prawn 1.3.0, the method needed to add a background image to a page was removed. It was then restored in Prawn 2. AsciidoctorJ PDF ships with Prawn 1.3.0, so this functionality is temporarily unavailable. AsciidoctorJ can't yet ship with Prawn 2 because Prawn 2 depends on Ruby 2, which means using JRuby 9.0.0.0. Since we hadn't made that jump yet, the current release of the toolchain is stuck between a rock and a hardplace. (Prawn put the JRuby community in a tight spot with their decision to drop Ruby 1.9, in my opinion).

Suffice to say, background images and colors aren't available when using AsciidoctorJ PDF right now. They will work as soon as we bundle Prawn 2 in AsciidoctorJ PDF (or you decide to temporarily use external gems with JRuby 9.0.0.0, which is tricky but possible).

Here's how to work around it:

$ rvm use jruby9k@maven-build --create
   gem install asciidoctor-pdf --pre
   gem install rouge

In the configuration for the Asciidoctor Maven plugin in your pom.xml:

1. Specify jruby-complete as a dependency using version 9.0.0.0 (or whatever 9k version you want).
2. Set the gemPaths configuration property to resolve to a local GEM_HOME

<gemPath>${env.GEM_HOME}</gemPath>

It should use the locally installed AsciidoctorJ PDF and Prawn 2, which have the hooks needed to add the background image.

Long story short, you have the configuration right. And will start working as soon as the right upgrades happen :)

Cheers,

-Dan


--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

mojavelinux
Administrator
In reply to this post by Jeremie Bresson

On Thu, Oct 15, 2015 at 4:42 PM, Dan Allen <[hidden email]> wrote:
AsciidoctorJ PDF ships with Prawn 1.3.0, so this functionality is temporarily unavailable.

I want to clarify that this is not a fault of AsciidoctorJ PDF. There is no other version of Prawn that can be bundled and still work with AsciidoctorJ. We'll definitely want to switch to Prawn 2 in AsciidoctorJ 1.6.0 (and switch to JRuby 9.0.0.0).

-Dan


--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

Jeremie Bresson
Thank you a lot for the explanations.

I am sorry but I do not follow you with this workaround. I have managed to sell my team Asciidoctor with this argument: we can use it on our build servers (and on any build server), because it gets everything from maven central. This is an important point for us. For the developers locally, installation setup can be reduced to the installation of a Chrome Extension (and optionally a text editor, but this is not requested).

My vision is: I get what I can get from the current version. Everything else is marked as nice to have, "on hold" waiting for Asciidoctor issue X and/or version Y.

I am glad you helped my figuring out a way to use pdf theme with maven. This will solve some of the issues we have on our TODO list:
* running headers (eg. CHAPTER 1. INTRODUCTION)
* aligning figures (centered)
For image cover, I mark this as "on hold", waiting on a released version of Asciidoctor 1.6.0.

I know everybody is busy… but there is really some good stuff on the preview branches of Asciidoctor. Maybe it is time to release some alpha version of those branches. I will be happy to test and document if you go in this direction.
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

mojavelinux
Administrator
Jérémie,

I was simply documenting how I was able to demonstrate that the upgrade to Prawn 2 solves the problem of the missing background image. Obviously, for “production” usage, this means waiting on a new release of AsciidoctorJ PDF (one that includes Prawn 2). (not just AsciidoctorJ 1.6.0).

An alpha release of AsciidoctorJ 1.6.0 is coming soon (slated for before Devoxx). At the same time, we're going to split AsciidoctorJ PDF out into its own repository so that it can have independent releases (without the hoops we have to jump through right now). Once the alpha of AsciidoctorJ 1.6.0 is out, then we can make an alpha of AsciidoctorJ PDF that uses Prawn 2.

Cheers,

-Dan

On Fri, Oct 16, 2015 at 4:05 AM, Jeremie Bresson [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thank you a lot for the explanations.

I am sorry but I do not follow you with this workaround. I have managed to sell my team Asciidoctor with this argument: we can use it on our build servers (and on any build server), because it gets everything from maven central. This is an important point for us. For the developers locally, installation setup can be reduced to the installation of a Chrome Extension (and optionally a text editor, but this is not requested).

My vision is: I get what I can get from the current version. Everything else is marked as nice to have, "on hold" waiting for Asciidoctor issue X and/or version Y.

I am glad you helped my figuring out a way to use pdf theme with maven. This will solve some of the issues we have on our TODO list:
* running headers (eg. CHAPTER 1. INTRODUCTION)
* aligning figures (centered)
For image cover, I mark this as "on hold", waiting on a released version of Asciidoctor 1.6.0.

I know everybody is busy… but there is really some good stuff on the preview branches of Asciidoctor. Maybe it is time to release some alpha version of those branches. I will be happy to test and document if you go in this direction.



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Asciidoctor-YAML-style-file-for-PDF-and-maven-tp3849p3859.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

Jeremie Bresson
Dan, I hope there is no misunderstanding. I appreciate having your explanations to understand what is going on.

I am really looking forward to the new versions. You can count on me to help (at least for testing, updating examples and documentation). I will do as much as I can.
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

mojavelinux
Administrator
Super! Thanks Jérémie. No misunderstanding at all. I just wanted to reassure you that my explanations were a lab report and that we will aim to get this working officially.

Cheers!

-Dan

On Tue, Oct 20, 2015 at 1:04 AM, Jeremie Bresson [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Dan, I hope there is no misunderstanding. I appreciate having your explanations to understand what is going on.

I am really looking forward to the new versions. You can count on me to help (at least for testing, updating examples and documentation). I will do as much as I can.



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Asciidoctor-YAML-style-file-for-PDF-and-maven-tp3849p3874.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

Jeremie Bresson
This post was updated on .
I have rethinked the problem and your possible workaround. My goal was: being able to run everything from maven (no need to setup anything else). This possible with the TorqueBox RubyGems Maven Proxy Repository.

I have now a plain maven solution where I set the prawn version to 2.0.2
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Asciidoctor PDF Book Maven example 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- gem-maven-plugin:1.0.10:initialize (default) @ asciidoctor-pdf-book-example ---
[INFO] Successfully installed prawn-2.0.2
[INFO] Successfully installed ttfunk-1.4.0
[INFO] Successfully installed pdf-core-0.6.0
[INFO] 3 gems installed
[INFO]
[INFO] --- asciidoctor-maven-plugin:1.5.3:process-asciidoc (generate-pdf-book-doc) @ asciidoctor-pdf-book-example ---
[WARNING] Using inherited external environment to resolve gems (C:/****/asciidoctor-maven-examples/asciidoctor-pdf-book-example/target/gems-provided), i.e. build is platform dependent!
[INFO] Rendered C:\****\asciidoctor-maven-examples\asciidoctor-pdf-book-example\src\docs\asciidoc\example-manual.adoc
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ asciidoctor-pdf-book-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\****\asciidoctor-maven-examples\asciidoctor-pdf-book-example\src\main\resources
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.830 s
[INFO] Finished at: 2015-12-23T12:21:18+01:00
[INFO] Final Memory: 85M/989M
[INFO] ------------------------------------------------------------------------
And it works!

Pull request:
https://github.com/asciidoctor/asciidoctor-maven-examples/pull/39

If this pull request is accepted, I will create an issue to remove the rubygem work arround, when everything is released directly in asciidoctorj-pdf (version 1.6.0 or something).
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor YAML style file for PDF and maven

mojavelinux
Administrator


I have now a plain maven solution where I set the prawn version to 2.0.2

Indeed. Since we are using JRuby 9000, it's perfectly safe to upgrade to Prawn 2 (since JRuby 9000 is Ruby 2.2).


If this pull request is accepted, I will create an issue to remove the rubygem work arround, when everything is released directly in asciidoctorj-pdf (version 1.6.0 or something).

Thanks!

-Dan

--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen