docs(html): KiCAD-inspired topbar, side TOC, language switcher, admonition tints#4113
docs(html): KiCAD-inspired topbar, side TOC, language switcher, admonition tints#4113grandixximo wants to merge 2 commits into
Conversation
…ition tints Re-implemented on top of PR LinuxCNC#4081's docs/build/ layout. Replaces the previous prototype branch (commit 766f2d9) which targeted the pre-LinuxCNC#4081 docs/html/ paths. - Sticky topbar with LinuxCNC logo on every page; matches asciidoctor's footer colour scheme. Logo SVG lives at docs/src/lcnc-docs.svg and is copied into docs/build/html/ by the shared-asset rule. - Side TOC via asciidoctor :toc=left; auto-hides below 800px (CSS). - Language switcher in the topbar (top-right) built from po4a.cfg + a LANG_LABEL_<lang> map in Submakefile, so po4a.cfg stays the single source of truth. - Admonition blocks (note/tip/warning/caution/important) tinted by type with Unicode icons mapped onto asciidoctor's icons=font output (no FontAwesome dep). Build-time injection: - docs/src/docinfo-header.html generated from .html.in template; asciidoctor pages pick it up via docinfo=shared. - docs/src/gcode.html renamed to gcode.html.in (po4a master); per-lang docs/build/html/<lang>/gcode.html generated from po4a's gcode-raw.html + per-lang topbar fragment. - Per-lang docs/build/html/<lang>/index.html similarly gets topbar injection + CSS path rewrite + objects/index.incl appended so the manpage list is present on translated indexes too. - docs/src/index.tmpl's hardcoded Translations: list dropped; topbar switcher replaces it. - English + translated manpage HTML rules pass lcnc-lang-label and lcnc-subpath so the switcher works on manpages. Per-page language indication via lang_switcher_postprocess.py: walks docs/build/html at end of build, looks up each page's master in each lang's .po, counts msgid-with-master-loc vs translated, toggles class=lcnc-lang-unavail on the <li> when coverage falls below POKEEP (default 80). Same pass marks details-list entries (manpage index lists) whose target file does not exist for the current language. Idempotent: same toggle pattern across re-runs. POKEEP is overridable on the make command line (POKEEP=30 surfaces in-progress translations); contributing-to-linuxcnc.adoc, building-linuxcnc.adoc, and docs/README.adoc document the knob. CSS adds .lcnc-lang-unavail and .lcnc-link-unavail rules: dim text, pointer-events: none, cursor not-allowed; .lcnc-link-unavail also adds strikethrough for the index list context.
42cfdf5 to
133a6d9
Compare
|
You are hiding translations and doing grayed out presentation? The data is still there and you deliberately restrict access to it. That is IMO a Bad MoveTM and user unfriendly. If a translation is not worthy to show, then it should be removed entirely. Any cutoff level is always an arbitrary value and you have no idea which part you will hit. The large translation file may be only 10% done, but that can cover a complete section of the documentation, which you now are hiding. The better way is to start splitting the translations into smaller units so that it becomes much easier to do a full translation for a part. At the moment, you just see a huge mountain of stuff to translate with no end in sight. Smaller units solve that. But it is for the future. |
Also this one, wasn't sure what to go for, mostly trying to avoid broken links, I'm not sure what you are proposing here, the only way is a % and it is arbitrary, but it's the standard as far as I looked around, the chapter split for translation does not belong here, is the bad move a blocker? What's the alternative for this PR? |
|
Per your comment:
Why do this at all? If a language was translated and enabled in po4a.cfg, then it will be there. No buts, the config states it is available, then it is available. You worry about (external) links? This is the devel tree doc, not a release, and there are no guarantees in development. How else can we reorganize? Reorgs break things.
Don't hide it. This stuff needs fixing, not hiding.
It is not about "alternative". The redesign is great. The details are being discussed. |
|
It would be cool if we could get the whole TO in the left panel, like
And I would move the Navigation to the top, like the style of the Numpy docs
But if a language has a translation status of 10% or I would even say <50%, I would tend to hide this language. I think a mix of languages is more irritating than a complete English doc. Then you cannot really use the browser translation function. Would be nice if we could suppress this when only building for one language: |
You are undermining your argument by using "browser translation function". If you want the browser to translate, then you always should use the master (untranslated) documentation language (English) as the base for any automated translations... Not doing so would create Babel in extended fashion with aliens from Mars pitching in. That actually touches the reason why or why not to do (full) documentation translations at all. The automated translations work very well for "casual" texts. However, highly technical documents range from usable to mediocre to poor to outright misleading when auto-translated. Secondly, this stuff is often running on systems that are isolated and no access to Internet or advanced tools. Local information is still relevant for these systems. Hiding stuff is simply not the right way to solve the problem. |
I mean if you have a text where one paragraph is English and the next one is in some other language and so on. But forget that idea. If we hide the partly translations, it is hard so see the status and what needs to be translated.
But how would you mark the chapters which are translated completely? |
That is a good question. Probably by separating or grouping (some of) the chapters in translation. But any change here needs to wait because it should be accompanied by rethinking and moving around much of the documentation (content) to make a more logical and coherent story. |
|
@hansu doesn't the TOC already render on the left panel with this PR? Or am I missing something? |
With whole I mean the whole documentation or at least the chapter and not only the toc of the regarding adoc document. |
Move the native language display names out of the makefile into docs/src/lang-labels (tag<ws>name). A language in po4a.cfg without an entry falls back to its tag with a make warning.
|
@hansu in the other picture you changed the LinuxCNC Home Page link for Documentation, but the top left logo already links back to Documentation main page, I think it should stay linking back to linuxcnc.org not documentation, or you were thinking something different? |



Re-implements the docs topbar on top of the merged
docs/build/layout (#4081). Supersedes the pre-#4081 prototype (766f2d9103).What it adds
docs/src/lcnc-docs.svg, copied intodocs/build/html/by the shared-asset rule.:toc=left; auto-hides below 800px.po4a.cfgplus aLANG_LABEL_<lang>map sopo4a.cfgstays the single source of truth. Works on regular pages and manpages.icons=fontoutput, no FontAwesome dependency.Per-page translation status
lang_switcher_postprocess.pywalks the built tree, looks up each page's coverage in the per-language.po, and greys out switcher entries (and dead manpage-index links) below thePOKEEPthreshold (default 80%).POKEEP=30on the make line surfaces in-progress translations; documented incontributing-to-linuxcnc.adoc,building-linuxcnc.adoc, anddocs/README.adoc.Notes
docinfo-header.htmlfrom a.html.intemplate viadocinfo=shared;gcode.htmlbecomesgcode.html.in(po4a master) with per-language topbar fragments; the stale hardcodedTranslations:list inindex.tmplis dropped in favour of the switcher.