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



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/asciidoctor/rhrev/rhrev_html.rb', line 10

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