Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit730d0409c6e151a0564f117bf041fcfaef19d858 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-10-16 21:19:15 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-10-16 21:19:15 +0300
Files8037dd5919b2addadac3ed8ab879705ab5798771
syndamia.com-730d0409c6e151a0564f117bf041fcfaef19d858.tar
syndamia.com-730d0409c6e151a0564f117bf041fcfaef19d858.tar.gz
syndamia.com-730d0409c6e151a0564f117bf041fcfaef19d858.zip
Parent3b2eab4303507ae79fd0da4103134b9ab462034e (diff)
[Svg-height-attrib] Updated logic to work only on SVGs that aren't alone in a line
Sane explanation of compilers has been kinda broken for a long long time, since it uses SVGs as normal images
1 files changed, 4 insertions, 2 deletions
-rw-r--r--awk-edits/Svg-height-attrib.awk6
diff --git a/awk-edits/Svg-height-attrib.awk b/awk-edits/Svg-height-attrib.awk
index fe3027a..e6dc07f 100644
--- a/awk-edits/Svg-height-attrib.awk
+++ b/awk-edits/Svg-height-attrib.awk
@@ -1,10 +1,12 @@
#
# == About
#
-# This script forces all images with SVG source to have a hard-coded height to them.
+# This script forces all images with SVG source, which aren't alone, to have
+# a hard-coded height to them. The idea is to not make SVGs inside text take
+# up the whole screen.
# This is mostly done for browsers that do not support CSS.
-/src="[^"]*\.svg"/ {
+/<p>.+<img src="[^"]*\.svg"/ || /src="[^"]*\.svg"[^>]*>.+<\/p>/ {
result = ""
while(match($0, /src="[^"]*\.svg"/)) {
result = result substr($0, 1, RSTART + RLENGTH - 1) " height=18";