Skip to content

Commit

Permalink
feat(cover-page): add support for subtitle and revision infos
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Petot committed Mar 10, 2021
1 parent ea58b3c commit ea87a8e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/document/document-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,22 @@ ${faDom.css()}
if (node.getDocumentTitle()) {
const doc = node.getDocument()
if (this.hasTitlePage(doc)) {
return `<div id="cover" class="title-page front-matter">
<h1>${node.getDocumentTitle()}</h1>
<h2>${node.getDocument().getAuthor()}</h2>
const docTitle = node.getDocument().getDocumentTitle({ partition: true })
//If the document has a subtitle, we split title in h1 / subtitle in h2
if (docTitle.hasSubtitle()){
return `<div id="cover" class="title-page front-matter">
<h1>${docTitle.getMain()}</h1>
<h2>${docTitle.getSubtitle()}</h2>
<div id="doc-author">${node.getDocument().getAuthor()}</div>
<div id="doc-rev-infos">Version ${node.getDocument().getRevisionNumber()}, ${node.getDocument().getRevisionDate()}</div>
</div>`
} else {
return `<div id="cover" class="title-page front-matter">
<h1>${docTitle.getCombined()}</h1>
<div id="doc-author">${node.getDocument().getAuthor()}</div>
<div id="doc-rev-infos">Version ${node.getDocument().getRevisionNumber()}, ${node.getDocument().getRevisionDate()}</div>
</div>`
}
}
return `<div class="title-document">
<h1>${node.getDocumentTitle()}</h1>
Expand Down

0 comments on commit ea87a8e

Please sign in to comment.