~ruther/guix-local

36c9996b75ee2163a5081d4b10530f9388d420da — Ricardo Wurmus 1 year, 18 days ago d5d3cb2
import/utils: Escape @ in synopses.

* tests/import-utils.scm ("beautify-synopsis: escape @"): Add tests.
* guix/import/utils.scm (beautify-synopsis): Replace @ with @@.

Change-Id: I011d61687a098b5b50f44c1acd6f0a4eea06e9f0
2 files changed, 15 insertions(+), 3 deletions(-)

M guix/import/utils.scm
M tests/import-utils.scm
M guix/import/utils.scm => guix/import/utils.scm +6 -2
@@ 2,7 2,7 @@
;;; Copyright © 2012, 2013, 2018, 2019, 2020, 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2017, 2019, 2020, 2022, 2023, 2024 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017, 2019, 2020, 2022, 2023, 2024, 2025 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
;;; Copyright © 2020 Helio Machado <0x2b3bfa0+guix@googlemail.com>


@@ 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

M tests/import-utils.scm => tests/import-utils.scm +9 -1
@@ 1,5 1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2017, 2022, 2023, 2024 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015, 2017, 2022, 2023, 2024, 2025 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>


@@ 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))