class Crst::SectionParser

Overview

Parses RST sections (titled divisions of a document)

Extracted from Parser to handle section detection, level tracking, and section content parsing.

Defined in:

crst/section_parser.cr

Constant Summary

TRANSITION_CHARS = Set.new(['!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~'])

Transition characters (RST spec)

Constructors

Instance Method Summary

Constructor Detail

def self.new(parser : Parser) #

[View source]

Instance Method Detail

def adornment?(line : String) : Bool #

Returns true when line is a flush-left section adornment: a non-empty line made of a single repeated transition character.


[View source]
def determine_level(adornment : String) : Int32 #

[View source]
def section_start?(reader : LineReader) : Bool #

[View source]
def try_parse_section(reader : LineReader, document : Document) : Bool #

Attempt to parse a section at the current reader position Returns true if a section was parsed, false otherwise


[View source]