[SCM] PostGIS branch master updated. 3.7.0alpha1-665-g8bafa4315
git at osgeo.org
git at osgeo.org
Mon Jul 20 06:14:21 PDT 2026
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, master has been updated
via 8bafa43152c07f386224f6ae0c2052b570b2fd82 (commit)
via 9697dd43f5f7f355df1b4a67a0d0fc411dbb3af2 (commit)
from e38d9450b77ac106efd404465cf1e62749837401 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8bafa43152c07f386224f6ae0c2052b570b2fd82
Merge: e38d9450b 9697dd43f
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date: Mon Jul 20 06:14:20 2026 -0700
Merge pull request 'docs: keep generated visual examples sized in output' (!474) from Komzpa/postgis:fix/docs-rendering-regina-20260720 into master
commit 9697dd43f5f7f355df1b4a67a0d0fc411dbb3af2
Author: Darafei Praliaskouski <me at komzpa.net>
Date: Mon Jul 20 16:35:21 2026 +0400
docs: keep generated visual examples sized in output
diff --git a/doc/html/style.css b/doc/html/style.css
index c81074c38..47b24c6a8 100644
--- a/doc/html/style.css
+++ b/doc/html/style.css
@@ -624,6 +624,13 @@ table.postgis-example-grid td {
width: auto;
}
+.postgis-geometry-figure-fallback {
+ display: block;
+ height: auto;
+ max-width: 100%;
+ width: 100%;
+}
+
.postgis-geometry-literal {
border-radius: 0.16em;
transition: background-color 90ms ease;
diff --git a/doc/xsl/postgis-dblatex-block-labels.xsl b/doc/xsl/postgis-dblatex-block-labels.xsl
index c78a0cde2..29670a408 100644
--- a/doc/xsl/postgis-dblatex-block-labels.xsl
+++ b/doc/xsl/postgis-dblatex-block-labels.xsl
@@ -89,6 +89,15 @@
<xsl:value-of select="translate(., '┌┐└┘├┤┬┴┼─│', '+++++++++-|')"/>
<xsl:text>
\end{lstlisting}
\endgroup
</xsl:text>
</xsl:when>
+ <xsl:when test="(contains(@xml:id, 'st-buffer-example-') or contains(@id, 'st-buffer-example-')) and contains(., ',')">
+ <xsl:text>
\begingroup\lstset{basicstyle=\ttfamily\scriptsize}
</xsl:text>
+ <xsl:text>\noindent\ttfamily\scriptsize{}</xsl:text>
+ <xsl:call-template name="postgis-dblatex-breakable-geometry">
+ <xsl:with-param name="text" select="."/>
+ </xsl:call-template>
+ <xsl:text>\par
</xsl:text>
+ <xsl:text>
\endgroup
</xsl:text>
+ </xsl:when>
<xsl:when test="contains($role.tokens, ' text-primary ') or string-length(normalize-space(.)) > 600">
<xsl:text>
\begingroup\lstset{basicstyle=\ttfamily\scriptsize}
</xsl:text>
<xsl:apply-imports/>
diff --git a/doc/xsl/postgis-html-block-labels.xsl b/doc/xsl/postgis-html-block-labels.xsl
index 81b79a75b..a92a9cb85 100644
--- a/doc/xsl/postgis-html-block-labels.xsl
+++ b/doc/xsl/postgis-html-block-labels.xsl
@@ -354,7 +354,19 @@
</xsl:call-template>
</div>
</div>
+ <xsl:variable name="visual.src">
+ <xsl:value-of select="concat($img.src.path, 'images/visual-examples/', $visual.id, '.svg')"/>
+ <xsl:if test="$postgis.visual.version != ''">
+ <xsl:value-of select="concat('?v=', $postgis.visual.version)"/>
+ </xsl:if>
+ </xsl:variable>
<object type="image/svg+xml">
+ <xsl:if test="$manifest.visual/@width">
+ <xsl:attribute name="width"><xsl:value-of select="$manifest.visual/@width"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$manifest.visual/@height">
+ <xsl:attribute name="height"><xsl:value-of select="$manifest.visual/@height"/></xsl:attribute>
+ </xsl:if>
<xsl:attribute name="class">
<xsl:text>postgis-geometry-figure-body</xsl:text>
<xsl:if test="$manifest.visual/@kind = 'image-output'">
@@ -362,12 +374,14 @@
</xsl:if>
</xsl:attribute>
<xsl:attribute name="data">
- <xsl:value-of select="concat($img.src.path, 'images/visual-examples/', $visual.id, '.svg')"/>
- <xsl:if test="$postgis.visual.version != ''">
- <xsl:value-of select="concat('?v=', $postgis.visual.version)"/>
- </xsl:if>
+ <xsl:value-of select="$visual.src"/>
</xsl:attribute>
- <xsl:text>Geometry figure for </xsl:text><xsl:value-of select="$visual.id"/>
+ <img class="postgis-geometry-figure-fallback">
+ <xsl:attribute name="src"><xsl:value-of select="$visual.src"/></xsl:attribute>
+ <xsl:attribute name="alt">
+ <xsl:text>Geometry figure for </xsl:text><xsl:value-of select="$visual.id"/>
+ </xsl:attribute>
+ </img>
</object>
</div>
</xsl:if>
diff --git a/utils/postgis_exampletest.py b/utils/postgis_exampletest.py
index 700f51b00..d79d7839f 100755
--- a/utils/postgis_exampletest.py
+++ b/utils/postgis_exampletest.py
@@ -3186,6 +3186,10 @@ SELECT json_build_object(
raise RuntimeError(f"Duplicate or missing visual example id: {visual['id']!r}")
seen.add(visual["id"])
(temporary / f"{visual['id']}.svg").write_text(visual["svg"], encoding="utf-8")
+ svg_match = re.search(
+ r'<svg\b[^>]*\bwidth="([^"]+)"[^>]*\bheight="([^"]+)"',
+ visual["svg"],
+ )
manifest_item = {
"id": visual["id"],
"kind": visual["kind"],
@@ -3194,6 +3198,8 @@ SELECT json_build_object(
"refentry": visual["refentry"],
"screen": visual["screen"],
"source": visual["source"],
+ "width": svg_match.group(1) if svg_match else None,
+ "height": svg_match.group(2) if svg_match else None,
"layers": visual.get("layers", []),
}
if visual.get("native_output"):
diff --git a/utils/test_postgis_exampletest.py b/utils/test_postgis_exampletest.py
index fd3724809..f79d30287 100644
--- a/utils/test_postgis_exampletest.py
+++ b/utils/test_postgis_exampletest.py
@@ -2514,6 +2514,7 @@ class VisualExampleTest(unittest.TestCase):
"id": "one", "kind": "geometry-output", "preferred": True,
"refentry": "ST_Buffer", "screen": 1, "source": "ST_Buffer:1",
"output_omitted": False,
+ "width": None, "height": None,
"native_output": "01010000000000000000000000000000000000000000",
"layers": [{
"id": "one-code-1", "source": "Code", "label": "center",
@@ -2530,6 +2531,26 @@ class VisualExampleTest(unittest.TestCase):
self.assertIn('<layer id="one-code-1" source="Code" label="center"', manifest_xml)
self.assertIn('dimension="0" srid="0" frame="Overlay"', manifest_xml)
+ def test_publish_visual_examples_records_svg_dimensions(self):
+ with tempfile.TemporaryDirectory() as directory:
+ target = Path(directory) / "visual-examples"
+ self.tester.publish_visual_examples(
+ target,
+ [{
+ "id": "one", "source": "ST_Buffer:1",
+ "svg": '<svg xmlns="http://www.w3.org/2000/svg" width="600" height="402"></svg>\n',
+ "kind": "geometry-output", "preferred": True,
+ "refentry": "ST_Buffer", "screen": 1, "output_omitted": False,
+ "layers": [],
+ }],
+ )
+ manifest_json = json.loads((target / "manifest.json").read_text(encoding="utf-8"))
+ self.assertEqual("600", manifest_json[0]["width"])
+ self.assertEqual("402", manifest_json[0]["height"])
+ manifest_xml = (target / "manifest.xml").read_text(encoding="utf-8")
+ self.assertIn('width="600"', manifest_xml)
+ self.assertIn('height="402"', manifest_xml)
+
if __name__ == "__main__":
unittest.main()
-----------------------------------------------------------------------
Summary of changes:
doc/html/style.css | 7 +++++++
doc/xsl/postgis-dblatex-block-labels.xsl | 9 +++++++++
doc/xsl/postgis-html-block-labels.xsl | 24 +++++++++++++++++++-----
utils/postgis_exampletest.py | 6 ++++++
utils/test_postgis_exampletest.py | 21 +++++++++++++++++++++
5 files changed, 62 insertions(+), 5 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list