You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current template solution does not allow to override parts of the template - it is always a complete override but parts of the asciidoc environment are not available in the template - it is for example hard to realize a TOC with the current template solution.
I solved this temporary by a template which overrides asciidoc-web-pdf code:
'use strict';// require() does not search for global modulesconstmodules=require('child_process').execSync('npm root -g').toString().trim()varDocumentPDFConverter=require(modules+'/asciidoctor-pdf/lib/document/document-converter')// override https://github.com/Mogztter/asciidoctor-web-pdf/blob/0a27de7423f12fe1f8b5ff7bcb720b786fb63e5b/lib/document/document-converter.js#L490-L504classMyDocumentPDFConverterextendsDocumentPDFConverter{titlePage(node){if(node.getDocumentTitle()){constdoc=node.getDocument()if(this.hasTitlePage(doc)){return`<div id="cover" class="title-page front-matter"> <h1>${node.getDocumentTitle()}${node.getRevisionNumber()}</h1> <h2>${node.getDocument().getAuthor()}</h2> <version>${node.getRevisionRemark()}</version> </div>`}return`<div class="title-document"> <h1>${node.getDocumentTitle()}</h1> </div>`}return''}// inject revision number}constinstance=newMyDocumentPDFConverter()// copy & paste// https://github.com/Mogztter/asciidoctor-web-pdf/blob/0a27de7423f12fe1f8b5ff7bcb720b786fb63e5b/lib/document/document-converter.js#L532-L542module.exports={document: (node,opts)=>instance.convert_document(node,opts),convert_outline: (node,opts)=>instance.convert_outline(node,opts),admonition: node=>instance.convert_admonition(node),inline_callout: node=>instance.convert_inline_callout(node),inline_image: node=>instance.convert_inline_image(node),inline_footnote: node=>instance.convert_inline_footnote(node),colist: node=>instance.convert_colist(node),page_break: node=>instance.convert_page_break(node),preamble: node=>instance.convert_preamble(node)}
But this solution is a bit hacky - it might be better to pass more data into the template or to allow partial overrides of convert_document.
The text was updated successfully, but these errors were encountered:
The current template solution does not allow to override parts of the template - it is always a complete override but parts of the asciidoc environment are not available in the template - it is for example hard to realize a TOC with the current template solution.
I solved this temporary by a template which overrides asciidoc-web-pdf code:
But this solution is a bit hacky - it might be better to pass more data into the template or to allow partial overrides of convert_document.
The text was updated successfully, but these errors were encountered: