summaryrefslogtreecommitdiff
path: root/_extensions/js/nobreaks/nobreaks.lua
blob: 48a8fb52bed78204758f8d2385e94901146c0411 (plain)
  1. -- Avoid linebreak before lone percentage sign
  2. function Para(el)
  3. for i = 1, #el.content - 1 do
  4. if el.content[i].t == "Space" then
  5. local el_next = el.content[i + 1]
  6. if el_next and el_next.t == "Str" and el_next.text == "%" then
  7. el.content[i] = pandoc.Str("\u{00A0}") -- Non-breaking space
  8. end
  9. end
  10. end
  11. return el
  12. end