Sha256: 715eaf323b34e294e1421ca50a3a1d63b5318ef0ab5774e0c679678539c01313

Contents?: true

Size: 945 Bytes

Versions: 16

Compression:

Stored size: 945 Bytes

Contents

require 'rabbit/element'
require 'rabbit/parser/ext/entity'

module Rabbit
  module Parser
    class RD
      module Ext
        module Entity
          include Element

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

          TABLE = Parser::Ext::Entity::TABLE
          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
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rabbit-1.0.8 lib/rabbit/parser/rd/ext/entity.rb
rabbit-1.0.7 lib/rabbit/parser/rd/ext/entity.rb
rabbit-1.0.6 lib/rabbit/parser/rd/ext/entity.rb
rabbit-1.0.5 lib/rabbit/parser/rd/ext/entity.rb
rabbit-1.0.4 lib/rabbit/parser/rd/ext/entity.rb
rabbit-1.0.3 lib/rabbit/parser/rd/ext/entity.rb
rabbit-1.0.2 lib/rabbit/parser/rd/ext/entity.rb
rabbit-1.0.1 lib/rabbit/parser/rd/ext/entity.rb
rabbit-1.0.0 lib/rabbit/parser/rd/ext/entity.rb
rabbit-0.9.3 lib/rabbit/parser/rd/ext/entity.rb
rabbit-0.9.2 lib/rabbit/parser/rd/ext/entity.rb
rabbit-0.9.1 lib/rabbit/parser/rd/ext/entity.rb
rabbit-0.9.0 lib/rabbit/parser/rd/ext/entity.rb
rabbit-0.6.4 lib/rabbit/parser/rd/ext/entity.rb
rabbit-0.6.3 lib/rabbit/parser/rd/ext/entity.rb
rabbit-0.6.2 lib/rabbit/parser/rd/ext/entity.rb