Class: Asciidoctor::Standoc::ToCInlineMacro
- Inherits:
-
Extensions::InlineMacroProcessor
- Object
- Extensions::InlineMacroProcessor
- Asciidoctor::Standoc::ToCInlineMacro
- Defined in:
- lib/asciidoctor/standoc/macros.rb
Instance Method Summary collapse
Instance Method Details
#process(parent, _target, attrs) ⇒ Object
182 183 184 185 186 187 188 189 190 |
# File 'lib/asciidoctor/standoc/macros.rb', line 182 def process(parent, _target, attrs) out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert content = CSV.parse_line(out).map do |x| x.sub!(/^(["'])(.+)\1/, "\\2") m = /^(.*?)(:\d+)?$/.match(x) %{<toc-xpath depth='#{m[2]&.sub(/:/, '') || 1}'>#{m[1]}</toc-xpath>} end.join "<toc>#{content}</toc>" end |