summaryrefslogtreecommitdiff
path: root/doc/local.mk
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-10-26 23:19:26 +0100
committerLudovic Courtès <ludo@gnu.org>2020-10-27 00:40:24 +0100
commitaa7edc9449a7cf796892f5a0369295a95ddbbcf8 (patch)
tree0a7d7a35bb088b3d24b2abf1bb73652b4519a495 /doc/local.mk
parent02c3c51e0c46ea70de8e973993586c943acc1714 (diff)
doc: Fix xref translation macro.
* doc/local.mk (xref_command): Wrap loop body in 'if [ -n "$$e" ]'. This avoids shell syntax errors when producing doc/guix-cookbook.de.texi, which for some reason gets an empty 'e' at one point. Quote the first argument to 'head'.
Diffstat (limited to 'doc/local.mk')
-rw-r--r--doc/local.mk18
1 files changed, 10 insertions, 8 deletions
diff --git a/doc/local.mk b/doc/local.mk
index aca1958edd4..97122c737d8 100644
--- a/doc/local.mk
+++ b/doc/local.mk
@@ -96,14 +96,16 @@ define xref_command
96cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \ 96cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \
97 tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \ 97 tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \
98 sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \ 98 sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \
99 line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\ 99 if [ -n "$$e" ]; then \
100 ((line++)) ;\ 100 line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\
101 if [ "$$line" != "1" ]; then \ 101 ((line++)) ;\
102 translation=$$(head -n $$line "$<" | tail -1 | grep msgstr | sed 's|msgstr "\(.*\)"|\1|') ;\ 102 if [ "$$line" != "1" ]; then \
103 if [ "$$translation" != "" ]; then \ 103 translation=$$(head -n "$$line" "$<" | tail -1 | grep msgstr | sed 's|msgstr "\(.*\)"|\1|') ;\
104 sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\ 104 if [ "$$translation" != "" ]; then \
105 fi ;\ 105 sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\
106 fi ;\ 106 fi ;\
107 fi ;\
108 fi ;\
107done 109done
108endef 110endef
109 111