-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from UdK-VPT/v1.0_docs_examples
V1.0 docs examples
- Loading branch information
Showing
58 changed files
with
375 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This is the main control file of a generator. | ||
# It follows the syntax defined by pythons configparser module. | ||
# More information: https://docs.python.org/3/library/configparser.html | ||
|
||
# The GENERATOR section defines the main attributes of this generator. | ||
# The combination of name and version must be unique in your generator path. | ||
[GENERATOR] | ||
name = Example01Mako | ||
version = 1.0 | ||
description = Example using the default mako engine | ||
author = Joerg Raedler [email protected] | ||
|
||
# The LOADER section defines the used loader name and version. | ||
# This loader must exist in the CoTeTo.Loaders package or must be included | ||
# in the generator (see ExampleCustomLoader). | ||
# This example just uses a dummy loader that generates some useless data items and does not need any input! | ||
[LOADER] | ||
name = TestDummy | ||
minVer = 0.1 | ||
maxVer = 2.0 | ||
|
||
# The optional FILTER section defines a module and function to manipulate the | ||
# data received from the loader before it is ued in the templates. | ||
[FILTER] | ||
module = MyFilter | ||
function = myfilter | ||
|
||
# The TEMPLATE section defines the file name of the main template. | ||
# mako is the default engine, but you can use jinja2 instead. | ||
# To output more than one file you can use multiple sections with different names, | ||
# see ExampleMultiOutput for details. | ||
[TEMPLATE] | ||
topFile = Main.mako | ||
type = mako | ||
|
||
# All other sections and entries will be ignored by the CoTeTo system, but you can | ||
# store information here which is available in custom loaders, filters and templates. | ||
# See ExampleCustomEntries for details. | ||
[MYCUSTOMSETTINGS] | ||
answer = 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# The following objects can be used in templates: | ||
# | ||
# systemCfg - dictionary with information on the system and the environment | ||
# Keys: ${' '.join(systemCfg.keys())} | ||
# CoTeToVersion: ${systemCfg['version']} | ||
# CoTeToPath: ${systemCfg['path']} | ||
# Platform: ${systemCfg['platform']} | ||
# FullPlatform: ${systemCfg['fullplatform']} | ||
# Hostname: ${systemCfg['hostname']} | ||
# Username: ${systemCfg['username']} | ||
# GeneratorPath: ${', '.join(systemCfg['generatorPath'])} | ||
# | ||
# the following are functions and need to be executed: | ||
# Timestamp: ${systemCfg['timestamp']()} | ||
# Infostamp: ${systemCfg['infostamp']()} | ||
# | ||
# generatorCfg - configparser object with information on the used generator | ||
# (this is basically the contents of the Package.inf file) | ||
# Sections: ${' '.join(generatorCfg.keys())} | ||
# Name: ${generatorCfg['GENERATOR'].get('name')} | ||
# Version: ${generatorCfg['GENERATOR'].get('version')} | ||
# | ||
# access to custom sections and values is also possible: | ||
# Answer: ${generatorCfg['MYCUSTOMSETTINGS'].getint('answer')} | ||
# | ||
# logger - an object to send logging messages | ||
# this will output None, but log a message: ${logger.info('The answer is 42!')} | ||
# suppress the output with this trick: ${logger.warning('But what was the question?') or ''} | ||
# | ||
# d - the data object read from the loader and (optionally) manipulated by the filter | ||
# (this is usually a dictionary of the form filename : data_items, | ||
# but this depends on the loader and filter code) | ||
# Keys (Filenames/URIs): ${' '.join(d.keys())} | ||
|
||
The value of foo is ${d['dummy']['foo']}. Please notice this value was manipulated by a filter function. | ||
|
||
## Templates can be splitted and included: | ||
<%include file="Sub.mako"/> |
2 changes: 1 addition & 1 deletion
2
Generators/TestMako/Templates/Sub.mako → Generators/Example01Mako/Templates/Sub.mako
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Hello, I'm a sub template! | ||
bar = ${d['dummy']['bar']} | ||
bar = ${d['dummy']['bar']} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This is the main control file of a generator. | ||
# It follows the syntax defined by pythons configparser module. | ||
# More information: https://docs.python.org/3/library/configparser.html | ||
|
||
# The GENERATOR section defines the main attributes of this generator. | ||
# The combination of name and version must be unique in your generator path. | ||
[GENERATOR] | ||
name = Example02Jinja2 | ||
version = 1.0 | ||
description = Example using the alternative jinja2 engine | ||
author = Joerg Raedler [email protected] | ||
|
||
# The LOADER section defines the used loader name and version. | ||
# This loader must exist in the CoTeTo.Loaders package or must be included | ||
# in the generator (see ExampleCustomLoader). | ||
# This example just uses a dummy loader that generates some useless data items and does not need any input! | ||
[LOADER] | ||
name = TestDummy | ||
minVer = 0.1 | ||
maxVer = 2.0 | ||
|
||
# The optional FILTER section defines a module and function to manipulate the | ||
# data received from the loader before it is ued in the templates. | ||
[FILTER] | ||
module = MyFilter | ||
function = myfilter | ||
|
||
# The TEMPLATE section defines the file name of the main template. | ||
# mako is the default engine, but you can use jinja2 instead. | ||
# To output more than one file you can use multiple sections with different names, | ||
# see ExampleMultiOutput for details. | ||
[TEMPLATE] | ||
topFile = Main.jinja2 | ||
type = jinja2 | ||
|
||
# All other sections and entries will be ignored by the CoTeTo system, but you can | ||
# store information here which is available in custom loaders, filters and templates. | ||
# See ExampleCustomEntries for details. | ||
[MYCUSTOMSETTINGS] | ||
answer = 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# The following objects can be used in templates: | ||
# | ||
# systemCfg - dictionary with information on the system and the environment | ||
# Keys: {{' '.join(systemCfg.keys())}} | ||
# CoTeToVersion: {{systemCfg['version']}} | ||
# CoTeToPath: {{systemCfg['path']}} | ||
# Platform: {{systemCfg['platform']}} | ||
# FullPlatform: {{systemCfg['fullplatform']}} | ||
# Hostname: {{systemCfg['hostname']}} | ||
# Username: {{systemCfg['username']}} | ||
# GeneratorPath: {{', '.join(systemCfg['generatorPath'])}} | ||
# | ||
# the following are functions and need to be executed: | ||
# Timestamp: {{systemCfg['timestamp']()}} | ||
# Infostamp: {{systemCfg['infostamp']()}} | ||
# | ||
# generatorCfg - configparser object with information on the used generator | ||
# (this is basically the contents of the Package.inf file) | ||
# Sections: {{' '.join(generatorCfg.keys())}} | ||
# Name: {{generatorCfg['GENERATOR'].get('name')}} | ||
# Version: {{generatorCfg['GENERATOR'].get('version')}} | ||
# | ||
# access to custom sections and values is also possible: | ||
# Answer: {{generatorCfg['MYCUSTOMSETTINGS'].getint('answer')}} | ||
# | ||
# logger - an object to send logging messages | ||
# this will output None, but log a message: {{logger.info('The answer is 42!')}} | ||
# suppress the output with this trick: {{logger.warning('But what was the question?') or ''}} | ||
# | ||
# d - the data object read from the loader and (optionally) manipulated by the filter | ||
# (this is usually a dictionary of the form filename : data_items, | ||
# but this depends on the loader and filter code) | ||
# Keys (Filenames/URIs): {{' '.join(d.keys())}} | ||
|
||
The value of foo is {{d['dummy']['foo']}}. Please notice this value was manipulated by a filter function. | ||
|
||
## Templates can be splitted and included: | ||
{% include 'Sub.jinja2' %} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[GENERATOR] | ||
name = Example03CustomEntries | ||
version = 1.0 | ||
description = show the usage of custom entries in Package.inf | ||
author = Joerg Raedler [email protected] | ||
|
||
# You can add custom sections and entries and use the values in the loader, filter and templates. | ||
# Everything in this file is available as generatorCfg. | ||
[FOO_BAR] | ||
say_hello = 1 | ||
|
||
[LOADER] | ||
name = TestDummy | ||
minVer = 0.1 | ||
maxVer = 2.0 | ||
|
||
[TEMPLATE] | ||
topFile = Main.tmpl |
11 changes: 1 addition & 10 deletions
11
...ors/TestCustomEntries/Templates/Main.tmpl → ...xample03CustomEntries/Templates/Main.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[GENERATOR] | ||
name = Example04MultiOutput | ||
version = 1.0 | ||
description = Output the lines of the input text files with line numbers added, generate a second file with some statistics | ||
author = Joerg Raedler [email protected] | ||
|
||
[LOADER] | ||
name = TextFile | ||
minVer = 0.1 | ||
maxVer = 2.0 | ||
|
||
# Any section name that starts with the string TEMPLATE can be used. | ||
# All template sections are executed in alphabetical order. | ||
# The extension ext will be appended to the output file or folder name. | ||
|
||
[TEMPLATE_NUMB] | ||
topFile = numberlines.tmpl | ||
type = mako | ||
ext = .numbered | ||
|
||
[TEMPLATE_STAT] | ||
topFile = statistics.tmpl | ||
type = mako | ||
ext = .statistics |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[GENERATOR] | ||
name = Example05CustomLoaders | ||
version = 1.0 | ||
description = test custom loaders - please load test/custom.txt as input | ||
author = Joerg Raedler [email protected] | ||
|
||
# A set of standard loaders is available in the package CoTeTo.Loaders, | ||
# but you can include your custom loader code in a generator. If the a value | ||
# for module is set in the LOADER section, CoTeTo will look for the module in | ||
# the Loaders folder of the generator. | ||
[LOADER] | ||
name = MyLoader | ||
module = MyLoader | ||
minVer = 0.1 | ||
maxVer = 2.0 | ||
|
||
[TEMPLATE] | ||
topFile = Main.tmpl |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[GENERATOR] | ||
name = Example06PostExec | ||
version = 1.0 | ||
description = Example of the post execution feature | ||
author = Joerg Raedler [email protected] | ||
|
||
[LOADER] | ||
name = TestDummy | ||
minVer = 0.1 | ||
maxVer = 2.0 | ||
|
||
[MYCUSTOMSETTINGS] | ||
answer = 42 | ||
|
||
# If a value for postExec is defined in a TEMPLATE section, the python command is executed | ||
# right after the creation of the file. The variable fname contains the name of the | ||
# generated file. This feature can be used to run a compiler on generated code or start | ||
# other applications to process/copy/upload the generated file. | ||
# Be VERY carefull with the postexec feature, it has complete access | ||
# to the whole namespace and will run this code without checking! | ||
[TEMPLATE] | ||
topFile = Main.mako | ||
type = mako | ||
postExec = os.system("dir "+fname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# The following objects can be used in templates: | ||
# | ||
# systemCfg - dictionary with information on the system and the environment | ||
# Keys: ${' '.join(systemCfg.keys())} | ||
# CoTeToVersion: ${systemCfg['version']} | ||
# CoTeToPath: ${systemCfg['path']} | ||
# Platform: ${systemCfg['platform']} | ||
# FullPlatform: ${systemCfg['fullplatform']} | ||
# Hostname: ${systemCfg['hostname']} | ||
# Username: ${systemCfg['username']} | ||
# GeneratorPath: ${', '.join(systemCfg['generatorPath'])} | ||
# | ||
# the following are functions and need to be executed: | ||
# Timestamp: ${systemCfg['timestamp']()} | ||
# Infostamp: ${systemCfg['infostamp']()} | ||
# | ||
# generatorCfg - configparser object with information on the used generator | ||
# (this is basically the contents of the Package.inf file) | ||
# Sections: ${' '.join(generatorCfg.keys())} | ||
# Name: ${generatorCfg['GENERATOR'].get('name')} | ||
# Version: ${generatorCfg['GENERATOR'].get('version')} | ||
# | ||
# access to custom sections and values is also possible: | ||
# Answer: ${generatorCfg['MYCUSTOMSETTINGS'].getint('answer')} | ||
# | ||
# logger - an object to send logging messages | ||
# this will output None, but log a message: ${logger.info('The answer is 42!')} | ||
# suppress the output with this trick: ${logger.warning('But what was the question?') or ''} | ||
# | ||
# d - the data object read from the loader and (optionally) manipulated by the filter | ||
# (this is usually a dictionary of the form filename : data_items, | ||
# but this depends on the loader and filter code) | ||
# Keys (Filenames/URIs): ${' '.join(d.keys())} | ||
|
||
The value of foo is ${d['dummy']['foo']}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[GENERATOR] | ||
name = Example07NumberLines | ||
version = 1.0 | ||
description = Output the lines of the input text files with line numbers added | ||
author = Joerg Raedler [email protected] | ||
|
||
[LOADER] | ||
name = TextFile | ||
minVer = 0.1 | ||
maxVer = 2.0 | ||
|
||
[TEMPLATES] | ||
topFile = numberlines.mao | ||
type = mako |
File renamed without changes.
Binary file not shown.
4 changes: 2 additions & 2 deletions
4
Generators/JsonFluid/Package.inf → Generators/Example50JsonFluid/Package.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.