mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
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.
This commit is contained in:
parent
c4b2bd3781
commit
ff14b77ff5
2 changed files with 31 additions and 2 deletions
|
@ -198,6 +198,16 @@
|
||||||
(define (var tag . body)
|
(define (var tag . body)
|
||||||
(string-upcase (stexi->plain-text 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)
|
(define (passthrough tag . body)
|
||||||
(stexi->plain-text body))
|
(stexi->plain-text body))
|
||||||
|
|
||||||
|
@ -246,7 +256,8 @@
|
||||||
(url ,code)
|
(url ,code)
|
||||||
(dfn ,(make-surrounder "\""))
|
(dfn ,(make-surrounder "\""))
|
||||||
(cite ,(make-surrounder "\""))
|
(cite ,(make-surrounder "\""))
|
||||||
(acro ,passthrough)
|
(acro ,acronym) ;XXX: useless?
|
||||||
|
(acronym ,acronym)
|
||||||
(email ,key)
|
(email ,key)
|
||||||
(emph ,(make-surrounder "_"))
|
(emph ,(make-surrounder "_"))
|
||||||
(sc ,var)
|
(sc ,var)
|
||||||
|
|
|
@ -31,4 +31,22 @@
|
||||||
"This is another sentence.\nThat too.\n\n"
|
"This is another sentence.\nThat too.\n\n"
|
||||||
(with-fluids ((*line-width* 26))
|
(with-fluids ((*line-width* 26))
|
||||||
(stexi->plain-text
|
(stexi->plain-text
|
||||||
'(*fragment* (para "This is another sentence. That too."))))))
|
'(*fragment* (para "This is another sentence. That too.")))))
|
||||||
|
|
||||||
|
(pass-if-equal "acronym"
|
||||||
|
"What's GNU (GNU's Not Unix)?\n\n"
|
||||||
|
(stexi->plain-text
|
||||||
|
'(*fragment* (para "What's "
|
||||||
|
(acronym (% (acronym "GNU")
|
||||||
|
(meaning "GNU's Not Unix")))
|
||||||
|
"?"))))
|
||||||
|
|
||||||
|
(pass-if-equal "recursive acronym"
|
||||||
|
"What's GNU (GNU's Not Unix)?\n\n"
|
||||||
|
(stexi->plain-text
|
||||||
|
'(*fragment* (para "What's "
|
||||||
|
(acronym (% (acronym "GNU")
|
||||||
|
(meaning (acronym
|
||||||
|
(% (acronym "GNU")))
|
||||||
|
"'s Not Unix")))
|
||||||
|
"?")))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue