diff --git a/manifest.json b/manifest.json index 419b86a..f6c513e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "flashcards-obsidian", "name": "Flashcards", - "version": "1.2.0", + "version": "1.2.1", "minAppVersion": "0.9.17", "description": "Anki integration", "author": "Alex Colucci", diff --git a/src/regex.ts b/src/regex.ts index a30dbc3..1e8e98b 100644 --- a/src/regex.ts +++ b/src/regex.ts @@ -7,6 +7,7 @@ export class Regex { codeBlock: RegExp cardsDeckLine: RegExp cardsToDelete: RegExp + globalTagsSplitter: RegExp flashscardsWithTag: RegExp cardsInlineStyle: RegExp cardsSpacedStyle: RegExp @@ -24,9 +25,12 @@ export class Regex { this.markdownImageLinks = /!\[\]\((.*\.(?:png|jpg|jpeg|gif|bmp|svg|tiff)).*?\)/gim this.codeBlock = /]*>(.*?)<\/code>/gims - this.cardsDeckLine = /cards-deck: [\w\d]+/gi + this.cardsDeckLine = /cards-deck: [\p{L}]+/giu this.cardsToDelete = /^\s*(?:\n)(?:\^(\d{13}))(?:\n\s*?)?/gm + // https://regex101.com/r/IS2gjL/1 + this.globalTagsSplitter = /\[\[(.*?)\]\]|#([\p{L}:\/-]+)|([\p{L}:]+)/gmiu + // Cards // https://regex101.com/r/p3yQwY/2 let str = "( {0,3}[#]*)((?:[^\\n]\\n?)+?)(#" + settings.flashcardsTag + "(?:-reverse)?)((?: *#[\\w-]+)*) *?\\n+((?:[^\\n]\\n?)*?(?=\\^\\d{13}|$))(?:\\^(\\d{13}))?" diff --git a/src/services/cards.ts b/src/services/cards.ts index 09c6937..adf7a7b 100644 --- a/src/services/cards.ts +++ b/src/services/cards.ts @@ -318,7 +318,7 @@ export class CardsService { let globalTags: string[] = [] let tags = file.match(/(?:cards-)?tags: ?(.*)/im) - globalTags = tags ? tags[1].match(/\[\[(.*?)\]\]|#([\w:\/-]+)|([\w:]+)/gmi) : [] + globalTags = tags ? tags[1].match(this.regex.globalTagsSplitter) : [] if (globalTags) { for (let i = 0; i < globalTags.length; i++) {