Class: Asciidoctor::Html::TextInlineMacro

Inherits:
Extensions::InlineMacroProcessor
  • Object
show all
Defined in:
lib/asciidoctor/html/text_inline_macro.rb

Overview

Format text according to Bootstrap-compatible inline text elements

Instance Method Summary collapse

Instance Method Details

#process(parent, target, attrs) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/asciidoctor/html/text_inline_macro.rb', line 14

def process(parent, target, attrs)
  text = parent.sub_macros attrs["text"]
  content = case target
            when "del"
              %(<del>#{text}</del>)
            when "strike"
              %(<s>#{text}</s>)
            when "ins"
              %(<ins>#{text}</ins>)
            when "underline"
              %(<u>#{text}</u>)
            when "small"
              %(<small>#{text}</small>)
            when "kbd"
              %(<kbd>#{text}</kbd>)
            when "abbr"
              title = %( title="#{attrs["title"]}" data-bs-toggle="tooltip") if attrs.include?("title")
              role = %( class="#{attrs["role"]}") if attrs.include?("role")
              %(<abbr#{title}#{role}>#{text}</abbr>)
            else
              %(<span class="text-#{target}">#{text}</span>)
            end
  create_inline_pass parent, content
end