class Asciidoctor::Standoc::HTML5RubyMacro

Public Instance Methods

process(_parent, target, attributes) click to toggle source

for example, html5ruby:楽聖少女

# File lib/asciidoctor/standoc/macros.rb, line 105
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