ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
448 stars 92 forks source link

Support pagedjs hooks and extensions #512

Closed danyill closed 3 years ago

danyill commented 3 years ago

The documentation provides some example hooks and states that the user should:

[call] this script right after paged.js will run it before the content is parsed.

Currently document-converter.js has:

https://github.com/Mogztter/asciidoctor-web-pdf/blob/dd04f506f7982f272275929da53587f325ca02ea/lib/document/document-converter.js#L90-L106

This makes it difficult to use the standard templates and place a hook after the pagedjs script content.

What do you think? Would it be a solution to place:

 ${this.docinfoContent(node, 'footer', '-pdf.html')} 

after the final script tag (in L104)? I've tested this locally and found this allows my hooks to work just fine.

ggrossetie commented 3 years ago

Yes, I think it makes more sense to add the footer docinfo at the end.

after the final script tag (in L104)? I've tested this locally and found this allows my hooks to work just fine.

👍🏻

ggrossetie commented 3 years ago

Once it's "fixed", we should probably mention that in the documentation with a link to the official documentation: https://www.pagedjs.org/documentation/11-hooks/

Something like: you can use footer docinfo to define Paged.js hooks.