Skip to content
Snippets Groups Projects
Commit c72e3dac authored by Hartung, Michael's avatar Hartung, Michael
Browse files

update prefixCss: deal with string comaprison and class cases divided by :

parent 347d71e8
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ import subprocess
import argparse
def find_nth(haystack, needle, n):
start = haystack.find(needle)
while start >= 0 and n > 1:
......@@ -31,15 +32,26 @@ class ParserHTML:
def prefixNgClassStrings(self, line, classStart):
start = False
classIndices = []
stringComparison = False
seenQuestionmark = False
for i, c in enumerate(line[classStart:], classStart):
if c == "'":
if c == "'" and not stringComparison:
if not start:
classIndices.append(i+1)
start = True
else:
start = False
elif c == '}':
elif c == '}' or c =='"':
break
elif c == ':' and not seenQuestionmark:
stringComparison = True
elif c == ',':
stringComparison = False
seenQuestionmark = False
elif c == '?':
# if we see a ?, the following : does not implicate a string comparison but a case separation
seenQuestionmark = True
for i, start in enumerate(classIndices):
start += i * len(self.PREFIX)
line = line[:start] + self.PREFIX + line[start:]
......@@ -105,17 +117,24 @@ class ParserHTML:
newLines = []
with open(path) as f:
content = ''
iTagOpen = False
# remove linebreaks in tags
stringOpen = False
for line in f:
if not len(line.strip()):
continue
# line.count('"') % 2 --> opened but not closed like [ngClass]="
if line.count('"') % 2 and not line.strip().endswith('>'):
content += line.strip() + ' '
stringOpen = not stringOpen
else:
content += line + '\n'
if stringOpen:
# no new line
content += line.strip() + ' '
else:
# new line
content += line + '\n'
iTagOpen = False
for line in content.split('\n'):
line = line.strip()
if '<i' in line:
......@@ -174,12 +193,12 @@ class ParserJS:
ELEMENTBYIDSTRING = 'document.getElementById('
def findIdPos(self, line):
def findId(self, line):
start = line.find(self.ELEMENTBYIDSTRING) + len(self.ELEMENTBYIDSTRING)+1
return start
def replaceElementById(self, line):
start = self.findIdPos(line)
start = self.findId(line)
line = line[:start] + self.PREFIX + line[start:]
return line
......
......@@ -3,7 +3,7 @@
<div class="toast {{getDrugstoneClass(toast.value.type)}}">
<a (click)="close(toast.key)" aria-label="close" class="close">
<span class="icon" title="Close analysis">
<i class="fas fa-times" aria-hidden="true"></i>
<i class="fas fa-times toast-times" aria-hidden="true"></i>
</span>
</a>
<p>{{toast.value.message}}</p>
......
......@@ -27,7 +27,7 @@ export class ToastService {
public setTimer(id: number) {
setTimeout(() => {
this.deleteToast(id);
}, 10000);
}, 100000000);
}
public deleteToast(id: number) {
......
......@@ -200,7 +200,7 @@
}
.fa-exclamation-triangle, .color-danger, .help, .delete:after, .delete:before, .modal-close:after, .modal-close:before {
.fa-exclamation-triangle, .fa-times, .color-danger, .help, .delete:after, .delete:before, .modal-close:after, .modal-close:before {
color: var(--drgstn-danger) !important;
}
......@@ -289,6 +289,10 @@
::-webkit-scrollbar-button:increment {
width: 0px !important;
}
.toast-times {
color: var(--drgstn-text-secondary) !important;
}
}
// scrolllbar styles
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment