mirror of
https://github.com/gosticks/flashcards-obsidian.git
synced 2025-10-16 12:05:33 +00:00
parent
d1302edd87
commit
0114d4881e
@ -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",
|
||||
|
||||
@ -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\b[^>]*>(.*?)<\/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}))?"
|
||||
|
||||
@ -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++) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user