Class: Kramdown::Parser::RFC2629Kramdown

Inherits:
Kramdown show all
Defined in:
lib/kramdown-rfc2629.rb

Constant Summary collapse

XREF_START =
/\{\{(.*?)\}\}/u

Instance Method Summary collapse

Constructor Details

#initialize(*doc) ⇒ RFC2629Kramdown

Returns a new instance of RFC2629Kramdown.



32
33
34
35
# File 'lib/kramdown-rfc2629.rb', line 32

def initialize(*doc)
  super
  @span_parsers.unshift(:xref)
end

Instance Method Details

#parse_xrefObject

Introduce new {target} syntax for empty xrefs, which would otherwise be an ugly ![!](target) or ![ ](target) (I’d rather use [[target]], but that somehow clashes with links.)



42
43
44
45
46
47
# File 'lib/kramdown-rfc2629.rb', line 42

def parse_xref
  @src.pos += @src.matched_size
  href = @src[1]
  el = Element.new(:xref, nil, {'target' => href})
  @tree.children << el
end