summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/import/utils.scm8
-rw-r--r--tests/import-utils.scm10
2 files changed, 15 insertions, 3 deletions
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 6f5efa790e..646482eb4a 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -2,7 +2,7 @@
;;; Copyright © 2012, 2013, 2018, 2019, 2020, 2023 Ludovic Courtès <[email protected]>
;;; Copyright © 2016 Jelle Licht <[email protected]>
;;; Copyright © 2016 David Craven <[email protected]>
-;;; Copyright © 2017, 2019, 2020, 2022, 2023, 2024 Ricardo Wurmus <[email protected]>
+;;; Copyright © 2017, 2019, 2020, 2022, 2023, 2024, 2025 Ricardo Wurmus <[email protected]>
;;; Copyright © 2018 Oleg Pykhalov <[email protected]>
;;; Copyright © 2019 Robert Vollmert <[email protected]>
;;; Copyright © 2020 Helio Machado <[email protected]>
@@ -422,7 +422,11 @@ LENGTH characters."
(substring synopsis 0
(1- (string-length synopsis))))
(else synopsis))))
- (string-trim-both cleaned)))
+ ;; Escape single @ to prevent it from being understood as invalid Texinfo
+ ;; syntax.
+ (regexp-substitute/global #f "@"
+ (string-trim-both cleaned)
+ 'pre "@@" 'post)))
(define* (package-names->package-inputs names #:optional (output #f))
"Given a list of PACKAGE-NAMES or (PACKAGE-NAME VERSION) pairs, and an
diff --git a/tests/import-utils.scm b/tests/import-utils.scm
index 607349203c..4183903cd1 100644
--- a/tests/import-utils.scm
+++ b/tests/import-utils.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2017, 2022, 2023, 2024 Ricardo Wurmus <[email protected]>
+;;; Copyright © 2015, 2017, 2022, 2023, 2024, 2025 Ricardo Wurmus <[email protected]>
;;; Copyright © 2016 Ben Woodcroft <[email protected]>
;;; Copyright © 2020 Martin Becze <[email protected]>
;;; Copyright © 2021 Sarah Morgensen <[email protected]>
@@ -69,6 +69,14 @@ Differences are hard to spot, e.g. in CLOS vs. GOOPS."))
"The main functions are: @code{haplo.em()} and @code{haplo.power()}; FYI."
(beautify-description "The main functions are: haplo.em() and haplo.power(); FYI."))
+(test-equal "beautify-synopsis: escape @"
+ "This is invalid @@syntax"
+ (beautify-synopsis "This is invalid @syntax"))
+
+(test-equal "beautify-synopsis: escape @"
+ "Just an @@ in the middle"
+ (beautify-synopsis "Just an @ in the middle"))
+
(test-equal "license->symbol"
'license:lgpl2.0
(license->symbol license:lgpl2.0))