Sha256: af096508d686eb7e4676e39cce5cd65c223beb02054838d11e176d01b2d5dbc7

Contents?: true

Size: 541 Bytes

Versions: 5

Compression:

Stored size: 541 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)
      lexed = lex_line_command(lines[0])
      raise 'HeadParser called for #{lines[0]}' unless lexed[:cmd] =~ /h([1-6])/
      lines.shift
      r << "<#{lexed[:cmd]}#{class_string(lexed[:cls])}>#{escape_html lexed[:text].strip}</#{lexed[:cmd]}>\n"
      r.toc = lexed[:text].strip if lexed[:params].member? 'in-toc'
    end
  end
end

Version data entries

5 entries across 4 versions & 1 rubygems

Version Path
arti_mark-0.0.1.beta3 lib/arti_mark/head_parser.rb
arti_mark-0.0.1.beta3 lib/arti_mark/head_parser_flymake.rb
arti_mark-0.0.1.beta2 lib/arti_mark/head_parser.rb
arti_mark-0.0.1.beta1 lib/arti_mark/head_parser.rb
arti_mark-0.0.1.beta0 lib/arti_mark/head_parser.rb