(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))
(url ,code)
(dfn ,(make-surrounder "\""))
(cite ,(make-surrounder "\""))
- (acro ,passthrough)
+ (acro ,acronym) ;XXX: useless?
+ (acronym ,acronym)
(email ,key)
(emph ,(make-surrounder "_"))
(sc ,var)
"This is another sentence.\nThat too.\n\n"
(with-fluids ((*line-width* 26))
(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")))
+ "?")))))