Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
linanwx committed Jul 23, 2023
1 parent afe560a commit a0ba2d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions cardSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ interface elem {
heading: string
}

function extractStrings(inputText: string): string[] {
const regex = /#[\/\w]+/gm;
return inputText.match(regex) || [];
}

// 默认的卡片搜索
// 搜索标签开头的一行,到该段落结束位置,该区域的内容被视为卡片Card的内容
class defaultCardSearch implements cardSearcher {
Expand Down Expand Up @@ -120,15 +125,16 @@ class defaultCardSearch implements cardSearcher {
// 匹配注释段
let cardText = result.all;
let index = result.start || 0;
let tags = TagParser.parse(result.heading);
let idTag = tags.findTag(CardIDTag);
let headingtags = TagParser.parse(result.heading);
let idTag = headingtags.findTag(CardIDTag);
let blockID = idTag?.Suffix || "";
let annotation = "";
if (blockID != "") {
annotation = AnnotationWrapper.findAnnotationWrapper(fileText, blockID);
}
let tags = extractStrings(cardText)
let content = result.content;
let card: Card = NewCard(cardText, content, annotation, blockID, index, note, tags.getStringArray());
let card: Card = NewCard(cardText, content, annotation, blockID, index, note, tags);
cards.push(card)
}
return cards
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "aosr",
"name": "Aosr",
"version": "1.0.36",
"version": "1.0.37",
"minAppVersion": "0.12.0",
"description": "Another obsidian spaced repetition",
"author": "linanwx",
Expand Down

0 comments on commit a0ba2d8

Please sign in to comment.