aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-10-13 23:58:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-10-13 23:58:15 -0700
commit8270e33c0a820ccb14c1cc6b97460db0a5748f0a (patch)
tree1b3d62921e3c3b3a66387f43d4a9180fead31c61
parent0ae6a9ae81217e80fa0150432dfaf5d007c4de42 (diff)
downloadmnpgr-8270e33c0a820ccb14c1cc6b97460db0a5748f0a.tar.gz
mnpgr-8270e33c0a820ccb14c1cc6b97460db0a5748f0a.tar.bz2
mnpgr-8270e33c0a820ccb14c1cc6b97460db0a5748f0a.zip
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."
-rwxr-xr-xmnpgr.tl22
1 files changed, 21 insertions, 1 deletions
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 <space> \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)))))