[PATCH] po: Do not auto-translate cross-references to other manuals.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Florian Pelz
Owner
unassigned
Submitted by
Florian Pelz
Severity
normal

Debbugs page

Florian Pelz wrote 2 years ago
(address . guix-patches@gnu.org)(name . Florian Pelz)(address . pelzflorian@pelzflorian.de)
20230402184401.14505-1-pelzflorian@pelzflorian.de
Reported by Gottfried at

* guix/build/po.scm (xref-regexp): Dispatch on the number of
arguments. Ensure there is no info-manual argument or it is empty.
(translate-cross-references): Adapt to changed regexp.
---
guix/build/po.scm | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

Toggle diff (51 lines)
diff --git a/guix/build/po.scm b/guix/build/po.scm
index 7f88164cd8..62362e933e 100644
--- a/guix/build/po.scm
+++ b/guix/build/po.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2023 Florian Pelz <pelzflorian@pelzflorian.de>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -123,7 +124,15 @@ (define (canonicalize-whitespace str)
(define xref-regexp
;; Texinfo cross-reference regexp.
- (make-regexp "@(px|x)?ref\\{([^,}]+)"))
+ (make-regexp
+ (string-append "@(px|x)?ref\\{([^,}]+)("
+ "\\}" ;Match xref with one argument
+ "|,[^,}]*\\}" ;or two arguments
+ "|,[^,}]*,[^,}]*\\}" ;or three arguments
+ ;; or with an *empty* fourth argument:
+ "|,[^,}]*,[^,}]*, *,"
+ "|,[^,}]*,[^,}]*, *\\}"
+ ")")))
(define (translate-cross-references texi pofile)
"Translate the cross-references that appear in @var{texi}, the initial
@@ -157,13 +166,15 @@ (define translated
(cons (string-drop content offset) result)))
((head . tail)
(let ((prefix (match:substring head 1))
- (ref (canonicalize-whitespace (match:substring head 2))))
+ (ref (canonicalize-whitespace (match:substring head 2)))
+ (rest (match:substring head 3)))
(define translated
(string-append "@" (or prefix "")
"ref{"
(match (vhash-assoc ref translation-map)
(#f ref)
- ((_ . str) str))))
+ ((_ . str) str))
+ (or rest "")))
(loop tail
(match:end head)

base-commit: 47ea688fd27d0ce0c8ea5481f1f94d0ebc3e37eb
--
2.39.2
Ludovic Courtès wrote 2 years ago
(name . Florian Pelz)(address . pelzflorian@pelzflorian.de)(address . 62625-done@debbugs.gnu.org)
87o7nzd9p2.fsf@gnu.org
Hi Florian,

Florian Pelz <pelzflorian@pelzflorian.de> skribis:

Toggle quote (7 lines)
> Reported by Gottfried at
> <https://lists.gnu.org/archive/html/help-guix/2023-04/msg00000.html>.
>
> * guix/build/po.scm (xref-regexp): Dispatch on the number of
> arguments. Ensure there is no info-manual argument or it is empty.
> (translate-cross-references): Adapt to changed regexp.

Applied, thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 62625@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 62625
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help