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
222 223 224 225 226 227 228 229 230 |
# File 'lib/asciidoctor/standoc/macros.rb', line 222 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 |