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

for example, html5ruby:楽聖少女



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/asciidoctor/standoc/macros.rb', line 106

def process(_parent, target, attributes)
  rpbegin = "("
  rpend = ")"
  if (attributes.size == 1) && attributes.key?("text")
    rt = attributes["text"]
  elsif (attributes.size == 2) && attributes.key?(1) &&
      attributes.key?("rpbegin")
    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