2
3
ミラー元 https://github.com/sammy-ette/Hilbish 前回の同期 2025-08-10 02:52:03 +00:00

feat(website): add docs

このコミットが含まれているのは:
sammyette 2025-05-04 20:20:12 -04:00
コミット 2e28050e8e
署名者: sammyette
GPGキーID: 904FC49417B44DCD
9個のファイルの変更226行の追加94行の削除

ファイルの表示

@ -1,88 +0,0 @@
---
description: 'Something Unique. Hilbish is the new interactive shell for Lua fans. Extensible, scriptable, configurable: All in Lua.'
---
[//]: <>
<!-- hugo (prob goldmark) is funny; the html wont work if its the first thing -->
<div class="text-center">
<h1 class="fw-light">Something Unique.</h1>
<p>
<strong>🌺 Hilbish</strong> is the new Moon-powered interactive shell for Lua fans!<br>
Extensible, scriptable, configurable: All in Lua. ✨
</p>
<a href="install" class="btn btn-primary">Install</a>
<a href="https://github.com/Rosettea/Hilbish" class="btn btn-secondary" target="_blank">GitHub</a>
</div>
<hr>
<div class="row row-cols-1 row-cols-md-2 g-4">
<div class="col">
<div class="card">
<div class="card-body">
<h5 class="card-title">Simple and Easy Scripting</h5>
<p class="card-text">Hilbish is configured and scripted in the
Lua programming language. This removes all the old, ugly things
about Shell script and introduces everything good about Lua,
including other languages (Fennel, Lua derivatives).</p>
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-body">
<h5 class="card-title">History and Completion Menus</h5>
<p class="card-text">Hilbish provides the user with proper menus
for completions and history usage. Want to see your previous commands?
Hit Ctrl-R.</p>
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-body">
<h5 class="card-title">Tons of Features, and More to Come</h5>
<p class="card-text">Hilbish offers a bunch of features to make your
interactive shell experience rich. Things like syntax highlighting
and hinting available via the Lua API.</p>
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-body">
<h5 class="card-title">Customizable and Extensible via an accessible Lua API</h5>
<p class="card-text">Want to change the language used for interactive input?
Or maybe monitor and notify for the output of background jobs?
Have a real-time updating prompt? All this can be done in Hilbish!</p>
</div>
</div>
</div>
</div>
<hr>
<h1 class="fw-light">Why not just Lua?</h1>
<p>
Hilbish is your interactive shell as well as a just a Lua interpreter
and enhanced REPL.<br>
</p>
<ul class="list-group">
<li class="list-group-item"><i class="fa-solid fa-battery-full"></i> Batteries included Lua runtime that's also your user shell!</li>
<li class="list-group-item"><i class="fa-solid fa-network-wired"></i> Provides cross-platform and OS agnostic APIs to ensure your Lua code works everywhere Hilbish does, as expected.</li>
</ul>
<hr>
<h1 class="fw-light">Try It Today!</h1>
<p>
Hilbish is known to run on the 3 major platforms (Windows, MacOS, Linux)
but likely builds on other Unixes! Windows doesn't work as well as it should,
so if you're a Windows user,
<a href="https://github.com/Rosettea/Hilbish/discussions/165">say something</a>!
<ul class="list-group">
<li class="list-group-item"><i class="fa-solid fa-cloud-arrow-down"></i> <a href="/Hilbish/install" style="text-decoration: none;"><strong>Download</strong></a> the binary</li>
<li class="list-group-item"><i class="fa-solid fa-screwdriver-wrench"></i> <a href="https://github.com/Rosettea/Hilbish#manual-build" style="text-decoration: none;"><strong>Build</strong></a> from source</li>
</ul>
</p>

ファイルの表示

@ -16,6 +16,10 @@ version = "1.0.0"
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
lustre = ">= 5.0.2 and < 6.0.0"
lustre_ssg = { git = "https://github.com/lustre-labs/ssg.git", ref = "v0.11.0" }
tom = ">= 1.1.1 and < 2.0.0"
simplifile = ">= 2.2.1 and < 3.0.0"
glaml = ">= 3.0.2 and < 4.0.0"
mdex = ">= 0.6.1 and < 1.0.0"
[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"

ファイルの表示

@ -3,11 +3,14 @@
packages = [
{ name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" },
{ name = "autumn", version = "0.3.2", build_tools = ["mix"], requirements = ["nimble_options", "rustler", "rustler_precompiled"], otp_app = "autumn", source = "hex", outer_checksum = "5C8C4A30F3159E7C63C7A3F97D274EC9693402AA30EEDE855870DB7F390DEB67" },
{ name = "castore", version = "1.0.12", build_tools = ["mix"], requirements = [], otp_app = "castore", source = "hex", outer_checksum = "3DCA286B2186055BA0C9449B4E95B97BF1B57B47C1F2644555879E659960C224" },
{ name = "directories", version = "1.2.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_stdlib", "platform", "simplifile"], otp_app = "directories", source = "hex", outer_checksum = "D13090CFCDF6759B87217E8DDD73A75903A700148A82C1D33799F333E249BF9E" },
{ name = "envoy", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "95FD059345AA982E89A0B6E2A3BF1CF43E17A7048DCD85B5B65D3B9E4E39D359" },
{ name = "exception", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "exception", source = "hex", outer_checksum = "F5580D584F16A20B7FCDCABF9E9BE9A2C1F6AC4F9176FA6DD0B63E3B20D450AA" },
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
{ name = "fs", version = "11.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "fs", source = "hex", outer_checksum = "DD00A61D89EAC01D16D3FC51D5B0EB5F0722EF8E3C1A3A547CD086957F3260A9" },
{ name = "glaml", version = "3.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib", "yamerl"], otp_app = "glaml", source = "hex", outer_checksum = "100CA23F526AB159712A3204D200969571FC43B193736B320C1400D410DEE7AD" },
{ name = "gleam_community_ansi", version = "1.4.3", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "8A62AE9CC6EA65BEA630D95016D6C07E4F9973565FA3D0DE68DC4200D8E0DD27" },
{ name = "gleam_community_colour", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "FDD6AC62C6EC8506C005949A4FCEF032038191D5EAAEC3C9A203CD53AE956ACA" },
{ name = "gleam_crypto", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_crypto", source = "hex", outer_checksum = "917BC8B87DBD584830E3B389CBCAB140FFE7CB27866D27C6D0FB87A9ECF35602" },
@ -27,15 +30,20 @@ packages = [
{ name = "gramps", version = "3.0.1", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gramps", source = "hex", outer_checksum = "59194B3980110B403EE6B75330DB82CDE05FC8138491C2EAEACBC7AAEF30B2E8" },
{ name = "houdini", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "houdini", source = "hex", outer_checksum = "5BA517E5179F132F0471CB314F27FE210A10407387DA1EA4F6FD084F74469FC2" },
{ name = "hpack_erl", version = "0.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "hpack", source = "hex", outer_checksum = "D6137D7079169D8C485C6962DFE261AF5B9EF60FBC557344511C1E65E3D95FB0" },
{ name = "jason", version = "1.4.4", build_tools = ["mix"], requirements = ["decimal"], otp_app = "jason", source = "hex", outer_checksum = "C5EB0CAB91F094599F94D55BC63409236A8EC69A21A67814529E8D5F6CC90B3B" },
{ name = "jot", version = "4.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "houdini", "splitter"], otp_app = "jot", source = "hex", outer_checksum = "E9E266D2768EA1238283D2CF125AA68095F17BAA4DDF3598360FD19F38593C59" },
{ name = "logging", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "1098FBF10B54B44C2C7FDF0B01C1253CAFACDACABEFB4B0D027803246753E06D" },
{ name = "lustre", version = "5.0.2", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "ED46F0CA5BA61067DDC2CEDEA9906AC99E88F49918EFDC58283A531F0A14F042" },
{ name = "lustre_dev_tools", version = "1.7.1", build_tools = ["gleam"], requirements = ["argv", "filepath", "fs", "gleam_community_ansi", "gleam_crypto", "gleam_deque", "gleam_erlang", "gleam_http", "gleam_httpc", "gleam_json", "gleam_otp", "gleam_package_interface", "gleam_regexp", "gleam_stdlib", "glint", "glisten", "lustre", "mist", "repeatedly", "simplifile", "term_size", "tom", "wisp"], otp_app = "lustre_dev_tools", source = "hex", outer_checksum = "B426F3E518B44144643CAE956D072E3ADAA9BBC71ECE08CD559CA0276A74C167" },
{ name = "lustre_ssg", version = "0.11.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_regexp", "gleam_stdlib", "jot", "lustre", "simplifile", "temporary", "tom"], source = "git", repo = "https://github.com/lustre-labs/ssg.git", commit = "3b75ef77a5038b4843a0f8b18f31331d0d64a543" },
{ name = "marceau", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "marceau", source = "hex", outer_checksum = "2D1C27504BEF45005F5DFB18591F8610FB4BFA91744878210BDC464412EC44E9" },
{ name = "mdex", version = "0.6.1", build_tools = ["mix"], requirements = ["autumn", "jason", "nimble_options", "rustler", "rustler_precompiled"], otp_app = "mdex", source = "hex", outer_checksum = "025645518F19E585878AE2D4210BD5C78A92010169006AA3C5CD9C758F982F37" },
{ name = "mist", version = "4.0.7", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "gleam_yielder", "glisten", "gramps", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "F7D15A1E3232E124C7CE31900253633434E59B34ED0E99F273DEE61CDB573CDD" },
{ name = "nimble_options", version = "1.1.1", build_tools = ["mix"], requirements = [], otp_app = "nimble_options", source = "hex", outer_checksum = "821B2470CA9442C4B6984882FE9BB0389371B8DDEC4D45A9504F00A66F650B44" },
{ name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" },
{ name = "repeatedly", version = "2.1.2", build_tools = ["gleam"], requirements = [], otp_app = "repeatedly", source = "hex", outer_checksum = "93AE1938DDE0DC0F7034F32C1BF0D4E89ACEBA82198A1FE21F604E849DA5F589" },
{ name = "rustler", version = "0.36.1", build_tools = ["mix"], requirements = ["jason", "toml"], otp_app = "rustler", source = "hex", outer_checksum = "F3FBA4AD272970E0D1BC62972FC4A99809651E54A125C5242DE9BAD4574B2D02" },
{ name = "rustler_precompiled", version = "0.8.2", build_tools = ["mix"], requirements = ["castore", "rustler"], otp_app = "rustler_precompiled", source = "hex", outer_checksum = "63D1BD5F8E23096D1FF851839923162096364BAC8656A4A3C00D1FFF8E83EE0A" },
{ name = "simplifile", version = "2.2.1", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "C88E0EE2D509F6D86EB55161D631657675AA7684DAB83822F7E59EB93D9A60E3" },
{ name = "snag", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "7E9F06390040EB5FAB392CE642771484136F2EC103A92AE11BA898C8167E6E17" },
{ name = "splitter", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "128FC521EE33B0012E3E64D5B55168586BC1B9C8D7B0D0CA223B68B0D770A547" },
@ -43,12 +51,18 @@ packages = [
{ name = "temporary", version = "1.0.0", build_tools = ["gleam"], requirements = ["envoy", "exception", "filepath", "gleam_crypto", "gleam_stdlib", "simplifile"], otp_app = "temporary", source = "hex", outer_checksum = "51C0FEF4D72CE7CA507BD188B21C1F00695B3D5B09D7DFE38240BFD3A8E1E9B3" },
{ name = "term_size", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "term_size", source = "hex", outer_checksum = "D00BD2BC8FB3EBB7E6AE076F3F1FF2AC9D5ED1805F004D0896C784D06C6645F1" },
{ name = "tom", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "tom", source = "hex", outer_checksum = "0910EE688A713994515ACAF1F486A4F05752E585B9E3209D8F35A85B234C2719" },
{ name = "toml", version = "0.7.0", build_tools = ["mix"], requirements = [], otp_app = "toml", source = "hex", outer_checksum = "0690246A2478C1DEFD100B0C9B89B4EA280A22BE9A7B313A8A058A2408A2FA70" },
{ name = "wisp", version = "1.6.0", build_tools = ["gleam"], requirements = ["directories", "exception", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "AE1C568FE30718C358D3B37666DF0A0743ECD96094AD98C9F4921475075F660A" },
{ name = "yamerl", version = "0.10.0", build_tools = ["rebar3"], requirements = [], otp_app = "yamerl", source = "hex", outer_checksum = "346ADB2963F1051DC837A2364E4ACF6EB7D80097C0F53CBDC3046EC8EC4B4E6E" },
]
[requirements]
glaml = { version = ">= 3.0.2 and < 4.0.0" }
gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
lustre = { version = ">= 5.0.2 and < 6.0.0" }
lustre_dev_tools = { version = ">= 1.7.1 and < 2.0.0" }
lustre_ssg = { git = "https://github.com/lustre-labs/ssg.git", ref = "v0.11.0" }
mdex = { version = ">= 0.6.1 and < 1.0.0" }
simplifile = { version = ">= 2.2.1 and < 3.0.0" }
tom = { version = ">= 1.1.1 and < 2.0.0" }

26
website/src/md.ex ノーマルファイル
ファイルの表示

@ -0,0 +1,26 @@
defmodule Parse do
def md_to_html(a) do
import MDEx
MDEx.to_html!(a, extension: [
strikethrough: true,
tagfilter: true,
table: true,
autolink: true,
tasklist: true,
footnotes: true,
shortcodes: true,
],
parse: [
smart: true,
relaxed_tasklist_matching: true,
relaxed_autolinks: true
],
render: [
github_pre_lang: true,
unsafe_: true,
],
features: [
sanitize: true
])
end
end

2
website/src/md.gleam ノーマルファイル
ファイルの表示

@ -0,0 +1,2 @@
@external(erlang, "Elixir.Parse", "md_to_html")
pub fn md_to_html(md: String) -> a

67
website/src/pages/doc.gleam ノーマルファイル
ファイルの表示

@ -0,0 +1,67 @@
import gleam/list
import gleam/string
import lustre/attribute
import lustre/element
import lustre/element/html
import md
import post
pub fn page(p: post.Post, doc_pages_list) -> element.Element(a) {
html.div([attribute.class("flex flex-col")], [
html.div([attribute.class("block sm:hidden h-10 sticky top-12 flex py-2 px-4 border-b border-b-zinc-300 w-full gap-2 backdrop-blur-sm bg-zinc-300/50 z-50")], [
html.label([attribute.for("sidebar-toggle"), attribute.class("cursor-pointer")], [
element.unsafe_raw_html("", "tag", [], "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" class=\"fill-black\"><path d=\"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z\"/></svg>"),
]),
html.span([], [element.text(p.title)])
]),
html.div([attribute.class("grid sm:flex")], [
html.input([attribute.type_("checkbox"), attribute.id("sidebar-toggle"), attribute.class("peer hidden")]),
html.div([attribute.class("border-r border-r-zinc-300 col-start-1 row-start-1 sticky top-22 sm:top-12 h-full sm:h-svh bg-neutral-200 basis-3/5 transition-transform duration-300 -translate-x-full sm:translate-x-0 peer-checked:translate-x-0 z-30")], [
html.div([attribute.class("p-4 -mb-4 overflow-y-auto h-full")], [
html.h2([attribute.class("text-xl font-semibold mb-4")], [element.text("Sidebar")]),
html.ul([], list.map(doc_pages_list, fn(post: #(String, post.Post)) {
html.li([attribute.class("mb-2")], [element.text(post.1.title)])
}))
])
]),
html.main([attribute.class("col-start-1 row-start-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:bg-black/30 px-4 pt-2")], [
html.h1([], [element.text(p.title)]),
// todo: add date of publishing
//html.time([], [])
//html.small([], [element.text({{p.contents |> string.split(" ") |> list.length} / 200} |> int.to_string <> " min read")]),
element.unsafe_raw_html("namespace", "Tag", [], md.md_to_html(p.contents))
])
])
])
}
fn page_(p: post.Post, doc_pages_list) -> element.Element(a) {
html.div([attribute.class("relative h-screen flex")], [
html.div([attribute.class("-mt-2 -mx-4 py-2 px-4 border-b border-b-zinc-300 flex gap-2 font-semibold")], [
html.label([attribute.for("sidebar-toggle"), attribute.class("cursor-pointer")], [
element.unsafe_raw_html("", "tag", [], "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" class=\"fill-black\"><path d=\"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z\"/></svg>"),
]),
html.span([], [element.text(p.title)])
]),
html.div([attribute.class("relative flex")], [
html.div([attribute.class("absolute top-0 left-0 h-full bg-gray-200 w-64 transition-transform duration-300 -translate-x-full peer-checked:translate-x-0 z-30")], [
html.div([attribute.class("p-4")], [
html.h2([attribute.class("text-xl font-semibold mb-4")], [element.text("Sidebar")]),
html.ul([], [
html.li([attribute.class("mb-2")], [element.text("Test")])
])
])
]),
html.input([attribute.type_("checkbox"), attribute.id("sidebar-toggle"), attribute.class("peer hidden")]),
html.main([attribute.class("flex-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:opacity-50")], [
html.h1([], [element.text(p.title)]),
// todo: add date of publishing
//html.time([], [])
//html.small([], [element.text({{p.contents |> string.split(" ") |> list.length} / 200} |> int.to_string <> " min read")]),
//element.unsafe_raw_html("namespace", "Tag", [], md.md_to_html(p.contents))
])
])
])
}

ファイルの表示

@ -3,7 +3,7 @@ import lustre/element
import lustre/element/html
pub fn page() -> element.Element(a) {
html.div([attribute.class("flex flex-col gap-4")], [
html.main([attribute.class("flex flex-col gap-4 mx-4")], [
html.div([attribute.class("border-b border-b-zinc-300 gap-3 -mx-4 p-2 h-screen bg-radial-[at_100%_100%] from-pink-500 to-stone-50 dark:to-neutral-950 to-35% flex flex-col items-center justify-center")], [
html.div([attribute.class("gap-1 flex flex-col items-center")], [
html.span([attribute.class("flex flex-row items-center justify-center")], [

6
website/src/post.gleam ノーマルファイル
ファイルの表示

@ -0,0 +1,6 @@
import gleam/option
import glaml
pub type Post {
Post(name: String, title: String, slug: String, metadata: option.Option(glaml.Document), contents: String)
}

ファイルの表示

@ -1,16 +1,110 @@
import gleam/option
import gleam/dict
import gleam/io
import gleam/order
import gleam/list
import gleam/string
import lustre/attribute
import lustre/element
import lustre/element/html
import lustre/ssg
import lustre/ssg/djot
import tom
import simplifile
import glaml
import post
import pages/index
import pages/doc
const base_url = "https://rosettea.github.io/Hilbish/versions/new-website"
pub fn main() {
let assert Ok(files) = simplifile.get_files("./content")
let posts = list.map(files, fn(path: String) {
let assert Ok(ext) = path |> string.split(".") |> list.last
let slug = path |> string.replace("./content", "") |> string.drop_end({ext |> string.length()} + 1)
let assert Ok(name) = slug |> string.split("/") |> list.last
let assert Ok(content) = simplifile.read(path)
let frontmatter = djot.frontmatter(content)
let metadata = case frontmatter {
Ok(frntmtr) -> {
let assert Ok([metadata]) = glaml.parse_string(frntmtr)
option.Some(metadata)
}
Error(_) -> option.None
}
let content = djot.content(content)
let title = case metadata {
option.Some(metadata) -> {
case glaml.select_sugar(glaml.document_root(metadata), "title") {
Ok(glaml.NodeStr(s)) -> s
_ -> ""
}
}
option.None -> ""
}
let assert Ok(filename) = path |> string.split("/") |> list.last
#(slug, post.Post(name, title, slug, metadata, content))
})
let doc_pages = list.filter(posts, fn(page) {
let isdoc = is_doc_page(page.0)
io.debug(page.0)
io.debug(isdoc)
isdoc
}) |> list.filter(fn(page) {
case page.1.metadata {
option.Some(_) -> True
option.None -> False
}
}) |> list.sort(fn(p1, p2) {
io.debug(p1)
io.debug(p2)
let assert option.Some(p1_metadata) = p1.1.metadata
let p1_weight = case glaml.select_sugar(glaml.document_root(p1_metadata), "weight") {
Ok(glaml.NodeInt(w)) -> w
_ -> 0
}
let assert option.Some(p2_metadata) = p2.1.metadata
let p2_weight = case glaml.select_sugar(glaml.document_root(p2_metadata), "weight") {
Ok(glaml.NodeInt(w)) -> w
_ -> 0
}
case p1_weight == 0 {
True -> order.Eq
False -> {
case p1_weight < p2_weight {
True -> order.Lt
False -> order.Gt
}
}
}
})
let build = ssg.new("./public")
|> ssg.add_static_dir("static")
|> ssg.add_static_route("/", create_page(index.page()))
|> list.fold(posts, _, fn(config, post) {
let route = case post.1.name {
"_index" -> post.0 |> string.drop_end("_index" |> string.length())
_ -> post.0
}
let page = case is_doc_page(post.0) {
True -> doc.page(post.1, doc_pages)
False -> doc.page(post.1, doc_pages)
}
ssg.add_static_route(config, route, create_page(page))
})
|> ssg.use_index_routes
|> ssg.build
@ -23,6 +117,13 @@ pub fn main() {
}
}
fn is_doc_page(slug: String) {
let is_docs = case slug {
"/docs" <> _ -> True
_ -> False
}
}
fn create_page(content: element.Element(a)) -> element.Element(a) {
let description = "Something Unique. Hilbish is the new interactive shell for Lua fans. Extensible, scriptable, configurable: All in Lua."
@ -34,7 +135,7 @@ fn create_page(content: element.Element(a)) -> element.Element(a) {
]),
html.link([
attribute.rel("stylesheet"),
attribute.href("./tailwind.css")
attribute.href("/tailwind.css")
]),
html.title([], "Hilbish"),
html.meta([attribute.name("theme-color"), attribute.content("#ff89dd")]),
@ -48,12 +149,12 @@ fn create_page(content: element.Element(a)) -> element.Element(a) {
html.meta([attribute.content("https://rosettea.github.io/Hilbish/versions/new-website"), attribute.attribute("property", "og:url")])
]),
html.body([], [
html.nav([attribute.class("sticky top-0 w-full z-50 p-1 mb-2 border-b border-b-zinc-300 backdrop-blur-md")], [
html.div([attribute.class("flex mx-auto")], [
html.nav([attribute.class("flex sticky top-0 w-full z-50 border-b border-b-zinc-300 backdrop-blur-md h-12")], [
html.div([attribute.class("flex my-auto px-2")], [
html.div([], [
html.a([attribute.href("/"), attribute.class("flex items-center gap-1")], [
html.img([
attribute.src("./hilbish-flower.png"),
attribute.src("/hilbish-flower.png"),
attribute.class("h-6")
]),
html.span([
@ -65,7 +166,7 @@ fn create_page(content: element.Element(a)) -> element.Element(a) {
])
]),
]),
html.main([attribute.class("mx-4")], [content]),
content,
html.footer([attribute.class("py-4 px-6 flex flex-row justify-around border-t border-t-zinc-300")], [
html.div([attribute.class("flex flex-col")], [
html.a([attribute.href("/"), attribute.class("flex items-center gap-1")], [