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



125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/asciidoctor/rhrev/rhrev_html.rb', line 125

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