mirror of https://gitlab.com/bashrc2/epicyon
Replace once only
parent
c07a8192f9
commit
a3b95e65a2
7
theme.py
7
theme.py
|
@ -78,7 +78,10 @@ def setCSSparam(css: str, param: str, value: str) -> str:
|
||||||
searchStr = '--' + param + ':'
|
searchStr = '--' + param + ':'
|
||||||
if searchStr not in css:
|
if searchStr not in css:
|
||||||
return css
|
return css
|
||||||
s = css.split(searchStr)
|
if onceOnly:
|
||||||
|
s = css.split(searchStr, 1)
|
||||||
|
else:
|
||||||
|
s = css.split(searchStr)
|
||||||
newcss = ''
|
newcss = ''
|
||||||
for sectionStr in s:
|
for sectionStr in s:
|
||||||
if not newcss:
|
if not newcss:
|
||||||
|
@ -92,8 +95,6 @@ def setCSSparam(css: str, param: str, value: str) -> str:
|
||||||
searchStr + ' ' + value + ';' + sectionStr.split(';', 1)[1]
|
searchStr + ' ' + value + ';' + sectionStr.split(';', 1)[1]
|
||||||
else:
|
else:
|
||||||
newcss += searchStr + ' ' + sectionStr
|
newcss += searchStr + ' ' + sectionStr
|
||||||
if onceOnly:
|
|
||||||
break
|
|
||||||
return newcss.strip()
|
return newcss.strip()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue