Skip to content

Commit

Permalink
bugfix(wrap-stream-in-html): allow highlighting to work after formatt…
Browse files Browse the repository at this point in the history
…ing the html (sverweij#362)

Co-authored-by: Emily Marigold Klassen <forivall@users.noreply.github.com>
  • Loading branch information
forivall and forivall authored Sep 6, 2020
1 parent 9df2106 commit 38e20e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cli/tools/svg-in-html-snippets/footer.snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
var title = n.querySelector('title');
var titleText = title && title.textContent;
if (titleText) {
nodeMap[titleText] = n;
nodeMap[titleText.trim()] = n;
}
});
/** @type {{[key: string]: SVGGElement[]}} */
Expand All @@ -20,7 +20,8 @@
var title = e.querySelector('title');
var titleText = title && title.textContent;
if (titleText) {
var nodeNames = titleText.split('->');
titleText = titleText.trim();
var nodeNames = titleText.split(/\s*->\s*/);
edgeMap[titleText] = [nodeMap[nodeNames[0]], nodeMap[nodeNames[1]]];
(edgeMap[nodeNames[0]] || (edgeMap[nodeNames[0]] = [])).push(e);
(edgeMap[nodeNames[1]] || (edgeMap[nodeNames[1]] = [])).push(e);
Expand All @@ -40,6 +41,9 @@
/** @type {SVGTitleElement} */
var title = nodeOrEdge && nodeOrEdge.querySelector('title');
var titleText = title && title.textContent;
if (titleText) {
titleText = titleText.trim();
}
if (current === titleText) {
return;
}
Expand Down

0 comments on commit 38e20e8

Please sign in to comment.