Class: Asciidoctor::Rhrev::HtmlTreeprocessor

Inherits:
Extensions::Treeprocessor
  • Object
show all
Defined in:
lib/asciidoctor/rhrev/rhrev_html.rb

Overview

Treeprocessor to auto-inject revision history at document start

Instance Method Summary collapse

Instance Method Details

#process(document) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/asciidoctor/rhrev/rhrev_html.rb', line 118

def process document
  return document unless document.attr? 'rhrev'
  
  rhrev_value = document.attr('rhrev')
  return document if rhrev_value == 'macro' || rhrev_value == 'manual'
  
  # Insert rhrev block at the beginning of the document
  rhrev_block = create_block document, :rhrev, nil, {}
  document.blocks.unshift rhrev_block
  
  document
end