You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Essentially you could output HTML pages using a JSX-like syntax:
-- I can define whatever data I like in plain old Lua.localarticles= {
{
title="I made JSX for Lua (because I hate static sites)",
description="This site now runs on a custom dialect of Lua.",
slug="luax",
date=os.time({ year=2023, month=12, day=27 }),
},
-- more articles...
}
-- "Components" are just Lua functions that return HTML.-- Lua expressions can be placed in attributes or text.functionArticle(atts, children)
locala=atts.articlereturn<article><header><h1><ahref={ absurl(a.slug) }>{{ a.title }}</a></h1><spanclass="post-details"><timedatetime={ os.date("%Y-%m-%dT%H:%M:%S%z", atts.date) } itemprop="datePublished">
{{ os.date("%B %-d, %Y", atts.date) }}
</time></span></header><p>
{{ a.description }}
</p></article>end-- I can use Lua's package system to organize my templates.require("base")
-- Whatever the file returns will be rendered and sent to the browser.return<Base><divclass="list">
{{ map(articles, function (a)
<Articlearticle={ a } />end) }}
</div></Base>
I would vastly prefer this to any of the other template systems that exist. It does depend on LuaX getting extracted from the creator's personal project and made into a module that can be imported, which I have raised an issue on here: bvisness/bvisness.me#1
The text was updated successfully, but these errors were encountered:
Looks like bvisness is not interested in extracting it, but is fine with the code being used. Added an MIT license but annoyingly pkg.go.dev still doesn't pick it up, may or may not recognize the license in the subdirectory, so the API is not super visible.
Still, this is exported and looks appropriate: func Transpile(source, filename string) (string, error)
See https://bvisness.me/luax/
Essentially you could output HTML pages using a JSX-like syntax:
I would vastly prefer this to any of the other template systems that exist. It does depend on LuaX getting extracted from the creator's personal project and made into a module that can be imported, which I have raised an issue on here: bvisness/bvisness.me#1
The text was updated successfully, but these errors were encountered: