mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
import/utils: Wrap terms starting with @ in descriptions.
* tests/import-utils.scm ("beautify-description: escape @stuff"): Add test.
* guix/import/utils.scm (beautify-description): Also wrap terms in @code{...}
that start with an escaped @.
Change-Id: I424f626635b821af6f4c16c97b8724cdaf99de45
This commit is contained in:
@@ -342,12 +342,12 @@ LENGTH characters."
|
|||||||
;; Escape single @ to prevent it from being understood as
|
;; Escape single @ to prevent it from being understood as
|
||||||
;; invalid Texinfo syntax.
|
;; invalid Texinfo syntax.
|
||||||
(cut regexp-substitute/global #f "@" <> 'pre "@@" 'post)
|
(cut regexp-substitute/global #f "@" <> 'pre "@@" 'post)
|
||||||
;; Wrap camelCase or PascalCase words or text followed
|
;; Wrap camelCase, PascalCase words, text followed
|
||||||
;; immediately by "()" in @code{...}.
|
;; immediately by "()", or text starting with "@@" in @code{...}.
|
||||||
(lambda (word)
|
(lambda (word)
|
||||||
(let ((pattern
|
(let ((pattern
|
||||||
(make-regexp
|
(make-regexp
|
||||||
"([A-Z][a-z]+[A-Z]|[a-z]+[A-Z]|.+\\(\\))")))
|
"((@@)?[A-Z][a-z]+[A-Z]|(@@)?[a-z]+[A-Z]|(@@)?.+\\(\\))")))
|
||||||
(match (list-matches pattern word)
|
(match (list-matches pattern word)
|
||||||
(() word)
|
(() word)
|
||||||
((m . rest)
|
((m . rest)
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ Differences are hard to spot, e.g. in CLOS vs. GOOPS."))
|
|||||||
"This @@ is not Texinfo syntax. Neither is this %@@>%."
|
"This @@ is not Texinfo syntax. Neither is this %@@>%."
|
||||||
(beautify-description "This @ is not Texinfo syntax. Neither is this %@>%."))
|
(beautify-description "This @ is not Texinfo syntax. Neither is this %@>%."))
|
||||||
|
|
||||||
|
(test-equal "beautify-description: escape @stuff"
|
||||||
|
"This is not valid syntax: @code{@@importFrom} oh dear."
|
||||||
|
(beautify-description "This is not valid syntax: @importFrom oh dear."))
|
||||||
|
|
||||||
(test-equal "beautify-description: wrap PascalCase words in @code"
|
(test-equal "beautify-description: wrap PascalCase words in @code"
|
||||||
"The term @code{DelayedMatrix} refers to a class."
|
"The term @code{DelayedMatrix} refers to a class."
|
||||||
(beautify-description "The term DelayedMatrix refers to a class."))
|
(beautify-description "The term DelayedMatrix refers to a class."))
|
||||||
|
|||||||
Reference in New Issue
Block a user