Skip to content

Commit

Permalink
version 1.1.0 final best testing
Browse files Browse the repository at this point in the history
  • Loading branch information
djsudduth committed Mar 9, 2024
1 parent c9a3ec9 commit 8bcc3b0
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## not released

## v1.1.0 (2024-03-09)

- Added a dialog box to set the extraction keyword and tag
- Added selection to extract at the folder level vs selecting individual notes

## v1.0.0 (2024-02-08)

- First version
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ Any Joplin tags in the source notes will be combined as Joplin tags in the extra

Go to `Tools > Options > Paragraph Extractor`

- `Preserve Source Note Titles`: Titles of source notes will be embedded in new note. Default `true`.
- `Preserve source note titles with backlinks`: Titles of source notes will be embedded in new note with links back to the original source notes. Default `true`.
- `Extract content at the bulleted list item level`: Bullets will be extracted at the top bullet level (including sub-bullets) vs all bullets within a paragraph. Default `false`
- `Ignore the keyword case`: Any case for the keyword or hashtag keyword will be used for extraction. Default `false`
- `Include the header of the section extracted`: Any H1-H6 header will be included with the extracted paragraph or bullet (this is ignored for keywords embedded within the header which are always extracted). Default `false`
- `Tag Prefix character`: Either the common hashtag # character (preferred) or $, %. Default `none`
- `Paragraph Tag or Keyword`: The entered keyword to search in notes to extract the paragraph. If the prefix hashtag field is set, then the tag is added to the keyword for finding paragraph blocks.
- `Default or Last Used Tag Prefix character`: Either the common hashtag # character (preferred) or $, %. Default `#`
- `Default of Last Used Paragraph Tag or Keyword`: The entered keyword to search in notes to extract the paragraph. If the prefix hashtag field is set, then the tag is added to the keyword for finding paragraph blocks.
- `Remove extracted paragraph keyword and add end tag`: Any tagged/hashtagged keyword will be removed from the paragraph and an endtag will be addedin the new extraction note. Removal assumes the prefix character is entered. End tag is added always. Default `false`
- `Title of the combined note`: New title of the combined note. Default `Extracted paragraphs`.
- `Custom note title`: New note title with possible variables `{{FIRSTTITLE}}`, `{{LASTTITLE}}`, `{{ALLTITLE}}` and `{{DATE}}`.
Expand All @@ -56,3 +56,7 @@ See [BUILD](BUILD.md)
## Changelog

See [Changelog](CHANGELOG.md)

## Thanks

