Skip to content

Commit

Permalink
Fix #1 - use ctx.sourcePath to get the frontmatter data
Browse files Browse the repository at this point in the history
  • Loading branch information
joleaf committed Jan 12, 2023
1 parent 501a115 commit ce145c0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All changes to this plugin are listed here.

## 0.1.4 (2023-01-12)

### Fixed

- #1 use `ctx.sourcePath` to get the frontmatter data

## 0.1.3 (2023-01-01)

### Changed
Expand Down
16 changes: 13 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,19 @@ export default class ObsidianDmnEvalPlugin extends Plugin {
parameters.url = this.app.vault.adapter.basePath + "/" + parameters.url;

let dmnParams = '"' + parameters.url + '" ' + parameters.decisionid;
// @ts-ignore
for (const [key, value] of Object.entries(app.metadataCache.getFileCache(app.workspace.getActiveFile()!)?.frontmatter)) {
dmnParams += ' "' + key + '" "' + value + '"';
const sourceFile = this.app.metadataCache.getFirstLinkpathDest(
ctx.sourcePath,
ctx.sourcePath,
);
if (sourceFile != null) {
const sourceCache = this.app.metadataCache.getFileCache(sourceFile);
if (sourceCache != null) {
if (sourceCache.frontmatter != undefined) {
for (const [key, value] of Object.entries(sourceCache.frontmatter)) {
dmnParams += ' "' + key + '" "' + value.toString() + '"';
}
}
}
}
let path = this.getPluginPath();
const parameterCopy = parameters;
Expand Down

0 comments on commit ce145c0

Please sign in to comment.