Skip to content

Commit

Permalink
feat: adding new tp.config module
Browse files Browse the repository at this point in the history
Contains Templater running config, might be useful for scripts
  • Loading branch information
SilentVoid13 committed May 1, 2021
1 parent 3eefb37 commit 39c224a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/InternalTemplates/InternalTemplateParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { InternalModuleWeb } from "./web/InternalModuleWeb";
import { InternalModuleFrontmatter } from "./frontmatter/InternalModuleFrontmatter";
import { InternalModuleSystem } from "./system/InternalModuleSystem";
import { RunningConfig } from "Templater";
import { InternalModuleConfig } from "./config/InternalModuleConfig";

export class InternalTemplateParser implements TParser {
private modules_array: Array<InternalModule> = new Array();
Expand All @@ -19,6 +20,7 @@ export class InternalTemplateParser implements TParser {
this.modules_array.push(new InternalModuleWeb(this.app, this.plugin));
this.modules_array.push(new InternalModuleFrontmatter(this.app, this.plugin));
this.modules_array.push(new InternalModuleSystem(this.app, this.plugin));
this.modules_array.push(new InternalModuleConfig(this.app, this.plugin));
}

async init(): Promise<void> {
Expand Down
14 changes: 14 additions & 0 deletions src/InternalTemplates/config/InternalModuleConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { InternalModule } from "InternalTemplates/InternalModule";
import { RunMode, RunningConfig } from "Templater";

export class InternalModuleConfig extends InternalModule {
public name: string = "config";

async createStaticTemplates(): Promise<void> {}

async updateTemplates(): Promise<void> {}

async generateContext(config: RunningConfig): Promise<{[x: string]: any}> {
return config;
}
}
2 changes: 1 addition & 1 deletion src/Templater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class Templater {
return {
template_file: template_file,
target_file: target_file,
run_mode: RunMode.CreateNewFromTemplate,
run_mode: run_mode,
}
}

Expand Down

0 comments on commit 39c224a

Please sign in to comment.