Special thanks to [Jack Gruber](https://github.com/JackGruber) for the inspiration and excellent code to help bootstrap this plugin!
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "joplin-plugin-paragraph-extractor",
"version": "1.0.0",
"version": "1.1.0",
"scripts": {
"prepare": "npm run dist && husky install",
"dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
Expand Down
27 changes: 14 additions & 13 deletions src/extractParagraphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace extractParagraphs {
tname +
`"/>
<br/>
<input type="checkbox" id="pfolder" name="pfolder" value="true">
<label for="pfolder">All files within this folder:</label><br />
<input type="checkbox" id="ckbfolder" name="ckbfolder" value="true">
<label for="ckbfolder">All files within this folder</label><br />
</form>
`
);
Expand Down Expand Up @@ -88,23 +88,26 @@ namespace extractParagraphs {
return;
}
const fresults = extract.formData["extract"];
const ckfolder = fresults["pfolder"];
const ckbfolder = fresults["ckbfolder"];
let tagName = fresults["keyword"];
let tagPrefix = fresults["tag"];
if (tagName === "") {
return;
}

// Save the last search
await extractParagraphs.setform(tagPrefix, tagName);
let ids = [];
if (ckfolder === "true") {
let nfolder = await joplin.workspace.selectedFolder();
const jnotes = await fetchAllItems(["search"], {
query: `notebook:"${nfolder.title}"`,
fields: ["id"],
if (ckbfolder === "true") {
let sfolder = await joplin.workspace.selectedFolder();
const folder_notes = await fetchAllItems(["search"], {
query: `notebook:"${sfolder.title}"`,
fields: ["id", "parent_id"],
}); //, "title", "body"]});
for (const jnote of jnotes) {
ids.push(jnote.id);
for (const fnote of folder_notes) {
if (fnote.parent_id === sfolder.id) {
ids.push(fnote.id);
}
}
} else {
ids = await joplin.workspace.selectedNoteIds();
Expand All @@ -117,6 +120,7 @@ namespace extractParagraphs {
let listTags = [];
let tagPages = {};

// Save the last keyword extraction values in defaults
await joplin.settings.setValue("tagName", tagName);
await joplin.settings.setValue("tagPrefix", tagPrefix);

Expand All @@ -130,7 +134,6 @@ namespace extractParagraphs {
"extractAtBulletLevel"
);
const ignoreCase = await joplin.settings.value("ignoreCase");

const includeHeaders = await joplin.settings.value("includeHeaders");

const dateFormat = await joplin.settings.globalValue("dateFormat");
Expand Down Expand Up @@ -259,8 +262,6 @@ namespace extractParagraphs {
p.replaceAll(regex, "").replace(/\s{2,}/g, " ") + "\n"
);
} else {
//newNoteBody.push(JSON.stringify(jnotes) + "\n" + p + "\n");
// newNoteBody.push(jids + "\n" + p + "\n");
newNoteBody.push(p + "\n");
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/locales/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"settings.ignoreCaseDescription": "Alle Notizen werden nach dem Schlüsselwort in beliebiger Kombination aus Groß- und Kleinschreibung durchsucht",
"settings.includeHeaders": "Fügen Sie die Überschrift des extrahierten Absatzes ein",
"settings.includeHeadersDescription": "Der H1-, H2- usw. Header ist in der zugrunde liegenden Extraktion enthalten (wenn ein Schlüsselwort im Header enthalten ist, wird es ignoriert).",
"settings.tagName": "Absatz-Tag oder Schlüsselwort",
"settings.tagNameDescription": "Hashtag oder Schlüsselwort, das in den Absätzen verwendet wird.",
"settings.tagPrefix": "Tag-Präfixzeichen",
"settings.tagPrefixDescription": "Präfix für Hashtags oder beliebige benutzerdefinierte Tags",
"settings.preserveSourceNoteTitles": "Titel der Quellnotizen beibehalten",
"settings.preserveSourceNoteTitlesDescription": "Behält die Titel der Orginal Notizen bei, indem diese im Notiztext eingefügt werden.",
"settings.tagName": "Standard- oder zuletzt verwendetes Absatz-Tag oder Schlüsselwort",
"settings.tagNameDescription": "Standardmäßiger oder zuletzt verwendeter Schlüsselwort- oder Hashtag-Text (ohne Präfix), der in den Absätzen verwendet wird.",
"settings.tagPrefix": "Standard- oder zuletzt verwendetes Tag-Präfixzeichen",
"settings.tagPrefixDescription": "Standard- oder zuletzt verwendetes Präfix für Hashtags oder benutzerdefinierte Tags – # wird bevorzugt, aber % oder $ können verwendet werden.",
"settings.preserveSourceNoteTitles": "Behalten Sie die Titel der Quellnotizen mit Backlinks bei",
"settings.preserveSourceNoteTitlesDescription": "Behält Titel und Links zurück zu ausgewählten Notizen im kombinierten Notiztext bei.",
"settings.combinedNoteTitle": "Titel der extrahierten Absatznotiz",
"settings.combinedNoteTitleValueDefault": "Extrahierte Absätze",
"settings.combinedNoteTitleValueCombined": "Kombination aus allen Notiztitel",
Expand Down
12 changes: 6 additions & 6 deletions src/locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"settings.ignoreCaseDescription": "All notes will be searched for the keyword in any upper or lower case mix",
"settings.includeHeaders": "Include the header of the paragraph extracted",
"settings.includeHeadersDescription": "The H1, H2, etc header will be included with the underlying extraction (if keyword included in header, this is ignored)",
"settings.tagName": "Paragraph Tag or Keyword",
"settings.tagNameDescription": "Keyword or hashtag text (without prefix) used within the paragraphs.",
"settings.tagPrefix": "Tag Prefix character",
"settings.tagPrefixDescription": "Prefix for hashtags or any custom tags - # is preferred but % or $ can be used.",
"settings.preserveSourceNoteTitles": "Preserve source note titles",
"settings.preserveSourceNoteTitlesDescription": "Preserves titles of selected notes within the combined note body",
"settings.tagName": "Default or Last Used Paragraph Tag or Keyword",
"settings.tagNameDescription": "Default or last used keyword or hashtag text (without prefix) used within the paragraphs.",
"settings.tagPrefix": "Default or Last Used Tag Prefix Character",
"settings.tagPrefixDescription": "Default or last used prefix for hashtags or any custom tags - # is preferred but % or $ can be used.",
"settings.preserveSourceNoteTitles": "Preserve source note titles with back links",
"settings.preserveSourceNoteTitlesDescription": "Preserves titles and links back to selected notes within the combined note body",
"settings.combinedNoteTitle": "Title of the extracted paragraphs note",
"settings.combinedNoteTitleValueDefault": "Extracted paragraphs",
"settings.combinedNoteTitleValueCombined": "Combination of all note titles",
Expand Down

0 comments on commit 8bcc3b0

Please sign in to comment.