Project Docs Github
Log in
ittf site docs howtos t wizziapi introduction.html.ittf Edit
  • /ittf/site/docs/howtos/t/wizziapi/introduction.html.ittf
  • /ittf/site/docs/howtos/t/section.html.ittf
  • /ittf/site/docs/t/to-wizzi-package.html.ittf
  • /ittf/site/docs/t/high-code.html.ittf

/ittf/site/docs/howtos/t/wizziapi/introduction.html.ittf (primary)

edit
                                            
1 $group
2 $
3 var sect = {
4 title: 'Wizzi API'
5 };
6 section( §)
7 p To use the Wizzi API you need to install the
8 to-wizzi-package( wizzi )
9 + package locally in your project folder.
10 bash-panel
11 title Install the wizzi package
12 ittf
13 npm i wizzi
14 p All Wizzi Actions require an instance of the
15 high-code( WizziFactory )
16 + class.
17 js-panel
18 title Create a WizziFactory instance
19 ittf
20 import wizzi;
21 var wizziFactory = wizzi.createFactory({
22 repo: {
23 storeKind: 'filesystem'
24 },
25 plugins: {
26 pluginsBaseFolder: __dirname,
27 items: [
28 'wizzi-core',
29 'wizzi-js',
30 'wizzi-web'
31 ]
32 },
33 globalContext: {
34 author: 'Stefano'
35 }
36 }, function(err, wizziFactory) {
37 if (err) {
38 throw new Error(err.message);
39 }
40 // call wizziFactory methods
41 });
42 p Creation options cannot be modified. If you need to change the options
43 \b you have to create a new istance.
44 js-panel
45 title Execute a Load mTree action
46 ittf
47 wizziFactory.loadMTree (
48 path.join (__dirname, 'ittf', 'mysource.myschema.ittf'),
49 myContextObject,
50 function (err, loadedMTree) {
51 if (err) {
52 throw new Error(err.message);
53 }
54 // ... use the loadedMTree object
55 });
56 p Usually you don't need to load an mTree, the Wizzi Model Loader does it for you.
57 \b But, if needed, you can load and modify an mTree and then pass it
58 \b to the Wizzi Model Loader instead of the path to the source ITTF Document.
59 js-panel
60 title Execute a Load mTree buildup script action
61 ittf
62 wizziFactory.loadMTreeBuildUpScript (
63 path.join (__dirname, 'ittf', 'mysource.myschema.ittf'),
64 myContextObject,
65 function (err, loadedMTreeBuildUpScript) {
66 if (err) {
67 throw new Error(err.message);
68 }
69 // ... use the loadedMTreeBuildUpScript object
70 });
71 p You execute this action for debugging purposes. An mTree Debug Info
72 \b contains the source of the mTree build up script generated by the ITTF Process.
73 js-panel
74 title Execute a Load Wizzi Model Instance action
75 ittf
76 wizziFactory.loadModel (
77 'myschema', // schema name
78 path.join (__dirname, 'ittf', 'mysource.myschema.ittf'),
79 {
80 mTreeBuildUpContext: myContextObject,
81 formatOptions: {}
82 },
83 function (err, loadedModel) {
84 if (err) {
85 throw new Error(err.message);
86 }
87 // ... use the loadedModel object
88 });
89 p With this action you load a Wizzi Model Instance
90 \b that will be used as a context object in following actions.
91 js-panel
92 title Execute a Model Transformation action
93 ittf
94 wizziFactory.transformModel (
95 myLoadedModel, // Wizzi Model Instance
96 'myschema/mytransformer', // transformer name
97 myContextObject,
98 function (err, transformedModel) {
99 if (err) {
100 throw new Error(err.message);
101 }
102 // ... use the transformedModel object
103 });
104 p With this action you can extract from a Wizzi Model Instance
105 \b a modified instance or a POJO object to use as a context object in following actions.
106 js-panel
107 title Execute an Artifact Generation action
108 ittf
109 wizziFactory.generateArtifact (
110 artifactModel, // Wizzi Model Instance or POJO, the main generation context
111 path.join (__dirname, 'ittf', 'mysource.myschema.ittf'),
112 'myschema/myartifact', // artifact name
113 myContextObject,
114 function (err, artifactText) {
115 if (err) {
116 throw new Error(err.message);
117 }
118 // ... save or use the artifactText
119 });

/ittf/site/docs/howtos/t/section.html.ittf

edit
                                            
1 $group
2 $params §
3 article
4 . doc-title
5 id ${sect.id}
6 + ${sect.title}
7 . doc-summary
8 $hook

/ittf/site/docs/t/to-wizzi-package.html.ittf

edit
                                            
1 $group
2 $params name, kind|@@null
3 $
4 var xname = kind != 'nospace' ? ' ' + name + ' ' : name
5 a ${xname}
6 href https://github.com/stfnbssl/wizzi/tree/main/packages/${name}
7 target _blank

/ittf/site/docs/t/high-code.html.ittf

edit
                                            
1 $group
2 $params text, kind|@@null
3 $if kind != 'nospace'
4 span ${} ${}
5 code
6 class highlight-code
7 + ${text}
8 $if kind != 'nospace'
9 span ${} ${}
Save
Save & Refresh
Cancel