Sha256: 9b651c83ec78c287e6c8e48cfd8f4eec60d6cd1ac41bfe88685982bdf2958760
Contents?: true
Size: 646 Bytes
Versions: 4
Compression:
Stored size: 646 Bytes
Contents
#require 'singleton' module ArtiMark class HeadParser include BaseParser, Singleton def accept?(lines) lex_line_command(lines[0])[:cmd] =~ /h[1-6]/ end def parse(lines, r, syntax) line = escape_html lines[0] line = replace_inline_commands(line, syntax, r) lexed = lex_line_command(line) raise 'HeadParser called for #{lines[0]}' unless lexed[:cmd] =~ /h([1-6])/ lines.shift r << "<#{lexed[:cmd]}#{ids_string(lexed[:ids])}#{class_string(lexed[:cls])}>#{lexed[:text].strip}</#{lexed[:cmd]}>\n" r.toc = lexed[:text].strip if lexed[:params].member? 'in-toc' end end end
Version data entries
4 entries across 4 versions & 1 rubygems