Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hello,
I am trying to produce two copies of a training course workbook: One for delegates and one for the trainer. The trainer one should have additional "secret sauce" notes in it, but I want the page numbers to be consistent across both. My plan is to add some padding in to the delegate workbook - "this page intentionally left blank" or "write your own notes here" to keep the page numbers the same in both copies. I'll use `ifdef` conditionals to render one or the other. What I'd like to do is add some kind of check to the CI build for the book so that if this padding, which will have to be done by hand, isn't right, the build will fail. I'd basically like to be able to compare the ToC from each copy and check that the main headings are on the same pages in both workbooks. Is there a place I can hook into the PDF rendering cycle to do this? Or do I need to write something to read the PDF again afterwards, outside of asciidoctor? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Matt,
I am assuming you are using asciidoctor-pdf. You are not saying how often these "secret sauce" notes change or how large they are. If they don't change often and fit on a single page, why not do something like this: // Use :trainer_copy: to create a copy for the trainer. // Use :trainer_copy!: to create a copy for the delegates. :trainer_copy: == Introduction This is the introduction to the training course. blah blah <<< ifdef::trainer_copy[] Here are the secret sauce notes. <<< endif::[] ifndef::trainer_copy[] Space for delegates to write their notes. <<< endif::[] If it needs to fit on multiple pages, you may need to use additional page breaks. That way, you will end up with the same number of pages and the same ToC. Marc. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi Mark,
Yes, I'm using asciidoctor-pdf Thanks, that's exactly what my plan is. The workbook is under heavy development at the moment, and I'd like to have an automated check that keeps the ToCs consistent between both as we go along. If there was a way to catch the ToC while it's in a data model, before it's turned into PDF content via prawn, I could say save it off as YAML and diff the two during the build pipeline. I was just wondering if there was a way to hook into that PDF rendering cycle. I had a bit of a splunk around in the code but couldn't see anywhere obvious. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Asciidoctor PDF is quite complex and intertwined with Prawn, so there's no official way to tap into the lifecycle aside from monkeypatching the converter. You can find a summary of how Matt Raible did this on his blog: https://raibledesigns.com/rd/entry/re_customizing_an_asciidoctor_pdf If we were to rewrite Asciidoctor PDF as a Prawn view, this might get a bit simpler. See https://github.com/asciidoctor/asciidoctor-pdf/issues/53 Cheers, -Dan On Thu, Nov 8, 2018 at 5:25 AM mattwynne [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi Mark, ... [show rest of quote] -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Free forum by Nabble | Edit this page |