Skip to content

Commit

Permalink
fix: handle indented toggles
Browse files Browse the repository at this point in the history
Closes: #1303
Closes: #1292
  • Loading branch information
aalemayhu committed Sep 29, 2023
1 parent dc9a9d8 commit 99dbb78
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib/parser/DeckParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export class DeckParser {
return note.name.includes(avocado) || note.name.includes('🥑');
}

findIndentedToggleLists(dom: cheerio.Root): cheerio.Element[] {
const selector = '.page-body';
return dom(selector).toArray();
}

findToggleLists(dom: cheerio.Root): cheerio.Element[] {
const selector =
this.settings.isCherry || this.settings.isAll
Expand Down Expand Up @@ -181,7 +186,11 @@ export class DeckParser {
}

this.globalTags = dom('.page-body > p > del');
const toggleList = this.findToggleLists(dom);
const foundToggleLists = this.findToggleLists(dom);
let toggleList =
foundToggleLists.length > 0
? foundToggleLists
: this.findIndentedToggleLists(dom);
let cards: Note[] = [];

toggleList.forEach((t) => {
Expand Down

0 comments on commit 99dbb78

Please sign in to comment.