Skip to content

Commit

Permalink
Version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
macrojd committed Feb 27, 2023
1 parent 8db9d8c commit 1a3adc3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The plugin includes the following three options to configure the style of the su
There are also two more options to determine how the plugin will process lists. If the options are enabled, the plugin will process each item of a list independently and include in the summary only the items that match the tags. If you want the plugin to process the entire list as a block of text, you can disable this options.

- List Items: Include only the items of a list that contain the tag(s), not the entire list.
- Include Child Items: Include the child items of a list item that contains the tag(s).
- Include Child Items: Include the child items of a list.

## Usage

Expand Down
43 changes: 24 additions & 19 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,17 @@ export default class SummaryPlugin extends Plugin {
listParagraphs.push(paragraph);
} else {
// Add paragraphs and the items of a list
let listText = "";
let listItems: string[] = Array();
let itemText = "";

paragraph.split('\n').forEach((line) => {
paragraph.split('\n\s*\n').forEach((line) => {
let isList = false;
isList = line.search(/(\s*[\-\+\*]){1}|([0-9]\.){1}\s+/) != -1

if (!isList) {
// Add normal paragraphs
listParagraphs.push(line);
listText = "";
itemText = "";
} else {
// Get the item's level
let level = 0;
Expand All @@ -204,28 +205,32 @@ export default class SummaryPlugin extends Plugin {
if (tabs) {
level = tabs.length;
}

// Add item
// Get items tree
if (level == 0) {
if (listText != "") {
listParagraphs.push(listText);
listText = "";
}
listTags = line.match(/#[\p{L}0-9_\-/#]+/gu);
if (listTags != null && listTags.length > 0) {
if (this.isValidText(listTags, tags, include, exclude)) {
listText = listText.concat(line + "\n");
}
if (itemText != "") {
listItems.push(itemText);
itemText = "";
}
} else if (this.settings.includechildren && level > 0 && listText != "") {
listText = listText.concat(line + "\n");
itemText = itemText.concat(line + "\n");
} else if (this.settings.includechildren && level > 0 && itemText != "") {
itemText = itemText.concat(line + "\n");
}
}
});
if (listText != "") {
listParagraphs.push(listText);
listText = "";
if (itemText != "") {
listItems.push(itemText);
itemText = "";
}

// Check tags on the items
listItems.forEach((line) => {
listTags = line.match(/#[\p{L}0-9_\-/#]+/gu);
if (listTags != null && listTags.length > 0) {
if (this.isValidText(listTags, tags, include, exclude)) {
listParagraphs.push(line);
}
}
});
}
}
})
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": "tag-summary-plugin",
"name": "Tag Summary",
"version": "2.0.0",
"version": "2.1.0",
"minAppVersion": "0.12.0",
"description": "This plugin creates summaries with paragraphs or blocks of text that share the same tag(s).",
"author": "J.D Gauchat",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tag-summary-plugin",
"version": "2.0.0",
"version": "2.1.0",
"description": "This plugin creates summaries with paragraphs or blocks of text that share the same tag(s).",
"main": "main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class SummarySettingTab extends PluginSettingTab {
);
new Setting(containerEl)
.setName("Include Child Items")
.setDesc("Include the child items of a list item that contains the tag.")
.setDesc("Include the child items of a list.")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.includechildren)
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"1.0.1": "0.12.0",
"1.1.0": "0.12.0",
"1.2.0": "0.12.0",
"2.0.0": "0.12.0"
"2.0.0": "0.12.0",
"2.1.0": "0.12.0"
}

0 comments on commit 1a3adc3

Please sign in to comment.