Class: Giblish::DocIdExtension::DocidPreBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/docid/docid.rb

Overview

Build a hash of => src_node that can be used to resolve doc id references to valid dst paths

Constant Summary collapse

ID_MIN_LENGTH =

The minimum number of characters required for a valid doc id

2
ID_MAX_LENGTH =

The maximum number of characters required for a valid doc id

10
DOCID_REGEX =

the regex used to find :docid: entries in the doc header

/^:docid: +(.*)$/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocidPreBuilder

Returns a new instance of DocidPreBuilder.



20
21
22
# File 'lib/giblish/docid/docid.rb', line 20

def initialize
  @id_2_node = {}
end

Instance Attribute Details

#id_2_nodeObject

Returns the value of attribute id_2_node.



9
10
11
# File 'lib/giblish/docid/docid.rb', line 9

def id_2_node
  @id_2_node
end

Instance Method Details

#on_prebuild(src_tree, dst_tree, converter) ⇒ Object

called during the pre-build phase



25
26
27
28
29
30
31
# File 'lib/giblish/docid/docid.rb', line 25

def on_prebuild(src_tree, dst_tree, converter)
  src_tree.traverse_preorder do |level, src_node|
    next unless src_node.leaf?

    parse_node(src_node)
  end
end