class Luce::DelimiterSyntax
- Luce::DelimiterSyntax
- Luce::InlineSyntax
- Reference
- Object
Overview
Matches syntax that has a pair of tags and becomes an element, like
*
for <em>
.
Allows nested tags.
Direct Known Subclasses
Defined in:
luce/inline_syntaxes/delimiter_syntax.crConstructors
-
.new(pattern : String, requires_delimiter_run : Bool = false, start_character : Int32 | Nil = nil, allow_intra_word : Bool = false, tags : Array(DelimiterTag) | Nil = nil)
Create a new
DelimiterSyntax
which matches on pattern.
Instance Method Summary
-
#allow_intra_word? : Bool
Whether to allow intra-word delimiter runs.
-
#close(parser : InlineParser, opener : Delimiter, closer : Delimiter, get_children : Proc(Array(Node)), tag : String) : Node | Nil
Attemps to close this tag at the current position.
-
#on_match(parser : InlineParser, match : Regex::MatchData) : Bool
Processes match, adding nodes to parser and possibly advancing parser.
-
#requires_delimiter_run? : Bool
Whether this is parsed according to the same nesting rules as emphasis delimiters.
- #tags : Array(DelimiterTag) | Nil
Instance methods inherited from class Luce::InlineSyntax
matches?(parser : InlineParser, start_match_pos : Int32 | Nil = nil) : Bool
matches?,
on_match(parser : InlineParser, match : Regex::MatchData) : Bool
on_match,
pattern : Regex
pattern
Constructor methods inherited from class Luce::InlineSyntax
new(pattern : String, start_character : Int32 | Nil = nil, case_sensitive : Bool = true)
new
Constructor Detail
Create a new DelimiterSyntax
which matches on pattern.
The pattern is used to find the matching text. If requires_delimiter_run is passed, this syntax parses according to the same nesting rules as emphasis delimiters. If start_character is passed, it is used as a pre-matching check which is faster than matching against pattern.
Instance Method Detail
Whether to allow intra-word delimiter runs.
CommonMark emphasis and strong emphasis does not allow this, but GitHub-flavoured Markdown allows it on strikethrough.
Attemps to close this tag at the current position.
If a tag cannot be closed at the current position (for example,
if a link reference cannot be found for a link tag's label), then
nil
is returned..
If a tag can be closed at the current position, then this method
calls get_children, in which parser parses any nested text
into child nodes. The returned Node
incorporates these child
nodes.
Processes match, adding nodes to parser and possibly advancing parser.
Will return whether the caller should advance parser by
match[0].size
.
Whether this is parsed according to the same nesting rules as emphasis delimiters.