Обсуждение: stylesheet-html-common: only apply Bootstrap container classes in website build
stylesheet-html-common: only apply Bootstrap container classes in website build
От
Lev Nikolaev
Дата:
Hi hackers, Currently the `body.attributes` template in doc/src/sgml/stylesheet-html-common.xsl unconditionally adds `class="container-fluid col-10"` to every HTML output. Those classes only make sense when the “website” stylesheet (docs-complete.css, which includes Bootstrap’s grid) is actually loaded, i.e. when you build with make STYLE=website html In a normal local build (`make html`), `$website.stylesheet` is zero, docs-complete.css is not pulled in, and the Bootstrap classes are “hanging” in the markup without any effect. This can confuse both users and downstream tooling, and generally clutters the output with unused attributes. This patch wraps that `<xsl:attribute name="class">container-fluid col-10</xsl:attribute>` inside an `<xsl:if test="$website.stylesheet != 0">…</xsl:if>` so that the container classes are only emitted when the website CSS bundle is in use. Local builds remain unchanged (no container classes), while `STYLE=website` builds continue to get the proper 10/12-column layout. Equipment tested: - `make html` produces <body id="docContent"> with no class attribute - `make STYLE=website html` produces <body id="docContent" class="container-fluid col-10"> and the docs-complete.css bundle correctly constrains the width Discussion: This keeps the default (offline) documentation clean of Bootstrap-specific markup, but preserves the exact site look when desired. Any feedback or suggestions are very welcome! -- Best wishes, Lev Nikolaev, Tantor Labs LLC
Вложения
Re: stylesheet-html-common: only apply Bootstrap container classes in website build
От
Ilia Evdokimov
Дата:
On 09.07.2025 15:40, Lev Nikolaev wrote: > Hi hackers, > > Currently the `body.attributes` template in > doc/src/sgml/stylesheet-html-common.xsl unconditionally adds > `class="container-fluid col-10"` to every HTML output. Those classes only > make sense when the “website” stylesheet (docs-complete.css, which > includes Bootstrap’s grid) is actually loaded, i.e. when you build with > > make STYLE=website html > > In a normal local build (`make html`), `$website.stylesheet` is zero, > docs-complete.css is not pulled in, and the Bootstrap classes are > “hanging” in the markup without any effect. This can confuse both > users and downstream tooling, and generally clutters the output with > unused attributes. > > This patch wraps that `<xsl:attribute name="class">container-fluid > col-10</xsl:attribute>` > inside an `<xsl:if test="$website.stylesheet != 0">…</xsl:if>` so that > the > container classes are only emitted when the website CSS bundle is in use. > Local builds remain unchanged (no container classes), while > `STYLE=website` > builds continue to get the proper 10/12-column layout. > > Equipment tested: > > - `make html` produces <body id="docContent"> with no class attribute > - `make STYLE=website html` produces > <body id="docContent" class="container-fluid col-10"> and > the docs-complete.css bundle correctly constrains the width > > Discussion: > This keeps the default (offline) documentation clean of > Bootstrap-specific > markup, but preserves the exact site look when desired. > > Any feedback or suggestions are very welcome! > > -- > Best wishes, > Lev Nikolaev, > Tantor Labs LLC +1 Running 'make html' I see in, for example, "regress.html" file: Before patch: <body id="docContent" class="container-fluid col-10"> After patch: <body id="docContent"> -- Best regards, Ilia Evdokimov, Tantor Labs LLC.