Class: Asciidoctor::Standoc::HTML5RubyMacro

Inherits:
Extensions::InlineMacroProcessor
  • Object
show all
Defined in:
lib/asciidoctor/standoc/macros.rb

Instance Method Summary collapse

Instance Method Details

#process(parent, target, attributes) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/asciidoctor/standoc/macros.rb', line 131

def process(parent, target, attributes)
  rpbegin = '('
  rpend = ')'
  if attributes.size == 1 and attributes.key?("text")
    rt = attributes["text"]
  elsif attributes.size == 2 and attributes.key?(1) and
    attributes.key?("rpbegin")
    # for example, html5ruby:楽聖少女[がくせいしょうじょ]
    rt = attributes[1] || ""
  else
    rpbegin = attributes['rpbegin']
    rt = attributes['rt']
    rpend = attributes['rpend']
  end

  "<ruby>#{target}<rp>#{rpbegin}</rp><rt>#{rt}</rt>"\
    "<rp>#{rpend}</rp></ruby>"
end