mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
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'.
This commit is contained in:
parent
02c3c51e0c
commit
aa7edc9449
1 changed files with 10 additions and 8 deletions
18
doc/local.mk
18
doc/local.mk
|
@ -96,14 +96,16 @@ define xref_command
|
||||||
cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \
|
cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \
|
||||||
tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \
|
tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \
|
||||||
sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \
|
sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \
|
||||||
line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\
|
if [ -n "$$e" ]; then \
|
||||||
((line++)) ;\
|
line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\
|
||||||
if [ "$$line" != "1" ]; then \
|
((line++)) ;\
|
||||||
translation=$$(head -n $$line "$<" | tail -1 | grep msgstr | sed 's|msgstr "\(.*\)"|\1|') ;\
|
if [ "$$line" != "1" ]; then \
|
||||||
if [ "$$translation" != "" ]; then \
|
translation=$$(head -n "$$line" "$<" | tail -1 | grep msgstr | sed 's|msgstr "\(.*\)"|\1|') ;\
|
||||||
sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\
|
if [ "$$translation" != "" ]; then \
|
||||||
fi ;\
|
sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\
|
||||||
fi ;\
|
fi ;\
|
||||||
|
fi ;\
|
||||||
|
fi ;\
|
||||||
done
|
done
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue