Skip to content

Commit 1fe84b5

Browse files
committed
highlight and needinfo command substitution merged for the same keyword (needinfo higher priority than highligh)
1 parent 40042c4 commit 1fe84b5

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

HTMLVisualizer.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,20 @@ def decomposeLineForSubs(self, line, points):
166166
pks = 0
167167
for p in ks:
168168
d_lines.append( (line[pks:p-1], line[pks:p-1]) )
169-
#print (pks, p-1, line[pks:p-1], line[pks:p-1])
170-
d_lines.append( (line[(p-1):p - 1 + i_points[p]], "".join(i_substs[p]) ) )
171-
#print i_substs[p]
172-
#print ((p-1), i_points[p], line[(p-1):p - 1 + i_points[p]], "".join(i_substs[p]))
173-
#print i_points[p] + p - 1
169+
# primarly for more comments at the end of a line
170+
# but having more highlighted keywords (needinfo+highligh)
171+
jp = "".join(i_substs[p])
172+
# THIS IS HACK, HAS TO BE REWRITTEN!!!
173+
if len(i_substs[p]) == 2:
174+
if "<span class='highlight'>" in jp and "<span class='needinfo'>" in jp:
175+
keyword = re.sub(r"<[^>]*>", "", jp)
176+
# now the keyword is 2 times duplicated
177+
size = len(keyword)
178+
keyword = keyword[:size/2]
179+
jp = "<span class='highlight'><span class='needinfo'>%s</span></span>" % (keyword)
180+
181+
d_lines.append( (line[(p-1):p - 1 + i_points[p]], jp ) )
182+
174183
pks = i_points[p] + p - 1
175184
return d_lines
176185

0 commit comments

Comments
 (0)