From 049af2a9375ad6c0f91bff21bef70b84f84cf523 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 29 Mar 2023 15:24:30 -0700
Subject: [PATCH v4 6/6] meson: docs: Allow configuring simple/website style

Discussion: https://postgr.es/m/
---
 meson_options.txt              |  3 +++
 doc/src/sgml/installation.sgml | 13 +++++++++++++
 doc/src/sgml/meson.build       |  7 ++++---
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index c203dcce6fe..5b44a8829d3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -85,6 +85,9 @@ option('docs', type : 'feature', value: 'auto',
 option('docs_pdf', type : 'feature', value: 'auto',
   description: 'documentation in PDF format')
 
+option('docs_html_style', type : 'combo', choices: ['simple', 'website'],
+  description: 'CSS stylesheet for HTML documentation')
+
 option('dtrace', type : 'feature', value: 'disabled',
   description: 'DTrace support')
 
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 8b87a274fcb..29d4d3b74df 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -2923,6 +2923,19 @@ ninja install
       </listitem>
      </varlistentry>
 
+     <varlistentry id="configure-docs-html-style">
+      <term><option>-Ddocs_html_style={ simple | website }</option></term>
+      <listitem>
+        <para>
+         Influences which <acronym>CSS</acronym> stylesheet is used. If
+         <literal>website</literal>, instead of the default
+         <literal>simple</literal>, is used, HTML documentation will use the
+         stylesheet used on <ulink
+         url="https://www.postgresql.org/docs/current/">postgresql.org</ulink>.
+       </para>
+      </listitem>
+     </varlistentry>
+
     </variablelist>
    </sect3>
 
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 19531ebbcc7..e9506acc5bb 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -109,9 +109,10 @@ endif
 # Full documentation as html, text
 #
 if docs_dep.found()
-  xsltproc_html_flags = xsltproc_flags + [
-    '--param', 'website.stylesheet', '1'
-  ]
+  xsltproc_html_flags = xsltproc_flags
+  if get_option('docs_html_style') == 'website'
+    xsltproc_html_flags += ['--param', 'website.stylesheet', '1']
+  endif
 
   html = custom_target('html',
     input: ['stylesheet.xsl', postgres_full_xml],
-- 
2.38.0

