diff --git a/manifest.json b/manifest.json index ba8891e..419b86a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "flashcards-obsidian", "name": "Flashcards", - "version": "1.1.9", + "version": "1.2.0", "minAppVersion": "0.9.17", "description": "Anki integration", "author": "Alex Colucci", diff --git a/src/entities/inlinecard.ts b/src/entities/inlinecard.ts index 1d56422..d818cd5 100644 --- a/src/entities/inlinecard.ts +++ b/src/entities/inlinecard.ts @@ -3,8 +3,8 @@ import { Card } from "src/entities/card"; export class Inlinecard extends Card { constructor(id: number = -1, deckName: string, initialContent: string, fields: Record, reversed: boolean, endOffset: number, tags: string[] = [], inserted: boolean = false, mediaNames: string[], containsCode: boolean) { - super(id, deckName, initialContent, fields, reversed, endOffset, tags, inserted, mediaNames, containsCode) - this.modelName = `Obsidian-basic` + super(id, deckName, initialContent, fields, reversed, endOffset, tags, inserted, mediaNames, [], containsCode) // ! CHANGE [] + this.modelName = this.reversed ? `Obsidian-basic-reversed` : `Obsidian-basic` if (fields["Source"]) { this.modelName += sourceDeckExtension } diff --git a/src/regex.ts b/src/regex.ts index 4d30c4e..d9d2b3a 100644 --- a/src/regex.ts +++ b/src/regex.ts @@ -33,7 +33,7 @@ export class Regex { this.flashscardsWithTag = new RegExp(str, "gim") // https://regex101.com/r/DEVfyh/2 - str = "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d.|[-+*]|#{1,6}))?(.+) ?:{2} ?(.+?)((?: *#[\\w-]+)+|$)(?:\\n\\^(\\d{13}))?" + str = "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d.|[-+*]|#{1,6}))?(.+?) ?(:{2,3}) ?(.+?)((?: *#[\\w-]+)+|$)(?:\\n\\^(\\d{13}))?" this.cardsInlineStyle = new RegExp(str, "gim") // https://regex101.com/r/HOXF5E/1 diff --git a/src/services/parser.ts b/src/services/parser.ts index be0a92a..aaa947b 100644 --- a/src/services/parser.ts +++ b/src/services/parser.ts @@ -133,7 +133,7 @@ export class Parser { continue } - let reversed: boolean = false + let reversed: boolean = match[3].trim().toLowerCase() === ':::' let headingLevel = -1 if (match[1]) { headingLevel = match[1].trim().length !== 0 ? match[1].trim().length : -1 @@ -143,16 +143,16 @@ export class Parser { let originalQuestion = match[2].trim() let question = contextAware ? [...context, match[2].trim()].join(`${this.settings.contextSeparator}`) : match[2].trim() - let answer = match[3].trim() + let answer = match[4].trim() let imagesMedia: string[] = this.getImageLinks(question) imagesMedia = imagesMedia.concat(this.getImageLinks(answer)) question = this.parseLine(question, vault) answer = this.parseLine(answer, vault) let endingLine = match.index + match[0].length - let tags: string[] = this.parseTags(match[4], globalTags) - let id: number = match[5] ? Number(match[5]) : -1 - let inserted: boolean = match[5] ? true : false + let tags: string[] = this.parseTags(match[5], globalTags) + let id: number = match[6] ? Number(match[6]) : -1 + let inserted: boolean = match[6] ? true : false let fields: any = { "Front": question, "Back": answer } if (this.settings.sourceSupport) { fields["Source"] = note