Handle font family which is a variable

main
Bob Mottram 2020-11-16 20:13:48 +00:00
parent a0a462fe05
commit 60212ceb06
1 changed files with 8 additions and 0 deletions

View File

@ -160,6 +160,14 @@ def setCSSparam(css: str, param: str, value: str) -> str:
s = css.split(searchStr) s = css.split(searchStr)
newcss = '' newcss = ''
for sectionStr in s: for sectionStr in s:
# handle font-family which is a variable
nextSection = sectionStr
if ';' in nextSection:
nextSection = nextSection.split(';')[0] + ';'
if searchStr == 'font-family:' and "var(--" in nextSection:
newcss += searchStr + ' ' + sectionStr
continue
if not newcss: if not newcss:
if sectionStr: if sectionStr:
newcss = sectionStr newcss = sectionStr