190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
# File 'lib/markascend/parser.rb', line 190
def scan_line_and_block undent=:all
if line = @src.scan(/.+?(?:\n|\z)/)
block = @src.scan(/
(?:\ *\n)* # leading empty lines
(?<indent>\ {2,})
.*?(?:\n|\z) # first line content
(
\g<indent>\ *
.*?(?:\n|\z) # rest line content
|
(?:\ *\n)* # rest empty line
)*
/x)
block = nil if block =~ /\A\s*\z/
if block
if undent == :all
/
(?:\ *\n)*
(?<indent>\ {2,})
/x =~ block
block.gsub! /^#{indent}/, ''
else
block.gsub! /^\ \ /, ''
end
end
end
[line, block]
end
|