summaryrefslogtreecommitdiff
path: root/_extensions/js/multicol-nohead/multicol-nohead.lua
blob: 2b987982799f6bee6c846780f85457abf13e56a0 (plain)
  1. -- Render content below header in three columns
  2. local multicol_begin = pandoc.RawBlock('latex', [[
  3. \begin{multicols}{3}\raggedcolumns
  4. ]])
  5. local multicol_end = pandoc.RawBlock('latex', [[
  6. \end{multicols}
  7. ]])
  8. local multicol_now = false
  9. -- TODO: include header level 2 and author paragraph above multicolumn
  10. function is_author(elem)
  11. return elem.t == Para and elem.content[1].text == "Forfatter:"
  12. end
  13. function multicol_delimit(elem)
  14. if multicol_now == true then
  15. return {multicol_end, elem, multicol_begin}
  16. else
  17. multicol_now = true
  18. return {elem, multicol_begin}
  19. end
  20. end
  21. function Header(elem)
  22. if FORMAT:match 'latex' then
  23. if elem.level == 1 then
  24. return multicol_delimit(elem)
  25. end
  26. end
  27. end
  28. function HorizontalRule(elem)
  29. if FORMAT:match 'latex' then
  30. multicol_now = false
  31. return {multicol_end, elem}
  32. end
  33. end
  34. function Pandoc(doc)
  35. if FORMAT:match 'latex' then
  36. if multicol_now == true then
  37. doc.blocks:insert(multicol_end)
  38. return doc
  39. end
  40. end
  41. end