From 8270e33c0a820ccb14c1cc6b97460db0a5748f0a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 13 Oct 2023 23:58:15 -0700 Subject: Handle French accents in Gawk man page. - There are instances of backspace overstriking intended to produce accented letters. Examples of this occur in the grep man page. The less pager doesn't handle these! We now do though, ha! - I dare not guess at the overstriking combination that produces an italic accented letter, or bold+italic+accented. Also, I don't know of man pages that produce circumflex accents. "Will fix it when I see it." --- mnpgr.tl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/mnpgr.tl b/mnpgr.tl index 8aaa6ab..1d9d0ec 100755 --- a/mnpgr.tl +++ b/mnpgr.tl @@ -34,6 +34,22 @@ "map b \002\r" "map \006"))) +(defun grave-accent (x) + (casequal x + ("a" "à") + ("e" "è") + ("u" "ù") + ("A" "À") + ("E" "È") + ("U" "Ù") + (t x))) + +(defun acute-accent (x) + (casequal x + ("e" "é") + ("E" "É") + (t x))) + (defun make-overstrike-filter (put-string-fn) (let ((cur-mode :norm) (closer "")) @@ -50,16 +66,20 @@ (:norm (set closer "")))) [put-string-fn str])) (lambda (line) - (each ((tok (tok #/.\b.(\b.)?/ t line))) + (each ((tok (tok #/.\b.(\b.)?(\b.)?/ t line))) (match-case tok ("") (`@{x #/ +/}` (output-text x cur-mode)) + (`@{x #/[eE]/}\b@x\b´\b´` (output-text (acute-accent x) :bold)) + (`@{x #/[aAeEuU]/}\b@x\b\`\b\`` (output-text (grave-accent x) :bold)) (`_\b@x\b@x` (output-text x :bital)) (`_\b_` (output-text "_" (if (meq cur-mode :bital :ital) :ital :bold))) (`_\b@x` (output-text x :ital)) + (`@{x #/[eE]/}\b´` (output-text (acute-accent x) cur-mode)) + (`@{x #/[aAeEuU]/}\b\`` (output-text (grave-accent x) cur-mode)) (`@x\b@x` (output-text x :bold)) (@else (output-text else :norm)))) (output-text "\n" :norm))))) -- cgit v1.2.3