コード例 #1
0
 def read(lines):
     line_buffer = [next(lines)]
     while lines.peek() is not None and '|' in lines.peek():
         line_buffer.append(next(lines))
     if len(line_buffer) < 2 or '---' not in line_buffer[1]:
         raise tokenizer.MismatchException()
     return line_buffer
コード例 #2
0
ファイル: block_token.py プロジェクト: hason/mistletoe
 def read(lines):
     line_buffer = []
     for line in lines:
         if line == '\n':
             break
         line_buffer.append(line)
         if line.startswith(('===', '---')):
             return line_buffer
     raise tokenizer.MismatchException(line_buffer)
コード例 #3
0
 def read(lines):
     line_buffer = [next(lines)]
     next_line = lines.peek()
     while (next_line is not None
             and next_line != '\n'
             and not Heading.start(next_line)
             and not BlockCode.start(next_line)
             and not CodeFence.start(next_line)
             and not List.start(next_line)):
         line = next(lines)
         line_buffer.append(line)
         if line.startswith(('===', '---')):
             return line_buffer
         next_line = lines.peek()
     raise tokenizer.MismatchException(line_buffer)