class Asciidoctor::Legal::InlineMacro

Public Instance Methods

process(parent, target, attrs) click to toggle source
# File lib/asciidoctor-legal/legal.rb, line 12
def process(parent, target, attrs)
  counter_name = "legalparagraphcounter"
  counter_format = attrs['text'].empty? ? "%04d" : attrs['text']
  counter = counter_format%parent.document.counter(counter_name)
  parent.document.register(:ids, [target, "[#{counter}]"])
  %(<span id="#{target}"><b>[#{counter}]</b></span>)
end