Class: Metanorma::Standoc::ToCInlineMacro
- Inherits:
-
Asciidoctor::Extensions::InlineMacroProcessor
- Object
- Asciidoctor::Extensions::InlineMacroProcessor
- Metanorma::Standoc::ToCInlineMacro
- Defined in:
- lib/metanorma/standoc/macros_link.rb
Instance Method Summary collapse
Instance Method Details
#process(parent, _target, attrs) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/metanorma/standoc/macros_link.rb', line 52 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 |