Class FrontBackMatterTreeprocessor

java.lang.Object
org.asciidoctor.extension.BaseProcessor
org.asciidoctor.extension.Treeprocessor
network.ike.docs.koncept.FrontBackMatterTreeprocessor
All Implemented Interfaces:
org.asciidoctor.extension.Processor

public final class FrontBackMatterTreeprocessor extends org.asciidoctor.extension.Treeprocessor
Tags level-1 special sections so the print stylesheets can route them to front- or back-matter page schemes instead of the chapter scheme.

Under the book doctype an unnumbered [preface], [colophon], [dedication], [abstract] or [acknowledgments] section, and a [appendix], [glossary], [bibliography] or [index] section, all render as a bare <div class="sect1"> — indistinguishable in CSS from a numbered chapter. This treeprocessor adds the role front-matter or back-matter, which the HTML5 backend emits as an extra class (<div class="sect1 front-matter">), so the loose-leaf overlay can exclude them from chapter numbering (keeping composite folios aligned with the document's section numbers) and give them their own folio scheme.

Registered via the SPI (KonceptExtensionRegistry) so the asciidoctor-maven-plugin auto-discovers it for every process-asciidoc render. Operates on the parsed AST only, so it is backend-agnostic and safe for every backend, including Prawn PDF.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the treeprocessor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.asciidoctor.ast.Document
    process(org.asciidoctor.ast.Document document)
    Add a front-matter/back-matter role to level-1 special sections.

    Methods inherited from class org.asciidoctor.extension.BaseProcessor

    createBlock, createBlock, createBlock, createBlock, createBlock, createBlock, createBlock, createDocument, createList, createList, createList, createListItem, createListItem, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createSection, createSection, createSection, createSection, createSection, createTable, createTable, createTableCell, createTableCell, createTableCell, createTableCell, createTableColumn, createTableColumn, createTableRow, getConfig, log, newCursor, newCursor, newCursor, newReader, newReader, newReader, newReader, parseContent, setConfig, unwrap, updateConfig

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FrontBackMatterTreeprocessor

      public FrontBackMatterTreeprocessor()
      Creates the treeprocessor.
  • Method Details

    • process

      public org.asciidoctor.ast.Document process(org.asciidoctor.ast.Document document)
      Add a front-matter/back-matter role to level-1 special sections.
      Specified by:
      process in class org.asciidoctor.extension.Treeprocessor
      Parameters:
      document - the parsed document
      Returns:
      the same document, with roles added to special sections