gsarti rsn86 commited on
Commit
93bd6ae
·
verified ·
1 Parent(s): 6d4df8d

fix(parser): Correctly handle literal less-than signs in text (#6)

Browse files

- fix(parser): Correctly handle literal less-than signs in text (c25ec7af2a2b5e440a8300feb10452b9f8f50ab9)


Co-authored-by: Rodrigo Schmidt Nurmberg <[email protected]>

src/frontend/HighlightedTextbox.svelte CHANGED
@@ -119,14 +119,14 @@
119
  });
120
  for (let i = 0; i < clean_marked_text.length; i++) {
121
  let char = clean_marked_text[i];
122
- if (char === "<") {
123
  in_tag = true;
124
  if (text) {
125
  new_value.push([text, category]);
126
  }
127
  text = "";
128
  category = null;
129
- } else if (char === ">") {
130
  in_tag = false;
131
  if (tag.slice(0, 4) === "mark") {
132
  let match = /class="hl ([^"]+)"/.exec(tag);
 
119
  });
120
  for (let i = 0; i < clean_marked_text.length; i++) {
121
  let char = clean_marked_text[i];
122
+ if (char === "<" && (i+5) <= clean_marked_text.length && clean_marked_text.slice(i+1,i+5) === "mark") {
123
  in_tag = true;
124
  if (text) {
125
  new_value.push([text, category]);
126
  }
127
  text = "";
128
  category = null;
129
+ } else if (char === ">" && in_tag) {
130
  in_tag = false;
131
  if (tag.slice(0, 4) === "mark") {
132
  let match = /class="hl ([^"]+)"/.exec(tag);