Sha256: a15b7604956833cd3bf6376df9bc2d5baabaf3ff7b09c6206afbc98a2b913372

Contents?: true

Size: 777 Bytes

Versions: 7

Compression:

Stored size: 777 Bytes

Contents

require 'rabbit/parser/ext/anthy'

module Rabbit
  module Parser
    class RD
      module Ext
        module Anthy
          include Element
          include GetText

          def anthy_hiragana_to_kanji(label, source, content, visitor)
            unless Parser::Ext::Anthy.available?
              visitor.logger.warn(_("Anthy isn't available"))
              return nil
            end
            src, prop = parse_source(source)

            converted_src = Parser::Ext::Anthy.hiragana_to_kanji(src)
            tree = ::RD::RDTree.new("=begin\n#{converted_src}\n=end\n")
            elems = tree.root.children.collect do |child|
              child.accept(visitor)
            end
            Container.new(elems)
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rabbit-0.9.3 lib/rabbit/parser/rd/ext/anthy.rb
rabbit-0.9.2 lib/rabbit/parser/rd/ext/anthy.rb
rabbit-0.9.1 lib/rabbit/parser/rd/ext/anthy.rb
rabbit-0.9.0 lib/rabbit/parser/rd/ext/anthy.rb
rabbit-0.6.4 lib/rabbit/parser/rd/ext/anthy.rb
rabbit-0.6.3 lib/rabbit/parser/rd/ext/anthy.rb
rabbit-0.6.2 lib/rabbit/parser/rd/ext/anthy.rb