aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-16 19:44:21 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-16 19:44:21 +0100
commit37bbe760b9b7c9c6aee8323c7766574a7ef55389 (patch)
tree16f39e0d75374621ec169db9b6a43939038130e7 /src/utils
parent6db302e2a3c33f28f33c1044873f6bed958d2a37 (diff)
downloadchawan-37bbe760b9b7c9c6aee8323c7766574a7ef55389.tar.gz
cssvalues: serialize quotes, add font-size, opacity
font-size isn't very useful, but some scripts assume it exists. opacity: 0 for now is special cased: it inhibits rendering of further boxes. This isn't quite right, as it should just behave as a pseudo visibility: hidden... nonetheless it's quite effective at hiding garbage. (Also, remove incorrect comment - it can be nil if the branch has no variables.)
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/twtstr.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index b646483a..7c905aa3 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -502,6 +502,13 @@ func dqEscape*(s: openArray[char]): string =
result &= '\\'
result &= c
+func cssEscape*(s: openArray[char]): string =
+ result = ""
+ for c in s:
+ if c == '\'':
+ result &= '\\'
+ result &= c
+
#basically std join but with char
func join*(ss: openArray[string]; sep: char): string =
if ss.len == 0: