Skip to content

Commit

Permalink
Merge branch 'main' into SDTT-337-Introduce-a-new-status-for-each-ent…
Browse files Browse the repository at this point in the history
…ity-in-the-vocabulary-overview
  • Loading branch information
KristofVDB1 authored Sep 24, 2024
2 parents 8c60530 + 2691152 commit 80f0990
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 15 additions & 9 deletions packages/oslo-generator-html/lib/HtmlGenerationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import { SpecificationType } from './utils/specificationTypeEnum';
export class HtmlGenerationService implements IService {
public readonly logger: Logger;
public readonly configuration: HtmlGenerationServiceConfiguration;
public dirs: string[] = [];

public constructor(
@inject(ServiceIdentifier.Logger) logger: Logger,
@inject(ServiceIdentifier.Configuration)
config: HtmlGenerationServiceConfiguration,
config: HtmlGenerationServiceConfiguration
) {
this.logger = logger;
this.configuration = config;
}

public async init(): Promise<void> {
const dirs: string[] = [resolve(`${__dirname}/templates`)];
if (this.configuration.templates) {
let templatesPath = this.configuration.templates;

Expand All @@ -32,25 +32,31 @@ export class HtmlGenerationService implements IService {
}

const customTemplatesDir: string = resolve(templatesPath);
dirs.push(customTemplatesDir);
this.dirs.push(customTemplatesDir);
} else {
this.dirs.push(resolve(`${__dirname}/templates`));
}

const env = nj.configure(dirs);
const env = nj.configure(this.dirs);
env.addGlobal('getAnchorTag', this.getAnchorTag);
}

public async run(): Promise<void> {
let indexPath: string = '';
const [config, stakeholders, metadata] = await Promise.all([
this.readConfigFile(this.configuration.input),
this.readConfigFile(this.configuration.stakeholders),
this.readConfigFile(this.configuration.metadata),
]);

const indexPath =
this.configuration.rootTemplate ||
(this.configuration.specificationType === SpecificationType.Vocabulary
? 'voc2.j2'
: 'ap2.j2');
if (this.configuration.templates && this.configuration.rootTemplate) {
indexPath = `${this.dirs[0]}/${this.configuration.rootTemplate}`;
} else {
indexPath =
this.configuration.specificationType === SpecificationType.Vocabulary
? `${this.dirs[0]}/voc2.j2`
: `${this.dirs[0]}/ap2.j2`;
}

let data: any = {};

Expand Down
2 changes: 1 addition & 1 deletion packages/oslo-generator-html/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oslo-flanders/html-generator",
"version": "0.0.19-alpha.0",
"version": "0.0.21-alpha.0",
"description": "Generates an HTML file using an OSLO webuniversum config",
"author": "Digitaal Vlaanderen <https://data.vlaanderen.be/id/organisatie/OVO002949>",
"homepage": "https://github.com/informatievlaanderen/OSLO-UML-Transformer/tree/main/packages/oslo-generator-html#readme",
Expand Down

0 comments on commit 80f0990

Please sign in to comment.