Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiword tag #178

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"id": "bibnotes",
"name": "BibNotes Formatter",
"version": "0.9.219",
"version": "0.9.220",
"minAppVersion": "0.12.0",
"description": "Plugin to import and format annotations from Zotero.",
"author": "Stefano Pagliari",
"authorUrl": "https://www.stefanopagliari.net",
"isDesktopOnly": true,
"repo": "stefanopagliari/bibnotes"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bibnotes",
"version": "0.9.219",
"version": "0.9.220",
"description": "Plugin to export and format annotations from Zotero into Obsidian",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -30,4 +30,4 @@
"tslint": "^6.1.3",
"turndown": "^7.1.1"
}
}
}
4 changes: 2 additions & 2 deletions release/bibnotes/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@ function replaceTemplate(stringAdd, find, replace) {
}
var makeWiki = (str) => "[[" + str + "]]";
var makeQuotes = (str) => '"' + str + '"';
var makeTags = (str) => "#" + str;
var makeTags = (str) => "#" + str.replace(/\s+/g, '_');
var createAuthorKey = (creators) => {
const authorKey = [];
const editorKey = [];
Expand Down Expand Up @@ -5144,7 +5144,7 @@ var MyPlugin = class extends import_obsidian6.Plugin {
}
if (this.settings.isTagHash == true) {
for (let index = 0; index < lineElements.inlineTagsArray.length; index++) {
lineElements.inlineTagsArray[index] = lineElements.inlineTagsArray[index].replace(/ /g, "");
lineElements.inlineTagsArray[index] = lineElements.inlineTagsArray[index].replace(/ /g, "_");
}
}
const TempTag = lineElements.inlineTagsArray.map((i2) => tagPrepend + tagFormatBefore + i2 + tagFormatAfter);
Expand Down
5 changes: 2 additions & 3 deletions release/bibnotes/manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"id": "bibnotes",
"name": "BibNotes Formatter",
"version": "0.9.219",
"version": "0.9.220",
"minAppVersion": "0.12.0",
"description": "Plugin to import and format annotations from Zotero.",
"author": "Stefano Pagliari",
"authorUrl": "https://www.stefanopagliari.net",
"isDesktopOnly": true,
"repo": "stefanopagliari/bibnotes"
}
}
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,8 @@ export default class MyPlugin extends Plugin {

if (this.settings.isTagHash == true) {
for (let index = 0; index < lineElements.inlineTagsArray.length; index++) {
lineElements.inlineTagsArray[index] = lineElements.inlineTagsArray[index].replace(/ /g, "")
// lineElements.inlineTagsArray[index] = lineElements.inlineTagsArray[index].replace(/ /g, "")
lineElements.inlineTagsArray[index] = lineElements.inlineTagsArray[index].replace(/ /g, "_")
}
//{}
}
Expand Down
6 changes: 5 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ export function replaceTemplate(

export const makeWiki = (str: string) => "[[" + str + "]]";
export const makeQuotes = (str: string) => '"' + str + '"';
export const makeTags = (str: string) => "#" + str;
// export const makeTags = (str: string) => "#" + str;
// replace in-tag spaces with a underscore (add tag format settings in config later)
// I assume str is tag from zotero item or PDF note as-it-is
export const makeTags = (str: string) => "#" + str.replace(/\s+/g, '_');


export const createAuthorKey = (creators: CreatorArray) => {
const authorKey: string[] = [];
Expand Down