Skip to content

Commit 1096e63

Browse files
committed
docs: generate translated .so manpage stubs from the English original
A .so alias stub is a redirect page with no prose; its body is just a path to the page it aliases, identical in every language. asciidoctor emits these stubs as a byproduct when it renders a translated primary page whose NAME line lists several functions, deriving the path from the translated NAME line. A stray space in the translation ("name , other" instead of "name, other") then lands in the path, producing a broken alias that aborts the htmldocs build via lang_switcher_postprocess.py. Stop deriving the alias from translated text: once the translated primaries are built, overwrite every translated .so stub with the canonical English one. This fixes the roff page too (not just the HTML symlink), and removes the only path by which a translation can break the build. The stub list is discovered at recipe time because the wildcard-based MAN_SRCS is empty on a clean build.
1 parent 77e9f58 commit 1096e63

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

docs/src/Submakefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ docclean:
13211321
-rm -f $(DOC_DIR)/.translateddocs-stamp
13221322
-rm -f $(DOC_DIR)/.gen_complist-stamp
13231323
-rm -f $(DOC_DIR)/.checkref-*-stamp
1324+
-rm -f $(DOC_DIR)/.manso-canonical-stamp
13241325
-rm -f $(OTHER_DOTFILES:.dot=.svg)
13251326

13261327

@@ -1421,6 +1422,27 @@ TRANSLATED_MAN_HTML_TARGETS := $(foreach L,$(LANGUAGES),$(MAN_HTML_TARGETS_$(cal
14211422
TRANSLATED_GENERATED_MANPAGES := $(foreach L,$(LANGUAGES), \
14221423
$(patsubst $(DOC_OUT_ADOC)/$(L)/man/%.adoc, $(DOC_MAN)/$(L)/%, \
14231424
$(wildcard $(DOC_OUT_ADOC)/$(L)/man/man?/*.adoc)))
1425+
1426+
# A .so alias stub is a language-invariant redirect (just a path). asciidoctor
1427+
# derives it from the translated NAME line, so a stray space in a translation
1428+
# can break the alias and abort the build. Overwrite every translated stub
1429+
# with the canonical English one, after the translated primaries that emit them
1430+
# are built. Stubs are found at recipe time: wildcard MAN_SRCS is empty on a
1431+
# clean build.
1432+
$(DOC_DIR)/.manso-canonical-stamp: $(GENERATED_MANPAGES) $(TRANSLATED_GENERATED_MANPAGES)
1433+
$(Q)set -e; \
1434+
for S in $$(cd $(DOC_MAN) && grep -rl '^\.so ' man1 man3 man9 2>/dev/null); do \
1435+
for L in $(LANGUAGES); do \
1436+
mkdir -p "$(DOC_MAN)/$$L/$$(dirname "$$S")"; \
1437+
cp -f "$(DOC_MAN)/$$S" "$(DOC_MAN)/$$L/$$S"; \
1438+
done; \
1439+
done
1440+
@touch $@
1441+
1442+
# Translated manpage HTML must see the canonical stubs, so order it after the
1443+
# fixup (order-only: the stub troff is already a normal prerequisite).
1444+
$(TRANSLATED_MAN_HTML_TARGETS): | $(DOC_DIR)/.manso-canonical-stamp
1445+
14241446
docs: $(TRANSLATED_MAN_HTML_TARGETS)
14251447
.SECONDARY: $(TRANSLATED_MAN_HTML_TARGETS) $(TRANSLATED_GENERATED_MANPAGES)
14261448
endif

0 commit comments

Comments
 (0)