Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up example projects #84

Merged
merged 3 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions TextrudeInteractive/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Engine.Application;
using MaterialDesignExtensions.Controls;
using TextrudeInteractive.Monaco.Messages;
Expand Down Expand Up @@ -297,7 +296,7 @@ public void SetOutputPanes(EngineOutputSet outputControl, bool trim)

//ensure there is always at least one output - otherwise things can get confusing for the user
if (!_outputManager.Panes.Any())
_outputManager.AddPane(new EditPaneViewModel());
_outputManager.AddPane(ViewModelFactory.CreateOutput(OutputPaneModel.Empty, 0));

_outputManager.FocusFirst();
}
Expand Down
57 changes: 57 additions & 0 deletions examples/00_welcome.texproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"Version": 1,
"Description": "",
"EngineInput": {
"Definitions": [
"",
"",
"",
"",
"color=blue",
"",
"size=large"
],
"IncludePaths": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"Models": [
{
"Format": 2,
"Text": "str: a string\r\nnum: 100\r\nlst:\r\n - 45\r\n - 23\r\n",
"Path": "",
"Name": "model"
},
{
"Format": 1,
"Text": "Num,Description\r\n100,failure\r\n200,breakage",
"Path": "",
"Name": "model1"
}
],
"Template": "\r\nHello \r\n {{env.USERNAME}} \r\n {{ date.now | \r\n date.to_string \u0022%r on %A, %d %h %Y\u0022}}\r\n\r\nYour model is: \r\n\u0060\u0060\u0060\r\n{{debug.dump model}}\r\n\u0060\u0060\u0060\r\nProperty access :\r\n \u0022{{model.str}}\u0022 \r\n\r\nArray access: \r\n {{model.lst[0] \u002B model.lst[1]}}\r\n\r\nThe \u0022model1\u0022 tab contains a CSV model \r\n\u0060\u0060\u0060\r\n{{debug.dump model1}}\r\n\u0060\u0060\u0060\r\nThe \u0022defs\u0022 tab contains::\r\n{{for d in def~}}\r\n {{for.index}}. \u0027{{d.key}}\u0027 is \u0027{{d.value}}\u0027\r\n{{~end}}\r\n\r\nThe _output1_ tab on the right should\r\ninclude text captured like this... \r\n{{capture output1}} \r\n Text for output1 window \r\n{{end}}\r\n\r\nOutput is regenerated whenever you edit \r\nthe template, models or definitions.\r\n\r\nMore examples are available; use \r\nProject-\u003ELoad from the menu. \r\n",
"TemplatePath": ""
},
"OutputControl": {
"Outputs": [
{
"Format": "markdown",
"Name": "output",
"Path": ""
},
{
"Format": "text",
"Name": "output1",
"Path": ""
}
]
}
}
38 changes: 38 additions & 0 deletions examples/01_humanizr.texproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"Version": 1,
"Description": "",
"EngineInput": {
"Definitions": [
"",
"",
"",
"",
""
],
"IncludePaths": [
"",
"",
"",
""
],
"Models": [
{
"Format": 1,
"Text": "text\r\na variable\r\nNameOfThing\r\nThe title of this book is\r\n\u0022 with spaces \u0022",
"Path": "",
"Name": "model"
}
],
"Template": "** Textrude includes \r\n[Humanizr](https://github.com/Humanizr/Humanizer)\r\nfor convenient text processing.\r\n\r\n\r\n{{for v in model\r\ntxt =v.text\r\n}}\r\n# {{txt}}\r\n- _PASCALIZE_ \u0027{{txt | \r\n humanizr.pascalize}}\u0027\r\n- _CAMEL_ \u0027{{txt | \r\n humanizr.camelize}}\u0027\r\n- _UNDERSCORE_ \u0027{{txt | \r\n humanizr.underscore}}\u0027\r\n- _TITLE_ \u0027{{txt | \r\n humanizr.titleize}}\u0027\r\n- _KEBAB_ \u0027{{txt | \r\n humanizr.kebaberize}}\u0027\r\n{{end}}",
"TemplatePath": ""
},
"OutputControl": {
"Outputs": [
{
"Format": "markdown",
"Name": "output",
"Path": ""
}
]
}
}
44 changes: 44 additions & 0 deletions examples/02_include_library_scripts.texproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"Version": 1,
"Description": "",
"EngineInput": {
"Definitions": [
"",
"",
"",
"",
""
],
"IncludePaths": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"Models": [
{
"Format": 3,
"Text": "",
"Path": "",
"Name": "model"
}
],
"Template": "\r\n/***\r\n You can include scripts from the \r\n \u0027system\u0027 lib folder or from your\r\n own library. \r\n\r\n Additional include paths are specified \r\n in the \u0027inc\u0027 tab to the left. \r\n \r\n Here\u0027s a standard warning...\r\n ***/\r\n\r\n{{include \u0022lib/warnings.sbn\u0022}}\r\n{{autogenwarning}}",
"TemplatePath": ""
},
"OutputControl": {
"Outputs": [
{
"Format": "cpp",
"Name": "output",
"Path": ""
}
]
}
}
46 changes: 46 additions & 0 deletions examples/03_env_and_def.texproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"Version": 1,
"Description": "",
"EngineInput": {
"Definitions": [
"",
"",
"",
"",
"LANGUAGE=ENGLISH",
"",
"COUNTRY=United Kingdom"
],
"IncludePaths": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"Models": [
{
"Format": 3,
"Text": "",
"Path": "",
"Name": "model"
}
],
"Template": "Textrude automatically provides access \r\nto environment variables via the \u0027env\u0027 \r\nnamespace:\r\n\r\nFor example, your username is: \r\n\r\n {{env.USERNAME}}\r\n\r\nAs well as environment variables, you\r\ncan supply your own definitions in the \r\n\u0027def\u0027 tab. These are available via \r\nthe \u0027def\u0027 namespace:\r\n\r\n {{def.LANGUAGE}} / {{def.COUNTRY}}\r\n\r\nYou can easily list all environment \r\nvariables using the debug.dump command:\r\n\r\n{{debug.dump env}}\r\n\r\nor just type \u0027env.\u0027 and use intellisense \r\n\r\n\r\n",
"TemplatePath": ""
},
"OutputControl": {
"Outputs": [
{
"Format": "markdown",
"Name": "output",
"Path": ""
}
]
}
}
54 changes: 54 additions & 0 deletions examples/04_multiple_models_and_outputs.texproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"Version": 1,
"Description": "",
"EngineInput": {
"Definitions": [
"",
"",
"",
"",
""
],
"IncludePaths": [
"",
"",
"",
""
],
"Models": [
{
"Format": 2,
"Text": "enumName: errors ",
"Path": "",
"Name": "names"
},
{
"Format": 1,
"Text": "id,description\r\n123,disk\r\n34,display\r\n73,monitor\r\n5,keyboard\r\n2,camera\r\n",
"Path": "",
"Name": "errors"
}
],
"Template": "You can use as many models or outputs as\r\nyou want.\r\n\r\nThis project has 2 models \r\n- \u0027names\u0027 - a yaml model\r\n- \u0027errors\u0027 - a csv file containing \r\n error descriptions\r\n\r\nand 3 outputs\r\n- \u0027output\u0027 which is the default\r\n- \u0027cpp\u0027 for a C\u002B\u002B source file\r\n- \u0027h\u0027 for a C\u002B\u002B header file\r\n\r\n\r\nTo write to a particular output, use the \r\ncapture keyword...\r\n\r\n{{typeName =names.enumName \u002B\u0022_t\u0022}}\r\n\r\n{{-capture h}}\r\n#pragma once\r\ntypedef enum {\r\n{{-for error in (errors | array.sort \u0022id\u0022)}}\r\n err_{{error.description}} = {{error.id}},\r\n{{-end}} \r\n} {{typeName}}; \r\n\r\n{{end}}\r\n\r\n\r\n{{-capture cpp}}\r\n#include \u0022err.h\u0022\r\nvoid showError({{typeName}} error) {\r\n{{for i in errors~}}\r\n if (error == {{i.id}})\r\n printf(\u0022ERROR - {{i.description}}\u0022);\r\nelse \r\n{{-end}}\r\n printf(\u0022UNKNOWN ERROR\u0022);\r\n} \r\n{{end}}\r\n",
"TemplatePath": ""
},
"OutputControl": {
"Outputs": [
{
"Format": "markdown",
"Name": "output",
"Path": ""
},
{
"Format": "cpp",
"Name": "cpp",
"Path": ""
},
{
"Format": "cpp",
"Name": "h",
"Path": ""
}
]
}
}
38 changes: 38 additions & 0 deletions examples/05_misc_functions.texproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"Version": 1,
"Description": "",
"EngineInput": {
"Definitions": [
"",
"",
"",
"",
""
],
"IncludePaths": [
"",
"",
"",
""
],
"Models": [
{
"Format": 0,
"Text": "{\r\n\u0022top\u0022 : {\r\n \u0022number\u0022: 1,\r\n \u0022string\u0022: \u0022a string\u0022,\r\n \u0022array\u0022: [ 1,2,3,4]\r\n}\r\n}",
"Path": "",
"Name": "model"
}
],
"Template": "This project demonstrates some\r\nof the methods in the \u0027misc\u0027\r\nnamespace:\r\n\r\nCreate a fresh guid...\r\n\r\n {{misc.new_guid}}\r\n\r\nDump an object or model:\r\n\u0060\u0060\u0060\r\n{{debug.dump model}}\r\n\u0060\u0060\u0060\r\n",
"TemplatePath": ""
},
"OutputControl": {
"Outputs": [
{
"Format": "markdown",
"Name": "output",
"Path": ""
}
]
}
}
30 changes: 0 additions & 30 deletions examples/environmentAndDefinitions.texproj

This file was deleted.

27 changes: 0 additions & 27 deletions examples/humanizr.texproj

This file was deleted.

27 changes: 0 additions & 27 deletions examples/includeExample.texproj

This file was deleted.

Loading