[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#55242] [PATCH 05/10] guix: import: go: Harden sxml->texi conversion
From: |
Attila Lendvai |
Subject: |
[bug#55242] [PATCH 05/10] guix: import: go: Harden sxml->texi conversion. |
Date: |
Tue, 3 May 2022 13:42:56 +0200 |
* guix/import/go.scm (sxml->texi): Escape @ as @@, and only emit the text part
of URLs if they are plain strings.
---
guix/import/go.scm | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/guix/import/go.scm b/guix/import/go.scm
index a115c61adc..6b0fbaa8b6 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -172,13 +172,26 @@ (define (sxml->texi sxml-node)
"A very basic SXML to Texinfo converter which attempts to preserve HTML
formatting and links as text."
(sxml-match sxml-node
- ((strong ,text)
- (format #f "@strong{~a}" text))
- ((a (@ (href ,url)) ,text)
- (format #f "@url{~a,~a}" url text))
- ((code ,text)
- (format #f "@code{~a}" text))
- (,something-else something-else)))
+ ((strong ,text)
+ (format #f "@strong{~a}" text))
+ ((a (@ (href ,url)) ,body)
+ ;; Examples: image in the url: github.com/go-openapi/jsonpointer
+ ;; (code ...) in the URL body: github.com/mwitkow/go-conntrack
+ (if (string? body)
+ (format #f "@url{~a,~a}" url body)
+ (sxml-match body
+ ((code ,text)
+ (format #f "@url{~a,~a}" url (sxml->texi body)))
+ (,_
+ (format #f "@url{~a}" url)))))
+ ((code ,text)
+ (format #f "@code{~a}" text))
+ (,something-else
+ ;; Example: @ in the description: github.com/ethersphere/langos
+ (if (string? something-else)
+ (string-replace-substring something-else
+ "@" "@@")
+ something-else))))
(define (go-package-description name)
"Retrieve a short description for NAME, a Go package name,
--
2.35.1
- [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags., (continued)
- [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags., Maxime Devos, 2022/05/03
- [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags., Maxime Devos, 2022/05/03
- [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags., Maxime Devos, 2022/05/03
- [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags., Maxime Devos, 2022/05/03
- [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags., Maxime Devos, 2022/05/03
- [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags., Maxime Devos, 2022/05/03
- [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags., Maxime Devos, 2022/05/03
[bug#55242] [PATCH 05/10] guix: import: go: Harden sxml->texi conversion.,
Attila Lendvai <=
[bug#55242] [PATCH 02/10] guix: import: go: Rename go.pkg.dev-info to pkg.go.dev-info., Maxime Devos, 2022/05/03
[bug#55242] [PATCH 01/10] guix: import: Print the number of packages at the end., Maxime Devos, 2022/05/03
[bug#55242] [PATCH 01/10] guix: import: Print the number of packages at the end., Maxime Devos, 2022/05/03
[bug#55242] [PATCH 01/10] guix: import: Print the number of packages at the end., Maxime Devos, 2022/05/14
[bug#55242] [PATCH 01/10] guix: import: Print the number of packages at the end., Maxime Devos, 2022/05/14