Class: ReVIEW::Book::FootnoteIndex
- Defined in:
- lib/review/book/index.rb
Class Method Summary collapse
Methods inherited from Index
#[], #add_item, #each, #initialize, #item_type, #key?, #number
Constructor Details
This class inherits a constructor from ReVIEW::Book::Index
Class Method Details
.parse(src) ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/review/book/index.rb', line 137 def self.parse(src) index = self.new seq = 1 src.grep(%r{\A//footnote}) do |line| if m = /\[(.*?)\]\[(.*)\]/.match(line) m1 = m[1].gsub(/\\(\])/) { $1 } m2 = m[2].gsub(/\\(\])/) { $1 } index.add_item(Item.new(m1, seq, m2)) end seq += 1 end index end |