stylesheet-html-common: only apply Bootstrap container classes in website build

From: Lev Nikolaev <lev(dot)nikolaev(at)tantorlabs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: stylesheet-html-common: only apply Bootstrap container classes in website build
Date: 2025-07-09 12:40:23
Message-ID: 3c8690e0-d79a-46bc-a7c7-9314e30d8b3c@tantorlabs.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-stylesheet-html-common-only-apply-Bootstrap-containe.patch text/x-patch 1.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Robin Haberkorn 2025-07-09 12:53:52 Re: [PATCH] contrib/xml2: xslt_process() should report XSLT-related error details
Previous Message Hayato Kuroda (Fujitsu) 2025-07-09 12:39:33 RE: Conflict detection for update_deleted in logical replication