Skip to content

Commit

Permalink
fix: 🐛 Don't add Obsidian {{templates}} (fix #207)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Dec 14, 2021
1 parent d2b1fde commit 4762e13
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
23 changes: 12 additions & 11 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24508,7 +24508,7 @@ class MatrixView extends require$$0.ItemView {
return {
to,
cls: linkClass(this.app, to, realQ),
alt: this.getAlt(to, this.plugin.settings),
alt: this.getAlt(to),
order: this.getOrder(to),
parent,
};
Expand Down Expand Up @@ -24540,13 +24540,14 @@ class MatrixView extends require$$0.ItemView {
(_a = this.view) === null || _a === void 0 ? void 0 : _a.$destroy();
return Promise.resolve();
}
getAlt(node, settings) {
getAlt(node) {
const { altLinkFields } = this.plugin.settings;
let alt = null;
if (settings.altLinkFields.length) {
if (altLinkFields.length) {
const file = this.app.metadataCache.getFirstLinkpathDest(node, "");
if (file) {
const metadata = this.app.metadataCache.getFileCache(file);
settings.altLinkFields.forEach((altLinkField) => {
altLinkFields.forEach((altLinkField) => {
var _a;
alt = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.frontmatter) === null || _a === void 0 ? void 0 : _a[altLinkField];
});
Expand Down Expand Up @@ -25746,7 +25747,7 @@ function get_each_context_2$1(ctx, list, i) {
return child_ctx;
}

// (82:8) {#if step.value && settings.gridDots}
// (81:8) {#if step.value && settings.gridDots}
function create_if_block$3(ctx) {
let div;
let each_value_2 = lodash.range(Math.floor(/*wordCounts*/ ctx[2][/*step*/ ctx[24].value] / 1000));
Expand Down Expand Up @@ -25804,7 +25805,7 @@ function create_if_block$3(ctx) {
};
}

// (84:12) {#each range(Math.floor(wordCounts[step.value] / 1000)) as i}
// (83:12) {#each range(Math.floor(wordCounts[step.value] / 1000)) as i}
function create_each_block_2$1(ctx) {
let span;

Expand All @@ -25824,7 +25825,7 @@ function create_each_block_2$1(ctx) {
};
}

// (65:4) {#each allRuns[i] as step}
// (64:4) {#each allRuns[i] as step}
function create_each_block_1$3(ctx) {
let div1;
let div0;
Expand Down Expand Up @@ -25903,7 +25904,7 @@ function create_each_block_1$3(ctx) {
};
}

// (64:2) {#each transposedTrails as col, i}
// (63:2) {#each transposedTrails as col, i}
function create_each_block$5(ctx) {
let each_1_anchor;
let each_value_1 = /*allRuns*/ ctx[7][/*i*/ ctx[23]];
Expand Down Expand Up @@ -26048,8 +26049,7 @@ function instance$9($$self, $$props, $$invalidate) {
wordCounts
);
} catch(error) {
console.log(error);
console.log({ currFile });
console.log(error, { currFile });
$$invalidate(2, wordCounts[cell] = 0, wordCounts);
}
});
Expand Down Expand Up @@ -52180,7 +52180,8 @@ class BCPlugin extends require$$0.Plugin {
iterateHiers(userHiers, (hier, dir, field) => {
const values = this.parseFieldValue(frontm[field]);
values.forEach((target) => {
if (target.startsWith("<%") && target.endsWith("%>"))
if ((target.startsWith("<%") && target.endsWith("%>")) ||
(target.startsWith("{{") && target.endsWith("}}")))
return;
const targetOrder = this.getTargetOrder(frontms, target);
this.populateMain(mainG, basename, field, target, sourceOrder, targetOrder);
Expand Down
3 changes: 1 addition & 2 deletions src/Components/TrailGrid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
""
)?.stat.size;
} catch (error) {
console.log(error);
console.log({ currFile });
console.log(error, { currFile });
wordCounts[cell] = 0;
}
});
Expand Down
9 changes: 5 additions & 4 deletions src/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ export default class MatrixView extends ItemView {
return Promise.resolve();
}

getAlt(node: string, settings: BCSettings) {
getAlt(node: string): string | null {
const { altLinkFields } = this.plugin.settings;
let alt = null;
if (settings.altLinkFields.length) {
if (altLinkFields.length) {
const file = this.app.metadataCache.getFirstLinkpathDest(node, "");
if (file) {
const metadata = this.app.metadataCache.getFileCache(file);
settings.altLinkFields.forEach((altLinkField) => {
altLinkFields.forEach((altLinkField) => {
alt = metadata?.frontmatter?.[altLinkField];
});
}
Expand All @@ -90,7 +91,7 @@ export default class MatrixView extends ItemView {
return {
to,
cls: linkClass(this.app, to, realQ),
alt: this.getAlt(to, this.plugin.settings),
alt: this.getAlt(to),
order: this.getOrder(to),
parent,
};
Expand Down
6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,11 @@ export default class BCPlugin extends Plugin {
const values = this.parseFieldValue(frontm[field]);

values.forEach((target) => {
if (target.startsWith("<%") && target.endsWith("%>")) return;
if (
(target.startsWith("<%") && target.endsWith("%>")) ||
(target.startsWith("{{") && target.endsWith("}}"))
)
return;
const targetOrder = this.getTargetOrder(frontms, target);

this.populateMain(
Expand Down

0 comments on commit 4762e13

Please sign in to comment.