| Class | SM::Line |
| In: |
markup/simple_markup/lines.rb
|
| Parent: | Object |
| INFINITY | = | 9999 |
| BLANK | = | :BLANK |
| HEADING | = | :HEADING |
| LIST | = | :LIST |
| RULE | = | :RULE |
| PARAGRAPH | = | :PARAGRAPH |
| VERBATIM | = | :VERBATIM |
| deleted | [RW] | true if this line has been deleted from the list of lines |
| flag | [RW] | A flag. For list lines, this is the type of the list |
| leading_spaces | [RW] | the number of leading spaces |
| level | [RW] | The indentation nesting level |
| param | [RW] | A prefix or parameter. For LIST lines, this is the text that introduced the list item (the label) |
| text | [RW] | The contents |
| type | [RW] | line type |
# File markup/simple_markup/lines.rb, line 42
42: def initialize(text)
43: @text = text.dup
44: @deleted = false
45:
46: # expand tabs
47: 1 while @text.gsub!(/\t+/) { ' ' * (8*$&.length - $`.length % 8)} && $~ #`
48:
49: # Strip trailing whitespace
50: @text.sub!(/\s+$/, '')
51:
52: # and look for leading whitespace
53: if @text.length > 0
54: @text =~ /^(\s*)/
55: @leading_spaces = $1.length
56: else
57: @leading_spaces = INFINITY
58: end
59: end
Return true if this line is blank
# File markup/simple_markup/lines.rb, line 62
62: def isBlank?
63: @text.length.zero?
64: end