Skip to content

Commit

Permalink
Merge pull request #1317 from snap01/fix-too-much-recursion-in-bad-co…
Browse files Browse the repository at this point in the history
…c7-links

Change RegExp to only support two nested square brackets
  • Loading branch information
snap01 authored Mar 22, 2023
2 parents 8753080 + e904f01 commit e573da4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/apps/coc7-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class CoC7Parser {
let text = []

text = TextEditor._getTextNodes(html)
const rgx = new RegExp('@(coc7)\\.' + '([^\\]]+?)' + '\\[((?:[^\\]\\[]+|\\[(?:[^\\]\\[]+|\\[[^\\]\\[]*\\])*\\])*)\\]' + '(?:{([^}]+)})?', 'gi')
const rgx = new RegExp('@(coc7)\\.' + '(check|effect|item|sanloss)' + '\\[([^\\[\\]]*(?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\])*[^\\[\\]]*\\])*[^\\[\\]]*)\\]' + '(?:{([^}]+)})?', 'gi')
TextEditor._replaceTextContent(text, rgx, CoC7Link._createLink)
return html.innerHTML
}
Expand Down

0 comments on commit e573da4

Please sign in to comment.