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