summaryrefslogtreecommitdiff
path: root/module/texinfo
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-01-29 15:16:38 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-29 15:19:37 +0100
commitff14b77ff527f297438b83614db0c1d56322ec42 (patch)
treed174daaae9f9277e34c9093f1b316b36ef24c43b /module/texinfo
parentc4b2bd378136ed0177a88642220ea85eef034ced (diff)
downloadguile-ff14b77ff527f297438b83614db0c1d56322ec42.tar.gz
texinfo: Properly render @acronym in plain text.
Fixes <https://bugs.gnu.org/37846>. Reported by Christopher Baines <mail@cbaines.net>. * module/texinfo/plain-text.scm (acronym): New procedure. (tag-handlers): Change 'acro' handle to ACRONYM, and add 'acronym' handler. * test-suite/tests/texinfo.plain-text.test ("stexi->plain-text") ["acronym", "recursive acronym"]: New tests.
Diffstat (limited to 'module/texinfo')
-rw-r--r--module/texinfo/plain-text.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/module/texinfo/plain-text.scm b/module/texinfo/plain-text.scm
index 6b7885ada..5ea99c86b 100644
--- a/module/texinfo/plain-text.scm
+++ b/module/texinfo/plain-text.scm
@@ -198,6 +198,16 @@
(define (var tag . body)
(string-upcase (stexi->plain-text body)))
+(define (acronym tag . elts)
+ (match elts
+ ((('% ('acronym text)))
+ (stexi->plain-text text))
+ ((('% ('acronym text) ('meaning . body)))
+ (string-append (stexi->plain-text text)
+ " ("
+ (string-concatenate (map stexi->plain-text body))
+ ")"))))
+
(define (passthrough tag . body)
(stexi->plain-text body))
@@ -246,7 +256,8 @@
(url ,code)
(dfn ,(make-surrounder "\""))
(cite ,(make-surrounder "\""))
- (acro ,passthrough)
+ (acro ,acronym) ;XXX: useless?
+ (acronym ,acronym)
(email ,key)
(emph ,(make-surrounder "_"))
(sc ,var)