From 29070c78a981b202db4b14d878e39f58074397be Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 4 Dec 2022 17:53:41 +0200 Subject: [PATCH] fix this and related stuff https://stupidpol.site/h/programming/post/128394/advent-of-code-day-3-i/3182179?context=8#context --- files/assets/js/markdown.js | 6 +++--- files/helpers/regex.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/files/assets/js/markdown.js b/files/assets/js/markdown.js index fcb2a7dd8..8be2ae12b 100644 --- a/files/assets/js/markdown.js +++ b/files/assets/js/markdown.js @@ -54,7 +54,7 @@ function markdown(t) { input = input.replace(/\|\|(.*?)\|\|/g, '$1') input = input.replace(/(\n|^)>([^ >][^\n]*)/g, '$1\>$2') - const emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,36}):(?!\/)/gi)) + const emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,36}):(?![^`]*`)/gi)) if(emojis != null){ for(i = 0; i < emojis.length; i++){ const old = emojis[i][0]; @@ -72,7 +72,7 @@ function markdown(t) { } } - let options = Array.from(input.matchAll(/\s*\$\$([^\$\n]+)\$\$\s*/gi)) + let options = Array.from(input.matchAll(/\s\$\$([^\$\n]+)\$\$\s*(?![^`]*`)/gi)) if(options != null){ for(i = 0; i < options.length; i++){ const option = options[i][0]; @@ -82,7 +82,7 @@ function markdown(t) { } } - options = Array.from(input.matchAll(/\s*&&([^\$\n]+)&&\s*/gi)) + options = Array.from(input.matchAll(/\s*&&([^\$\n]+)&&\s*(?![^`]*`)/gi)) if(options != null){ for(i = 0; i < options.length; i++){ const option = options[i][0]; diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 9d9b8eb0e..46e356502 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -26,9 +26,9 @@ valid_sub_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$", flags=re.A) query_regex = re.compile("(\w+):(\S+)", flags=re.A) -poll_regex = re.compile("\s*\$\$([^\$\n]+)\$\$\s*(?![^`]*```)", flags=re.A) -bet_regex = re.compile("\s*\$\$\$([^\$\n]+)\$\$\$\s*(?![^`]*```)", flags=re.A) -choice_regex = re.compile("\s*&&([^\$\n]+)&&\s*(?![^`]*```)", flags=re.A) +poll_regex = re.compile("\s*\$\$([^\$\n]+)\$\$\s*(?![^`]*`)", flags=re.A) +bet_regex = re.compile("\s*\$\$\$([^\$\n]+)\$\$\$\s*(?![^`]*`)", flags=re.A) +choice_regex = re.compile("\s*&&([^\$\n]+)&&\s*(?![^`]*`)", flags=re.A) html_comment_regex = re.compile("", flags=re.A)