diff --git a/docs/src/Submakefile b/docs/src/Submakefile index 911289bdd03..08e1706dc8f 100644 --- a/docs/src/Submakefile +++ b/docs/src/Submakefile @@ -743,7 +743,7 @@ $(foreach L,$(LANGUAGES), \ # from docs/build/man//manN. cssrel is ../../../ for both: each output # sits at docs/build/html//man/manN/X.html (4 levels under html/). define MAN_HTML_RULE -$(DOC_OUT_HTML)/$(1)/man/%.html: $(2)/% $(DOC_SRCDIR)/docinfo.html $(DOC_SRCDIR)/docinfo-header.html +$(DOC_OUT_HTML)/$(1)/man/%.html: $(2)/% $(DOC_SRCDIR)/docinfo.html $(DOC_SRCDIR)/docinfo-header.html | manpages @$$(ECHO) Formatting $$(notdir $$<) as HTML @mkdir -p $$(dir $$@) $$(Q)if grep -q '^\.so' $$<; then \ @@ -771,12 +771,14 @@ $(DOC_OUT_HTML)/$(1)/man/%.html: $(2)/% $(DOC_SRCDIR)/docinfo.html $(DOC_SRCDIR) -r $$(realpath $$(DOC_SRCDIR))/extensions/rouge_hal.rb \ -r $$(realpath $$(DOC_SRCDIR))/extensions/rouge_ngc.rb \ -r $$(realpath $$(DOC_SRCDIR))/extensions/rouge_ini.rb \ + -r $$(realpath $$(DOC_SRCDIR))/extensions/man_xref.rb \ --doctype=manpage \ --backend=html5 \ -a compat-mode \ -a mansource=LinuxCNC \ -a manmanual='LinuxCNC Documentation' \ -a "lcnc-cssrel=../../../" \ + -a "manxref-root=$$(realpath $(2))" \ -a "lcnc-lang-label=$(LANG_LABEL_$(1))" \ -a "lcnc-subpath=$$(patsubst $(DOC_OUT_HTML)/$(1)/%,%,$$@)" \ -a docinfo=shared \ @@ -1203,6 +1205,14 @@ $(DOC_OUT_ADOC)/%.html: LCNC_CSSREL=$(shell python3 -c "print('../' * '$*'.count # of the output depth. Add the +1 here, matching the $(DOC_SRCDIR) rule above. $(DOC_OUT_ADOC)/en/%.html: LCNC_CSSREL=$(shell python3 -c "print('../' * (1 + '$*'.count('/')))") +# man_xref linkbase: relative path from this html page to its language's +# man/man/ dirs. CSSREL points one level above the lang root (at the html +# root, where the css lives); the man tree sits inside the lang root, so this +# is CSSREL with one fewer "../" plus "man/". Translated stems include the +# lang dir; the English stem omits it, hence the extra step, mirroring CSSREL. +$(DOC_OUT_ADOC)/%.html: MANXREF_LINKBASE=$(shell python3 -c "print('../' * ('$*'.count('/') - 1) + 'man/')") +$(DOC_OUT_ADOC)/en/%.html: MANXREF_LINKBASE=$(shell python3 -c "print('../' * '$*'.count('/') + 'man/')") + # asciidoctor HTML rule used for every language. # $1 lang tag (en, de, ...) # $2 source root: $(DOC_SRCDIR) for English (DOC_SRCS_EN paths have no @@ -1214,13 +1224,16 @@ $(DOC_OUT_ADOC)/en/%.html: LCNC_CSSREL=$(shell python3 -c "print('../' * (1 + '$ define ASCIIDOCTOR_HTML_RULE # Order-only dep on .adoc-images-stamp so translated images are staged before # the resolver probes for them at render (it also falls back to docs/src). -$$(patsubst %.adoc,$2/%.html,$$(DOC_SRCS_$(call toUC,$1)_SMALL)): $2/%.html: $2/%.adoc $$(DOC_SRCDIR)/docinfo.html $$(DOC_SRCDIR)/docinfo-header.html | .adoc-images-stamp +$$(patsubst %.adoc,$2/%.html,$$(DOC_SRCS_$(call toUC,$1)_SMALL)): $2/%.html: $2/%.adoc $$(DOC_SRCDIR)/docinfo.html $$(DOC_SRCDIR)/docinfo-header.html | .adoc-images-stamp manpages $$(ECHO) "Building '$1' adoc to html: " $$< $$(Q)asciidoctor -r $$(realpath $$(DOC_SRCDIR))/extensions/xref_resolver.rb \ -r $$(realpath $$(DOC_SRCDIR))/extensions/image_resolver.rb \ -r $$(realpath $$(DOC_SRCDIR))/extensions/rouge_hal.rb \ -r $$(realpath $$(DOC_SRCDIR))/extensions/rouge_ngc.rb \ -r $$(realpath $$(DOC_SRCDIR))/extensions/rouge_ini.rb \ + -r $$(realpath $$(DOC_SRCDIR))/extensions/man_xref.rb \ + -a "manxref-root=$$(realpath $$(if $$(filter en,$1),$$(DOC_MAN),$$(DOC_MAN)/$1))" \ + -a "manxref-linkbase=$$(MANXREF_LINKBASE)" \ -a compat-mode \ -a "doc-languages=$$(LANGUAGES)" \ -a "lcnc-lang=$1" \ diff --git a/docs/src/drivers/hostmot2.adoc b/docs/src/drivers/hostmot2.adoc index e18613f62de..454c17dbba1 100644 --- a/docs/src/drivers/hostmot2.adoc +++ b/docs/src/drivers/hostmot2.adoc @@ -521,7 +521,7 @@ Each StepGen instance has the following pins and parameters: position = counts / position_scale * 'step_type' - (u32, RW) Output format, like the step_type modparam to - the software stegen(9) component. + the software stepgen(9) component. 0 = Step/Dir, 1 = Up/Down, 2 = Quadrature. In Quadrature mode (step_type=2), the stepgen outputs one complete Gray cycle (00 \-> 01 \-> 11 \-> 10 \-> 00) for each 'step' it takes. diff --git a/docs/src/extensions/man_xref.rb b/docs/src/extensions/man_xref.rb new file mode 100644 index 00000000000..86389ef2365 --- /dev/null +++ b/docs/src/extensions/man_xref.rb @@ -0,0 +1,125 @@ +# docs/src/extensions/man_xref.rb +# +# Asciidoctor postprocessor that turns manpage cross-references in the +# conventional name(section) form (e.g. "halcmd(1)") into clickable links to +# the sibling HTML page ../man
/.
.html. +# +# * Index-gated: a token is linked only when a page .
exists +# in the troff tree, so false positives never resolve and stay plain text +# ("feed(2)"/"arc(3)" enum values in motion(9); external open(2)/udev(8); +# typo'd or renamed API names). +# * Never links a page to itself. +# * Skips text inside