This commit is contained in:
2025-05-08 21:27:29 -05:00
parent c143b8d3a5
commit 7456bf9bc0
49 changed files with 604 additions and 1197 deletions

View File

@@ -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"]
}
}

View File

@@ -0,0 +1,5 @@
var count = 0;
func Components.Counter()
{
return <p>Count is {++count}</p>;
}

View File

@@ -0,0 +1,35 @@
func Components.Shell(title,pages,body)
{
return <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>%PROJECT_NAME% - {title}</title>
<link rel="stylesheet" href="./css/simple.min.css">
</head>
<body>
<header>
<h1>%PROJECT_NAME%</h1>
<nav>
<ul>
<?code
each(var item : pages)
{
?>
<li><a <?code if(item.active) { ?> aria-current="page" <?code } ?> href="<?expr Net.Http.UrlPathEncode(item.route) ?>"><?expr Net.Http.HtmlEncode(item.text) ?></a></li>
<?code
}
?>
</ul>
</nav>
</header>
<h1><?expr Net.Http.HtmlEncode(title) ?></h1>
<?body?>
<?end?>
<footer>
<p>Created using <a href="https://crosslang.tesseslanguage.com/">CrossLang</a> and <a href="https://simplecss.org/">SimpleCSS</a></p>
</footer>
</body>
</html>;
}

View File

@@ -1,5 +1,21 @@
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;
}
else if(ctx.Path == "/simple.min.css")
{
ctx.WithMimeType("text/css").SendBytes(embed("simple.min.css"));
return true;
}
else if(ctx.Path == "/favicon.ico")
{
ctx.WithMimeType("image/x-icon").SendBytes(embed("favicon.ico"));
return true;
}
},4206);
}