stylesheet-html-common: only apply Bootstrap container classes in website build - Mailing list pgsql-hackers

From Lev Nikolaev
Subject stylesheet-html-common: only apply Bootstrap container classes in website build
Date
Msg-id 3c8690e0-d79a-46bc-a7c7-9314e30d8b3c@tantorlabs.com
Whole thread Raw
List 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

pgsql-hackers by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Conflict detection for update_deleted in logical replication
Next
From: "Robin Haberkorn"
Date:
Subject: Re: [PATCH] contrib/xml2: xslt_process() should report XSLT-related error details