Allow for non-ASCII letters in tags

This commit is contained in:
Ivan Liadniou 2021-06-14 21:00:35 +02:00
parent 1d8b8090dc
commit 09773c03e2

View File

@ -32,16 +32,18 @@ export class Regex {
this.globalTagsSplitter = /\[\[(.*?)\]\]|#([\p{L}:\/-]+)|([\p{L}:]+)/gmiu this.globalTagsSplitter = /\[\[(.*?)\]\]|#([\p{L}:\/-]+)|([\p{L}:]+)/gmiu
// Cards // Cards
let flags = "gimu"
// https://regex101.com/r/p3yQwY/2 // https://regex101.com/r/p3yQwY/2
let str = "( {0,3}[#]*)((?:[^\\n]\\n?)+?)(#" + settings.flashcardsTag + "(?:-reverse)?)((?: *#[\\w-]+)*) *?\\n+((?:[^\\n]\\n?)*?(?=\\^\\d{13}|$))(?:\\^(\\d{13}))?" let str = "( {0,3}[#]*)((?:[^\\n]\\n?)+?)(#" + settings.flashcardsTag + "(?:-reverse)?)((?: *#[\\p{Letter}-]+)*) *?\\n+((?:[^\\n]\\n?)*?(?=\\^\\d{13}|$))(?:\\^(\\d{13}))?"
this.flashscardsWithTag = new RegExp(str, "gim") this.flashscardsWithTag = new RegExp(str, flags)
// https://regex101.com/r/Ixtzlv/1 // https://regex101.com/r/Ixtzlv/1
str = "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d.|[-+*]|#{1,6}))?(.+?) ?(:{2,3}) ?(.+?)((?: *#[\\w-]+)+|$)(?:\\n\\^(\\d{13}))?" str = "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d.|[-+*]|#{1,6}))?(.+?) ?(:{2,3}) ?(.+?)((?: *#[\\p{Letter}-]+)+|$)(?:\\n\\^(\\d{13}))?"
this.cardsInlineStyle = new RegExp(str, "gim") this.cardsInlineStyle = new RegExp(str, flags)
// https://regex101.com/r/HOXF5E/1 // https://regex101.com/r/HOXF5E/1
str = "( {0,3}[#]*)((?:[^\\n]\\n?)+?)(#card-spaced)((?: *#[\\w-]+)*) *\\n?(?:\\^(\\d{13}))?" str = "( {0,3}[#]*)((?:[^\\n]\\n?)+?)(#card-spaced)((?: *#[\\p{Letter}-]+)*) *\\n?(?:\\^(\\d{13}))?"
this.cardsSpacedStyle = new RegExp(str, "gim") this.cardsSpacedStyle = new RegExp(str, flags)
)
} }
} }