Skip to content

Commit

Permalink
Support space-separated frontmatter tags
Browse files Browse the repository at this point in the history
  • Loading branch information
pjeby committed Jul 8, 2021
1 parent 709d600 commit a10cd66
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "tag-wrangler",
"name": "Tag Wrangler",
"version": "0.4.5",
"version": "0.4.6",
"minAppVersion": "0.12.5",
"description": "Rename, merge, toggle, and search tags from the tag pane",
"isDesktopOnly": true
Expand Down
2 changes: 1 addition & 1 deletion src/File.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class File {
const field = node.toJSON();
if (!field || !field.length) continue;
if (typeof field === "string") {
const parts = field.split(/(\s*,\s*|^\s+|\s+$)/);
const parts = field.split(/([\s,]+)/);
const after = replace.inArray(parts, true).join("");
if (field != after) { parsed.set(prop, after); changed = true; }
} else if (Array.isArray(field)) {
Expand Down
2 changes: 2 additions & 0 deletions src/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export class Replacement {
this.inArray = (tags, skipOdd) => {
return tags.map((t, i) => {
if (skipOdd && (i & 1)) return t; // leave odd entries (separators) alone
// Obsidian allows spaces as separators within array elements
if (t.contains(" ")) return this.inArray(t.split(/( +)/), true).join("");
if (!t) return t;
if (cache[t]) return cache[t];
const lc = t.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"0.4.5": "0.12.5",
"0.4.6": "0.12.5",
"0.4.4": "0.11.13",
"0.4.1": "0.11.5",
"0.3.2": "0.10.13",
Expand Down

0 comments on commit a10cd66

Please sign in to comment.