From e11b48dc6a27517cca5ccf5b11838b3eefda2335 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 06 Aug 2024 21:02:03 +0300 Subject: [PATCH] Emit \(ti and \(ha instead of ~ and ^ Groff since 1.23 maps '^' and '~' by default to U+02C6 and U+02DC respectively. The suggestion in groff_man_style(7) is to use \(ti and \(ha when the latin variants are desired. Links: https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00001.html --- src/main.c | 8 ++++++++ test/character-substitute | 18 ++++++++++++++++++ diff --git a/src/main.c b/src/main.c index a49cb401769df9e694fb547fa8a7d939b13ed818..45910987e6c0a7eb48e28a2e09c75e729f0954d9 100644 --- a/src/main.c +++ b/src/main.c @@ -261,6 +261,14 @@ utf8_fputch(p->output, ch); // Suppress sentence spacing fprintf(p->output, "\\&"); break; + case '~': + // Escape ~ to not render it with U+02DC + fprintf(p->output, "\\(ti"); + break; + case '^': + // Escape ^ to not render it with U+02C6 + fprintf(p->output, "\\(ha"); + break; default: last = ch; utf8_fputch(p->output, ch); diff --git a/test/character-substitute b/test/character-substitute new file mode 100755 index 0000000000000000000000000000000000000000..6fe5589165620a9bdbbd6fcc9cb1056aed5c0b54 --- /dev/null +++ b/test/character-substitute @@ -0,0 +1,18 @@ +#!/bin/sh +. test/lib.sh + +begin "Substitute ~ with \(ti" +scdoc </dev/null +test(8) + +_hello~_ +EOF +end 0 + +begin "Substitute ^ with \(ha" +scdoc </dev/null +test(8) + +_hello^_ +EOF +end 0 -- 2.48.1