Module: Rabbit::Parser::RD::Ext::Entity

Includes:
Element
Included in:
InlineVerbatim
Defined in:
lib/rabbit/parser/rd/ext/entity.rb

Constant Summary collapse

TABLE =
Parser::Ext::Entity::TABLE

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



12
13
14
15
16
# File 'lib/rabbit/parser/rd/ext/entity.rb', line 12

def included(mod)
  self.instance_methods.each do |meth|
    mod.method_added(meth)
  end
end

Instance Method Details

#ext_inline_verb_entity_reference(label, source, content, visitor) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rabbit/parser/rd/ext/entity.rb', line 20

def ext_inline_verb_entity_reference(label, source, content, visitor)
  label = label.to_s
  return nil unless /^&([^;]+);(.*)$/ =~ label
  return nil unless TABLE.include?($1)

  key = $1
  rest = $2
  if rest.empty?
    Text.new(TABLE[key])
  else
    rest = visitor.apply_to_Verb(::RD::Verb.new(rest))
    TextContainer.new([Text.new(TABLE[key]), rest])
  end
end