module Garage::Docs::AnchorBuilding
Public Instance Methods
postprocess(full_document)
click to toggle source
# File lib/garage/docs/anchor_building.rb, line 9 def postprocess(full_document) reset full_document end
preprocess(full_document)
click to toggle source
# File lib/garage/docs/anchor_building.rb, line 4 def preprocess(full_document) reset full_document end
Private Instance Methods
reset()
click to toggle source
# File lib/garage/docs/anchor_building.rb, line 16 def reset @anchors = Hash.new(0) end
to_anchor(text)
click to toggle source
# File lib/garage/docs/anchor_building.rb, line 20 def to_anchor(text) unique_text = text + @anchors[text].to_s @anchors[text] += 1 unique_text.gsub(/\s+/, '-').gsub(/<\/?[^>]*>/, '').downcase end