main
 1-- callouts.lua — Transform org special blocks into styled callouts
 2
 3function transform_callout(cls, title_text)
 4  elements = HTML.select(page, "div." .. cls)
 5  j = 1
 6  while elements[j] do
 7    el = elements[j]
 8    HTML.set_attribute(el, "class", "callout callout-" .. cls)
 9    title_el = HTML.create_element("div", title_text)
10    HTML.set_attribute(title_el, "class", "callout-title")
11    HTML.prepend_child(el, title_el)
12    j = j + 1
13  end
14end
15
16transform_callout("note", "Note")
17transform_callout("tip", "Tip")
18transform_callout("info", "Info")
19transform_callout("warning", "Warning")
20transform_callout("danger", "Danger")
21transform_callout("design", "Design Note")