Skip to content

Commit

Permalink
move template dir
Browse files Browse the repository at this point in the history
  • Loading branch information
brianorwhatever committed Oct 6, 2023
1 parent a10b062 commit 6d7c36a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aviarytech/tev2-hrgt",
"version": "0.0.6",
"version": "0.0.7",
"description": "Human Readable Glossary Tool (HRGT)",
"main": "lib/Run.js",
"types": "lib/Run.d.ts",
Expand Down
9 changes: 5 additions & 4 deletions src/Generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,27 @@ export class Generator {
private glossary!: Glossary;
private entries: Entry[];
private htmlOutput!: string;
private template: string;

public constructor({
method,
scopedir,
input,
output,
template,
}: {
method: any;
scopedir: string;
input: string;
output: string;
template: string;
}) {
this.entries = [];
this.method = method;
this.scopedir = scopedir;
this.inputGlob = input;
this.outputName = output;
this.template = template;
log.info(
`Using ${this.method} method with MRG ${
this.inputGlob ?? "(from SAF scope.mrgfile)"
Expand Down Expand Up @@ -77,10 +81,7 @@ export class Generator {

private async generateHTML(): Promise<void> {
try {
const templateFile = fs.readFileSync(
"./assets/hrg-template.mustache",
"utf8"
);
const templateFile = fs.readFileSync(this.template, "utf8");
const template = Handlebars.compile(templateFile);
this.htmlOutput = template({ entries: this.entries });
} catch (error) {
Expand Down
5 changes: 5 additions & 0 deletions src/Run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ program
"-t, --termselcriteria",
"List of term selection criteria that are used to generate"
)
.option(
"-te, --template",
"Path (including the filename) of the mustache template file"
)
.option(
"-m, --method",
"The method that is used to create the output (default HTML)"
Expand Down Expand Up @@ -96,6 +100,7 @@ async function main(): Promise<void> {
scopedir: options.scopedir ?? ".",
input: options.input,
output: options.output ?? "default",
template: options.template ?? "template.mustache",
});

// Resolve terms
Expand Down
File renamed without changes.

0 comments on commit 6d7c36a

Please sign in to comment.