blob: c3f0e7ddbb2c21ebf83686b43ff3b65fcd420be6 (
plain)
- --- nobreaks - avoid linebreak between a number and a unit or quantifier
- ---
- --- SPDX-FileCopyrightText: 2025 Jonas Smedegaard <dr@jones.dk>
- --- SPDX-License-Identifier: GPL-3.0-or-later
- local non_breaking_space = pandoc.Str("\u{00A0}")
- function Para(el)
- for i = 1, #el.content - 1 do
- if el.content[i].t == "Space" then
- local el_prev = el.content[i - 1]
- local el_next = el.content[i + 1]
- if el_prev and el_next
- and el_prev.t == "Str" and el_next.t == "Str"
- and string.match(el_prev.text, "%d$")
- and string.match(el_next.text, "^[%a%%§°Ωμµ]")
- then
- el.content[i] = non_breaking_space
- end
- end
- end
- return el
- end
|