From ce558c5ea8e9ab1365e963a417fd1c196509b92b Mon Sep 17 00:00:00 2001 From: Evgeny Metelkin Date: Thu, 5 Sep 2024 12:14:58 +0300 Subject: [PATCH] export array in Builder - draft --- export-formats.md | 22 ++++++++++++++++++++++ src/builder/declaration-schema.json | 14 ++++++++++++++ src/builder/index.js | 1 + src/templates/heta-code.heta.njk | 2 +- test/cases/0.js | 1 - 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/export-formats.md b/export-formats.md index c85896a1..92c791b9 100644 --- a/export-formats.md +++ b/export-formats.md @@ -14,6 +14,7 @@ Following [Heta specifications](specifications/) exporting to different formats - [Julia](#julia) - [Matlab](#matlab) - [DOT](#dot) +- [Summary](#summary) See also [Features support table](#features-support) @@ -387,6 +388,27 @@ Each namespace in separate file. }; ``` +## Summary + +Summarize model content and present statistics of the model components. It also can be used to debug the model. + +### Properties + +- + +### Output files + +**[filepath]/summary.md** : File storing model summary. + +**Example:** + +```heta +#export { + format: Summary, + filepath: summary, // save result in file "dist/summary.md" +}; +``` + ## Features support *na* means "not applicable" diff --git a/src/builder/declaration-schema.json b/src/builder/declaration-schema.json index 7465d9d7..a2989452 100644 --- a/src/builder/declaration-schema.json +++ b/src/builder/declaration-schema.json @@ -56,6 +56,20 @@ "sheet": { "type": "integer" }, "omitRows": { "type": "integer", "minimum": 0 } } + }, + "export": { + "type": "array", + "items": { + "type": "object", + "required": ["format"], + "additionalProperties": true, + "properties": { + "id": { "type": "string" }, + "format": { "type": "string" }, + "filepath": { "type": "string" }, + "spaceFilter": { "type": "string" } + } + } } } } diff --git a/src/builder/index.js b/src/builder/index.js index fd93e193..3e7b10c7 100644 --- a/src/builder/index.js +++ b/src/builder/index.js @@ -37,6 +37,7 @@ class Builder { constructor(declaration, coreDirname = '.'){ // create container this.container = new Container(); + this.export = []; // storing Export objects // set transport and logger this.logger = this.container.logger; diff --git a/src/templates/heta-code.heta.njk b/src/templates/heta-code.heta.njk index 066d4dbe..f41b321b 100644 --- a/src/templates/heta-code.heta.njk +++ b/src/templates/heta-code.heta.njk @@ -1,5 +1,5 @@ {#- - this.exportArray = []; + this.exportArray = [...]; this.unitDefStorage = [...]; this.namespaceStorage = [...]; -#} diff --git a/test/cases/0.js b/test/cases/0.js index b318f160..aa5b8375 100644 --- a/test/cases/0.js +++ b/test/cases/0.js @@ -48,7 +48,6 @@ describe('Testing "cases/0-hello-world"', () => { //console.log(b); }); - var exportArray = []; it('Run include', () => { b.run(); });