class HTML5RubyMacro

Public Instance Methods

process(parent, target, attributes) click to toggle source
# File lib/asciidoctor-html5ruby/extension.rb, line 9
def process parent, target, attributes
  if attributes.size == 2 and attributes.key?(1) and attributes.key?("rpbegin")
    # for example, html5ruby:楽聖少女[がくせいしょうじょ]
    rt = attributes[1]
    rt ||= ""
    rpbegin = '('
    rpend = ')'
  else
    rpbegin = attributes['rpbegin']
    rt = attributes['rt']
    rpend = attributes['rpend']
  end

  %(<ruby>#{target}<rp>#{rpbegin}</rp><rt>#{rt}</rt><rp>#{rpend}</rp></ruby>)
end