diff --git a/.gitattributes b/.gitattributes
index 2b72ef7e55..3ac9997281 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -13,7 +13,6 @@ README.* conflict-marker-size=32
# Certain data files that contain special whitespace, and other special cases
*.data -whitespace
-*.svg whitespace=-blank-at-eol
contrib/pgcrypto/sql/pgp-armor.sql whitespace=-blank-at-eol
src/backend/catalog/sql_features.txt whitespace=space-before-tab,blank-at-eof,-blank-at-eol
diff --git a/doc/src/sgml/images/Makefile b/doc/src/sgml/images/Makefile
index bb508dd0dd..1e7993020b 100644
--- a/doc/src/sgml/images/Makefile
+++ b/doc/src/sgml/images/Makefile
@@ -8,11 +8,19 @@ ALL_IMAGES = \
DITAA = ditaa
DOT = dot
+XSLTPROC = xsltproc
all: $(ALL_IMAGES)
-%.svg: %.gv
+%.svg.tmp: %.gv
$(DOT) -T svg -o $@ $<
-%.svg: %.txt
+%.svg.tmp: %.txt
$(DITAA) -E -S --svg $< $@
+
+# Post-processing for SVG files coming from other tools
+#
+# Use --novalid to avoid loading SVG DTD if a file specifies it, since
+# it might not be available locally, and we don't need it.
+%.svg: %.svg.tmp fixup-svg.xsl
+ $(XSLTPROC) --novalid -o $@ $(word 2,$^) $<
diff --git a/doc/src/sgml/images/README b/doc/src/sgml/images/README
index ade627bda2..07c4580255 100644
--- a/doc/src/sgml/images/README
+++ b/doc/src/sgml/images/README
@@ -22,6 +22,10 @@ Therefore, any tool used needs to be able to produce SVG.
This directory contains makefile rules to build SVG from common input
formats, using some common styling.
+fixup-svg.xsl applies some postprocessing to the SVG files produced by
+those external tools to address assorted issues. See comments in
+there, and adjust and expand as necessary.
+
Both the source and the SVG output file are committed in this
directory. That way, we don't need all developers to have all the
tools installed. While we accept that there could be some gratuitous
@@ -59,10 +63,3 @@ Notes:
- The width should be set to something. This ensures that the image
is scaled to fit the page in PDF output. (Other widths than 100%
might be appropriate.)
-
-- SVG images should be scalable as they will be rendered in a variety
- of places (web, PDF, etc.) as well as in different viewports
- (desktop, mobile, etc.). To help the images successfully scale,
- employ a "viewBox" attribute in the SVG tag. For example,
- to create an image with a default width and height of 400x300,
- you would use viewBox="0.00 0.00 400.00 300.00"
diff --git a/doc/src/sgml/images/fixup-svg.xsl b/doc/src/sgml/images/fixup-svg.xsl
new file mode 100644
index 0000000000..d6c46b362e
--- /dev/null
+++ b/doc/src/sgml/images/fixup-svg.xsl
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+ 0 0
+
+
+
+
+
+
+
+
+
+
+
+ none
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/src/sgml/images/gin.svg b/doc/src/sgml/images/gin.svg
index eacb5c8c16..04fe85ba44 100644
--- a/doc/src/sgml/images/gin.svg
+++ b/doc/src/sgml/images/gin.svg
@@ -1,14 +1,11 @@
-
-
+
-