Sha256: 1d36cabbec8ed6580e71628b091ae612d0e77ac190ebafc7ad223b53ca460112

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

require "hemingway/block/block_nodes"
require "hemingway/block/list/list"
require "hemingway/block/verbatim/verbatim"
require "hemingway/block/quote/quote"

module Hemingway
  grammar Block

    include List
    include Verbatim
    include Quote

    # Example:
    #   \begin{itemize}
    #   \item[Chewbacca] Wookie
    #   \item[Han] Smuggler
    #   \item[Anakin] Savant
    #   \end{itemize}
    rule block
      (
        block_start type:list_type "}" whitespace content:list whitespace block_end list_type "}" &{ |seq| seq[1].text_value == seq[7].text_value } /
        block_start type:verbatim_type "}" whitespace content:verbatim whitespace block_end verbatim_type "}" /
        block_start type:quote_type "}" whitespace content:quote_entry whitespace block_end quote_type "}"
      ) <BlockNode>
    end

    rule block_start
      "\\begin{"
    end

    rule block_end
      "\\end{"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hemingway-0.0.2 lib/hemingway/block/block.treetop