Class: Metanorma::Standoc::HTML5RubyMacro

Inherits:
Asciidoctor::Extensions::InlineMacroProcessor
  • Object
show all
Defined in:
lib/metanorma/standoc/macros_inline.rb

Instance Method Summary collapse

Instance Method Details

#process(_parent, target, attributes) ⇒ Object

for example, html5ruby:楽聖少女



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/metanorma/standoc/macros_inline.rb', line 58

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