diff --git a/.gitignore b/.gitignore index df30e2e..de360a2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ bin bin-tmp obj shell_archive +tmp *.crvm \ No newline at end of file diff --git a/Templates/emptyweb/cross.json b/Templates/emptyweb/cross.json index 20de882..966ac81 100644 --- a/Templates/emptyweb/cross.json +++ b/Templates/emptyweb/cross.json @@ -8,16 +8,10 @@ "homepage": "https://crosslang.tesseslanguage.com/", "license": "MIT", "template_name": "emptyweb", - "description": "An empty website with my template engine", + "description": "An empty website", "template_info": { "type": "console" }, - "template_project_dependencies": [ - { - "name": "Tesses.CrossLang.Markup", - "version": "1.0.0.0-prod" - } - ], "template_extra_text_ftles": [], "template_ignored_files": ["bin","obj"] } diff --git a/Templates/emptyweb/pages/index.tcrml b/Templates/emptyweb/pages/index.tcrml index bd77e2b..206adec 100644 --- a/Templates/emptyweb/pages/index.tcrml +++ b/Templates/emptyweb/pages/index.tcrml @@ -1,8 +1,7 @@ -

Hello, world

- Views: + diff --git a/Templates/emptyweb/src/components/shell.tcross b/Templates/emptyweb/src/components/shell.tcross new file mode 100644 index 0000000..f2df9b5 --- /dev/null +++ b/Templates/emptyweb/src/components/shell.tcross @@ -0,0 +1,14 @@ +func Components.Shell(body) +{ +return + + + + + Hello, world + + + + +; +} \ No newline at end of file diff --git a/Templates/emptyweb/src/pages/index.tcross b/Templates/emptyweb/src/pages/index.tcross new file mode 100644 index 0000000..7695d73 --- /dev/null +++ b/Templates/emptyweb/src/pages/index.tcross @@ -0,0 +1,9 @@ +var count = 0; + +func Pages.Index() +{ + return Components.Shell( +

Hello, world

+ Views: {++count} + ); +} \ No newline at end of file diff --git a/Templates/emptyweb/src/program.tcross b/Templates/emptyweb/src/program.tcross index 0669b7d..6092297 100644 --- a/Templates/emptyweb/src/program.tcross +++ b/Templates/emptyweb/src/program.tcross @@ -1,5 +1,12 @@ -var count = 0; + func main(args) { - Net.Http.ListenSimpleWithLoop(Router,4206); + Net.Http.ListenSimpleWithLoop((ctx)=>{ + if(ctx.Path == "/") + { + ctx.WithMimeType("text/html").SendText(Pages.Index()); + return true; + } + return false; + },4206); } \ No newline at end of file diff --git a/Templates/web/cross.json b/Templates/web/cross.json index e643f59..6125543 100644 --- a/Templates/web/cross.json +++ b/Templates/web/cross.json @@ -12,13 +12,6 @@ "template_info": { "type": "console" }, - "template_project_dependencies": [ - { - "name": "Tesses.CrossLang.Markup", - "version": "1.0.0.0-prod" - } - ], - "template_extra_text_ftles": ["/components/shell.tcrml"], "template_ignored_files": ["bin","obj"] } } diff --git a/Templates/web/src/components/counter.tcross b/Templates/web/src/components/counter.tcross new file mode 100644 index 0000000..41092dd --- /dev/null +++ b/Templates/web/src/components/counter.tcross @@ -0,0 +1,5 @@ +var count = 0; +func Components.Counter() +{ + return

Count is {++count}

; +} \ No newline at end of file diff --git a/Tesses.CrossLang.WebSite/components/shell.tcrml b/Templates/web/src/components/shell.tcross similarity index 75% rename from Tesses.CrossLang.WebSite/components/shell.tcrml rename to Templates/web/src/components/shell.tcross index e978cc1..9ae86c3 100644 --- a/Tesses.CrossLang.WebSite/components/shell.tcrml +++ b/Templates/web/src/components/shell.tcross @@ -1,17 +1,16 @@ - - - - +func Components.Shell(title,pages,body) +{ + return - CrossLang - <?expr Net.Http.HtmlEncode(title) ?> + %PROJECT_NAME% - {title}
-

CrossLang

+

%PROJECT_NAME%