Skip to content

Commit b6cbe00

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 853878b commit b6cbe00

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
@@ -1325,6 +1325,7 @@ docclean:
13251325
-rm -f $(DOC_DIR)/.translateddocs-stamp
13261326
-rm -f $(DOC_DIR)/.gen_complist-stamp
13271327
-rm -f $(DOC_DIR)/.checkref-*-stamp
1328+
-rm -f $(DOC_DIR)/.manso-canonical-stamp
13281329
-rm -f $(OTHER_DOTFILES:.dot=.svg)
13291330

13301331

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

0 commit comments

Comments
 (0)