Skip to content

Commit

Permalink
Fix problem with multi word tag in brace
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Colucci committed Jan 27, 2021
1 parent 5bceebb commit bb25cd6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "flashcards-obsidian",
"name": "Flashcards",
"version": "1.1.3",
"version": "1.1.4",
"minAppVersion": "0.9.17",
"description": "Anki integration",
"author": "Alex Colucci",
Expand Down
8 changes: 4 additions & 4 deletions src/services/cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class CardsService {

public async deckNeedToBeChanged(cardsIds : number[], deckName: string) {
let cardsInfo = await this.anki.cardsInfo(cardsIds)
console.log("cards infoooooo")
console.log("Flashcards: Cards info")
console.log(cardsInfo)
if (cardsInfo.length !== 0) {
return cardsInfo[0].deckName !== deckName
Expand Down Expand Up @@ -319,13 +319,13 @@ export class CardsService {

let tags = file.match(/(?:cards-)?tags: ?(.*)/im)
if (tags) {
globalTags = tags ? tags[1].split(/,|-| /) : []
globalTags = globalTags.filter(item => item)

globalTags = tags ? tags[1].match(/\[\[(.*?)\]\]|#(\w+)|(\w+)/gmi) : []

for (let i = 0; i < globalTags.length; i++) {
globalTags[i] = globalTags[i].replace("#", "")
globalTags[i] = globalTags[i].replace(/\[\[(.*)\]\]/, '$1')
globalTags[i] = globalTags[i].trim()
globalTags[i] = globalTags[i].replace(/ /g, "-")
}
}

Expand Down

0 comments on commit bb25cd6

Please sign in to comment.