Class | SM::LineCollection |
In: |
markup/simple_markup/fragments.rb
|
Parent: | Object |
Collect groups of lines together. Each group will end up containing a flow of text
# File markup/simple_markup/fragments.rb, line 127 127: def initialize 128: @fragments = [] 129: end
# File markup/simple_markup/fragments.rb, line 161 161: def accept(am, visitor) 162: 163: visitor.start_accepting 164: 165: @fragments.each do |fragment| 166: case fragment 167: when Verbatim 168: visitor.accept_verbatim(am, fragment) 169: when Rule 170: visitor.accept_rule(am, fragment) 171: when ListStart 172: visitor.accept_list_start(am, fragment) 173: when ListEnd 174: visitor.accept_list_end(am, fragment) 175: when ListItem 176: visitor.accept_list_item(am, fragment) 177: when BlankLine 178: visitor.accept_blank_line(am, fragment) 179: when Heading 180: visitor.accept_heading(am, fragment) 181: when Paragraph 182: visitor.accept_paragraph(am, fragment) 183: end 184: end 185: 186: visitor.end_accepting 187: end
# File markup/simple_markup/fragments.rb, line 131 131: def add(fragment) 132: @fragments << fragment 133: end
# File markup/simple_markup/fragments.rb, line 135 135: def each(&b) 136: @fragments.each(&b) 137: end
Factory for different fragment types
# File markup/simple_markup/fragments.rb, line 145 145: def fragment_for(*args) 146: Fragment.for(*args) 147: end
tidy up at the end
# File markup/simple_markup/fragments.rb, line 150 150: def normalize 151: change_verbatim_blank_lines 152: add_list_start_and_ends 153: add_list_breaks 154: tidy_blank_lines 155: end