mirror of
https://onedev.site.tesses.net/crosslang/crosslangextras
synced 2026-02-08 17:15:45 +00:00
Add json listing for crosslang new
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
<?component() name="Counter" ?>
|
||||
<p>Count is <?expr count++ ?></p>
|
||||
<?end?>
|
||||
@@ -1,36 +0,0 @@
|
||||
<?resource name="simple.min.css" route="/css/simple.min.css" ?>
|
||||
<?resource name="favicon.ico" route="/favicon.ico" ?>
|
||||
<?component(title,pages,body) name="Shell" ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>%PROJECT_NAME% - <?expr Net.Http.HtmlEncode(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>
|
||||
<?end?>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?page() route="/about" ?>
|
||||
<?code
|
||||
var pages = [
|
||||
{
|
||||
active = false,
|
||||
route = "/",
|
||||
text = "Home"
|
||||
},
|
||||
{
|
||||
active = false,
|
||||
route = "/counter",
|
||||
text = "Counter"
|
||||
},
|
||||
{
|
||||
active = true,
|
||||
route = "/about",
|
||||
text = "About"
|
||||
}
|
||||
];
|
||||
?>
|
||||
<?Shell?>
|
||||
<?arg "About Me" ?>
|
||||
<?arg pages ?>
|
||||
<?arg_component() ?>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam possimus nisi ab nobis magni, error minus vero neque iusto beatae, quasi nostrum. Ut repudiandae expedita reprehenderit tenetur. Sunt, adipisci cumque!</p>
|
||||
<?end?>
|
||||
<?end?>
|
||||
<?end?>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?page() route="/counter" ?>
|
||||
<?code
|
||||
var pages = [
|
||||
{
|
||||
active = false,
|
||||
route = "/",
|
||||
text = "Home"
|
||||
},
|
||||
{
|
||||
active = true,
|
||||
route = "/counter",
|
||||
text = "Counter"
|
||||
},
|
||||
{
|
||||
active = false,
|
||||
route = "/about",
|
||||
text = "About"
|
||||
}
|
||||
];
|
||||
?>
|
||||
<?Shell?>
|
||||
<?arg "Counter" ?>
|
||||
<?arg pages ?>
|
||||
<?arg_component() ?>
|
||||
<?Counter ?>
|
||||
<?end?>
|
||||
<?end?>
|
||||
<?end?>
|
||||
<?end?>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?page() route="/" ?>
|
||||
<?code
|
||||
var pages = [
|
||||
{
|
||||
active = true,
|
||||
route = "/",
|
||||
text = "Home"
|
||||
},
|
||||
{
|
||||
active = false,
|
||||
route = "/counter",
|
||||
text = "Counter"
|
||||
},
|
||||
{
|
||||
active = false,
|
||||
route = "/about",
|
||||
text = "About"
|
||||
}
|
||||
];
|
||||
?>
|
||||
<?Shell?>
|
||||
<?arg "Main Page" ?>
|
||||
<?arg pages ?>
|
||||
<?arg_component() ?>
|
||||
<p>1 John 4:4: You, dear children, are from God and have overcome them, because the one who is in you is greater than the one who is in the world.</p>
|
||||
<?end?>
|
||||
<?end?>
|
||||
<?end?>
|
||||
@@ -13,20 +13,23 @@ func Components.Shell(title,pages,body)
|
||||
<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
|
||||
}
|
||||
?>
|
||||
<each(var item : pages)>
|
||||
<li>
|
||||
<if(item.active)>
|
||||
<true>
|
||||
<a aria-current="page" href={item.route}>{item.text}</a>
|
||||
</true>
|
||||
<false>
|
||||
<a aria-current="page" href={item.route}>{item.text}</a>
|
||||
</false>
|
||||
</if>
|
||||
</li>
|
||||
</each>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<h1><?expr Net.Http.HtmlEncode(title) ?></h1>
|
||||
<?body?>
|
||||
<?end?>
|
||||
<h1>{title}</h1>
|
||||
<raw(body)>
|
||||
<footer>
|
||||
<p>Created using <a href="https://crosslang.tesseslanguage.com/">CrossLang</a> and <a href="https://simplecss.org/">SimpleCSS</a></p>
|
||||
</footer>
|
||||
|
||||
@@ -7,7 +7,27 @@ func main(args)
|
||||
ctx.WithMimeType("text/html").SendText(Pages.Index());
|
||||
return true;
|
||||
}
|
||||
else if(ctx.Path == "/simple.min.css")
|
||||
else if(ctx.Path == "/counter")
|
||||
{
|
||||
ctx.WithMimeType("text/html").SendText(Pages.Counter());
|
||||
return true;
|
||||
}
|
||||
else if(ctx.Path == "/about")
|
||||
{
|
||||
ctx.WithMimeType("text/html").SendText(Pages.Index());
|
||||
return true;
|
||||
}
|
||||
else if(ctx.Path == "/echo")
|
||||
{
|
||||
ctx.WithMimeType("text/html").SendText(Pages.Echo(ctx.QueryParams.TryGetFirst("text")));
|
||||
return true;
|
||||
}
|
||||
else if(ctx.Path == "/image.png")
|
||||
{
|
||||
ctx.WithMimeType("image/png").SendBytes(embed("image.png"));
|
||||
return true;
|
||||
}
|
||||
else if(ctx.Path == "/css/simple.min.css")
|
||||
{
|
||||
ctx.WithMimeType("text/css").SendBytes(embed("simple.min.css"));
|
||||
return true;
|
||||
@@ -17,5 +37,6 @@ func main(args)
|
||||
ctx.WithMimeType("image/x-icon").SendBytes(embed("favicon.ico"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},4206);
|
||||
}
|
||||
Reference in New Issue
Block a user