From d5c0555775ac835f75246a17b5e6f3ddc353d82b Mon Sep 17 00:00:00 2001 From: Stanisław Zagórowski Date: Sun, 14 Jan 2024 22:14:50 +0100 Subject: all: add dev mode for local testing, fix metadata --- luax/blog/building-reluax.md | 2 +- luax/common.luax | 53 ++++++++++++++++++++++++++++++++------------ luax/components/project.luax | 8 ++++--- luax/pages/home.luax | 5 ++++- luax/reluax.luax | 11 ++++++++- 5 files changed, 59 insertions(+), 20 deletions(-) (limited to 'luax') diff --git a/luax/blog/building-reluax.md b/luax/blog/building-reluax.md index 72fff0d..08f8b5d 100644 --- a/luax/blog/building-reluax.md +++ b/luax/blog/building-reluax.md @@ -112,7 +112,7 @@ felt like I wouldn't really benefit from them. What I was building was not to be of one, but a replacement of it. The parser portion took a bit, but it was not anything too complex. Writing a lexer that -simultaneously structres the data, but can emit whatever garbage comes inside of an HTML tag, was +simultaneously structures the data, but can emit whatever garbage comes inside of an HTML tag, was a bit tricky. But in two evenings I had a demo: ![the first demo](https://cdn.duckonaut.dev/assets/blog/building-reluax/first-demo.png) diff --git a/luax/common.luax b/luax/common.luax index 0bd3cf7..ab29a02 100644 --- a/luax/common.luax +++ b/luax/common.luax @@ -1,8 +1,39 @@ return function(props) -return + local use_cdn = reluax.dev_mode == false + local asset_prefix = use_cdn and "https://cdn.duckonaut.dev" or "" + + local thumbnail = props.attrs.thumbnail or + asset_prefix .. "/assets/images/thumbnail.png" + local title = props.attrs.title or "duckonaut.dev" + local description = props.attrs.description or "duckonaut's stuff" + local stylesheelts = props.attrs.stylesheets or + { 'app.css', + 'index.css', + 'contact.css', + 'project.css', + 'navbar.css', + 'carousel.css', + 'blog.css' + } + local scripts = props.attrs.scripts or + { 'index.js' } + + local style_tags = {} + for _, stylesheet in ipairs(stylesheelts) do + style_tags[#style_tags + 1] = + + end + + local script_tags = {} + for _, script in ipairs(scripts) do + script_tags[#script_tags + 1] = + + end + + return - + @@ -23,26 +54,20 @@ return - + {$ script_tags $} - - - - - - - + {$ style_tags $} - - - + + + - duckonaut.dev + {$ title $} diff --git a/luax/components/project.luax b/luax/components/project.luax index f8d6711..cad844f 100644 --- a/luax/components/project.luax +++ b/luax/components/project.luax @@ -1,15 +1,17 @@ local Carousel = require('components.carousel') +local asset_prefix = reluax.dev_mode and '/assets/' or 'https://cdn.duckonaut.dev/assets/' + function getProjectImageLink(project, image) - return 'https://cdn.duckonaut.dev/assets/' .. project.type .. 's/' .. project.name_normalized .. '/' .. image + return asset_prefix .. project.type .. 's/' .. project.name_normalized .. '/' .. image end function getProjectTechIconLink(tech) - return 'https://cdn.duckonaut.dev/assets/images/' .. tech .. '.png' + return asset_prefix .. 'images/' .. tech .. '.png' end function getProjectTargetIconLink(target) - return 'https://cdn.duckonaut.dev/assets/images/' .. target .. '.png' + return asset_prefix .. 'images/' .. target .. '.png' end return function (props) diff --git a/luax/pages/home.luax b/luax/pages/home.luax index b61ed4e..ed1b464 100644 --- a/luax/pages/home.luax +++ b/luax/pages/home.luax @@ -6,7 +6,10 @@ return function()
aka Duckonaut, EchoDuck
- +

diff --git a/luax/reluax.luax b/luax/reluax.luax index b078ce8..1cfc04c 100644 --- a/luax/reluax.luax +++ b/luax/reluax.luax @@ -48,7 +48,16 @@ local function route(path) end end if post then - local article = wrap_component() + local article = + + +

+
+ + +
+ + return 200, article end end -- cgit v1.3.1