Rename project

This commit is contained in:
Mikko Ahlroth 2024-04-20 23:03:30 +03:00
parent d8e1b874bc
commit a634ef21ff
44 changed files with 144 additions and 165 deletions

View file

@ -1,19 +0,0 @@
image: ghcr.io/gleam-lang/gleam:v1.1.0-node-alpine
pages:
stage: deploy
environment: production
script:
- gleam deps download
- gleam docs build
- rm -rf public
- mkdir .public
- cp -r ./build/dev/docs/gloss/* .public
- mv .public public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
GIT_SUBMODULE_STRATEGY: recursive

View file

@ -1,4 +1,4 @@
Gloss, Gleam blog generator
Scriptorium, Gleam blog generator
Copyright © 2024 Mikko Ahlroth
This program is free software: you can redistribute it and/or modify

View file

@ -1,22 +1,20 @@
# gloss
# scriptorium
Gloss is a simple blog generator for Gleam, using [Lustre](https://hexdocs.pm/lustre) and
Scriptorium is a simple blog generator for Gleam, using [Lustre](https://hexdocs.pm/lustre) and
[lustre_ssg](https://hexdocs.pm/lustre_ssg).
Gloss runs on the JavaScript target and it's tested with Node.js.
Scriptorium runs on the JavaScript target and it's tested with Node.js.
<!-- [![Package Version](https://img.shields.io/hexpm/v/gloss)](https://hex.pm/packages/gloss) -->
<!-- [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/gloss/) -->
[![Package Version](https://img.shields.io/hexpm/v/scriptorium)](https://hex.pm/packages/scriptorium)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/scriptorium/)
## Quickstart
Gloss is not yet available on Hex. You can use it with a path dependency instead. Create a new
Gleam project, clone Gloss to some path, and add the following to `gleam.toml`:
To use Scriptorium, you will need to create a new Gleam project and add Scriptorium as a
dependency.
```toml
[dependencies]
gleam_stdlib = "~> 0.36 or ~> 1.0"
gloss = { path = "../path/to/gloss" }
```sh
gleam add scriptorium
```
To generate a default blog, use the following in your main file:
@ -25,9 +23,9 @@ To generate a default blog, use the following in your main file:
import gleam/result
import gleam/option
import gleam/io
import gloss/builder
import gloss/config.{type Configuration, Configuration}
import gloss/defaults
import scriptorium/builder
import scriptorium/config.{type Configuration, Configuration}
import scriptorium/defaults
pub fn main() {
let config =
@ -60,6 +58,6 @@ pub fn build(config: Configuration) {
## Documentation
- [Gloss Demo Blog](https://nicd.gitlab.io/gloss_blog)
- [User's Guide](https://nicd.gitlab.io/gloss_blog/guide.html)
- [Gloss API reference](https://nicd.gitlab.io/gloss)
- [Scriptorium Demo Blog](https://nicd.gitlab.io/scriptorium_blog)
- [User's Guide](https://nicd.gitlab.io/scriptorium_blog/guide.html)
- [Scriptorium API reference](https://hexdocs.pm/scriptorium)

View file

@ -1,4 +1,4 @@
name = "gloss"
name = "scriptorium"
version = "1.0.0"
target = "javascript"
gleam = "~> 1.1"
@ -8,10 +8,10 @@ gleam = "~> 1.1"
#
description = "A simple Gleam blog generator"
licences = ["AGPL-3.0-or-later"]
repository = { type = "gitlab", user = "Nicd", repo = "gloss" }
repository = { type = "gitlab", user = "Nicd", repo = "scriptorium" }
links = [
{ title = "User's Guide", href = "https://nicd.gitlab.io/gloss_blog/guide.html" },
{ title = "Demo Blog", href = "https://nicd.gitlab.io/gloss_blog" },
{ title = "User's Guide", href = "https://nicd.gitlab.io/scriptorium_blog/guide.html" },
{ title = "Demo Blog", href = "https://nicd.gitlab.io/scriptorium_blog" },
]
#
# For a full reference of all the available options, you can have a look at

View file

@ -1,7 +1,7 @@
import { DateTime } from "./priv/vendor/luxon/src/luxon.js";
import { Ok, Error } from "./gleam.mjs";
import { Date, parse_month } from "./gloss/utils/date.mjs";
import { Time } from "./gloss/utils/time.mjs";
import { Date, parse_month } from "./scriptorium/utils/date.mjs";
import { Time } from "./scriptorium/utils/time.mjs";
export function dateTimeInZone(dtStr, tz) {
const dt = DateTime.fromISO(dtStr, { zone: tz });

View file

@ -1,11 +1,11 @@
//// The builder contains convenience functions to interface with the different
//// parts of gloss, using the configuration to control what is done.
//// parts of scriptorium, using the configuration to control what is done.
import gleam/result
import gloss/compiler.{type CompileDatabase}
import gloss/config.{type Configuration}
import gloss/models/database.{type Database}
import gloss/rendering/database as render_database
import scriptorium/compiler.{type CompileDatabase}
import scriptorium/config.{type Configuration}
import scriptorium/models/database.{type Database}
import scriptorium/rendering/database as render_database
/// Something failed when building the blog.
pub type BuildError {

View file

@ -4,11 +4,11 @@
import gleam/dict.{type Dict}
import gleam/list
import gleam/option
import gloss/models/database.{type Database, type PostID}
import gloss/models/page.{type Page}
import gloss/models/post.{type Post}
import gloss/utils/marked
import gloss/utils/ordered_tree
import scriptorium/models/database.{type Database, type PostID}
import scriptorium/models/page.{type Page}
import scriptorium/models/post.{type Post}
import scriptorium/utils/marked
import scriptorium/utils/ordered_tree
/// Compiled post content: strings that contain HTML.
pub type PostContent {

View file

@ -1,11 +1,11 @@
//// The configuration is the main way to customize Gloss's behaviour.
//// The configuration is the main way to customize Scriptorium's behaviour.
import gleam/option
import gloss/compiler.{type CompileDatabase, type Compiler}
import gloss/models/database.{type Database}
import gloss/paths.{type PathConfiguration}
import gloss/rendering/database.{type RenderDatabase} as _
import gloss/rendering/views.{
import scriptorium/compiler.{type CompileDatabase, type Compiler}
import scriptorium/models/database.{type Database}
import scriptorium/paths.{type PathConfiguration}
import scriptorium/rendering/database.{type RenderDatabase} as _
import scriptorium/rendering/views.{
type BaseView, type FeedView, type ListPageView, type MetaView, type PageView,
type SinglePostView,
}
@ -35,7 +35,7 @@ pub type Writer =
/// View generators for the blog. These take the database and configuration and
/// must return a view function that is used for rendering.
///
/// See the `gloss/rendering/views` documentation for descriptions of the
/// See the `scriptorium/rendering/views` documentation for descriptions of the
/// individual views.
pub type Views {
Views(

View file

@ -2,20 +2,20 @@
//// blog quickly.
import gleam/uri
import gloss/compiler
import gloss/config.{type Configuration, Compiling, Configuration, Rendering}
import gloss/parser
import gloss/paths
import gloss/renderer
import gloss/rendering/views/base
import gloss/rendering/views/feed
import gloss/rendering/views/list_page
import gloss/rendering/views/meta
import gloss/rendering/views/page
import gloss/rendering/views/single_post
import gloss/writer
import scriptorium/compiler
import scriptorium/config.{type Configuration, Compiling, Configuration, Rendering}
import scriptorium/parser
import scriptorium/paths
import scriptorium/renderer
import scriptorium/rendering/views/base
import scriptorium/rendering/views/feed
import scriptorium/rendering/views/list_page
import scriptorium/rendering/views/meta
import scriptorium/rendering/views/page
import scriptorium/rendering/views/single_post
import scriptorium/writer
/// View generators that use the Gloss builtin views.
/// View generators that use the Scriptorium builtin views.
const default_views = config.Views(
base: base.generate,
meta: meta.generate,

View file

@ -5,12 +5,12 @@ import gleam/dict.{type Dict}
import gleam/list
import gleam/option.{None, Some}
import gleam/order.{type Order}
import gloss/models/menu.{type MenuItem}
import gloss/models/page.{type Page}
import gloss/models/post.{type Post, type Tag}
import gloss/utils/date.{type Month}
import gloss/utils/ordered_tree.{type OrderedTree}
import gloss/utils/uniqid.{type Generator, type UniqID}
import scriptorium/models/menu.{type MenuItem}
import scriptorium/models/page.{type Page}
import scriptorium/models/post.{type Post, type Tag}
import scriptorium/utils/date.{type Month}
import scriptorium/utils/ordered_tree.{type OrderedTree}
import scriptorium/utils/uniqid.{type Generator, type UniqID}
/// Internal post ID, generated automatically.
pub type PostID =

View file

@ -1,6 +1,6 @@
//// A static page in the blog that is not part of any post lists or archives.
import gloss/models/header.{type Header}
import scriptorium/models/header.{type Header}
pub type Page {
Page(title: String, slug: String, headers: List(Header), content: String)

View file

@ -3,10 +3,10 @@
import gleam/int
import gleam/option.{type Option}
import gleam/order.{type Order, Eq}
import gloss/models/header.{type Header}
import gloss/utils/date.{type Date}
import gloss/utils/luxon.{type DateTime}
import gloss/utils/time.{type Time, Time}
import scriptorium/models/header.{type Header}
import scriptorium/utils/date.{type Date}
import scriptorium/utils/luxon.{type DateTime}
import scriptorium/utils/time.{type Time, Time}
pub type PostedAt {
/// The post only had date information.

View file

@ -4,12 +4,12 @@ import gleam/list
import gleam/regex
import gleam/result
import gleam/string
import gloss/config.{type ParseError, ParseError}
import gloss/models/database.{type Database}
import gloss/parser/common
import gloss/parser/menu
import gloss/parser/page
import gloss/parser/post
import scriptorium/config.{type ParseError, ParseError}
import scriptorium/models/database.{type Database}
import scriptorium/parser/common
import scriptorium/parser/menu
import scriptorium/parser/page
import scriptorium/parser/post
import simplifile
/// The default path where input files are read from.

View file

@ -2,7 +2,7 @@ import gleam/bool
import gleam/list
import gleam/result
import gleam/string
import gloss/models/header.{type Header}
import scriptorium/models/header.{type Header}
/// The default file extension for source files.
pub const filename_postfix = ".md"

View file

@ -1,7 +1,7 @@
import gleam/list
import gleam/result
import gleam/string
import gloss/models/menu.{MenuItem}
import scriptorium/models/menu.{MenuItem}
/// Parse the content and return menu items.
pub fn parse(content: String) {

View file

@ -1,8 +1,8 @@
import gleam/list
import gleam/result
import gleam/string
import gloss/models/page.{type Page, Page}
import gloss/parser/common.{type ParseError, EmptyFile, HeaderMissing, try}
import scriptorium/models/page.{type Page, Page}
import scriptorium/parser/common.{type ParseError, EmptyFile, HeaderMissing, try}
/// Parse page from file data.
pub fn parse(filename: String, contents: String) -> Result(Page, ParseError) {

View file

@ -5,16 +5,16 @@ import gleam/option
import gleam/regex
import gleam/result
import gleam/string
import gloss/models/header.{type Header}
import gloss/models/post.{type Post, type PostedAt, type Tag, Post}
import gloss/parser/common.{
import scriptorium/models/header.{type Header}
import scriptorium/models/post.{type Post, type PostedAt, type Tag, Post}
import scriptorium/parser/common.{
type ParseError, DayNotInt, EmptyFile, HeaderMissing, InvalidDate,
MalformedFilename, MalformedHeader, MonthNotInt, YearNotInt, try,
}
import gloss/utils/date.{Date}
import gloss/utils/ints/day
import gloss/utils/luxon
import gloss/utils/time.{type Time, Time}
import scriptorium/utils/date.{Date}
import scriptorium/utils/ints/day
import scriptorium/utils/luxon
import scriptorium/utils/time.{type Time, Time}
/// Post filenames must match this regex.
pub const filename_regex = "^\\d{4}-\\d\\d-\\d\\d-.*\\.md$"

View file

@ -4,10 +4,10 @@
import gleam/int
import gleam/list
import gleam/string
import gloss/models/page.{type Page}
import gloss/models/post.{type Post}
import gloss/utils/date.{type Month}
import gloss/utils/ints/day
import scriptorium/models/page.{type Page}
import scriptorium/models/post.{type Post}
import scriptorium/utils/date.{type Month}
import scriptorium/utils/ints/day
const default_root = ""
@ -25,7 +25,7 @@ pub const default_feed = default_feed_file
pub type PathConfiguration {
PathConfiguration(
/// The root path where the blog will be accessible. With starting slash but
/// without trailing slash, e.g. `/gloss_blog`. Note that if the blog is
/// without trailing slash, e.g. `/scriptorium_blog`. Note that if the blog is
/// accessible without a subpath, this value should be `""`.
root: String,
/// The index path. Note that the first page of the index is always written

View file

@ -5,21 +5,21 @@ import gleam/dict.{type Dict}
import gleam/int
import gleam/list
import gleam/result
import gloss/compiler.{
import scriptorium/compiler.{
type CompileDatabase, type CompiledPage, type CompiledPost,
}
import gloss/config.{type Configuration}
import gloss/models/database.{type Database, type PostID, type PostWithID}
import gloss/rendering/database.{
import scriptorium/config.{type Configuration}
import scriptorium/models/database.{type Database, type PostID, type PostWithID}
import scriptorium/rendering/database.{
type RenderDatabase, type RenderedSinglePost, ListPage, RenderDatabase,
RenderedPage, RenderedSinglePost,
} as _
import gloss/rendering/views.{
import scriptorium/rendering/views.{
type BaseView, type FeedView, type ListPageView, type MetaView, type PageView,
type SinglePostView, ListInfo,
}
import gloss/utils/date
import gloss/utils/ordered_tree
import scriptorium/utils/date
import scriptorium/utils/ordered_tree
import lustre/element.{type Element}
/// Helper struct to pass all the used views to the rendering functions.

View file

@ -1,9 +1,9 @@
//// The render database stores the rendered posts and pages.
import gleam/dict.{type Dict}
import gloss/models/page.{type Page}
import gloss/models/post.{type Post}
import gloss/utils/date.{type Month}
import scriptorium/models/page.{type Page}
import scriptorium/models/post.{type Post}
import scriptorium/utils/date.{type Month}
import lustre/element.{type Element}
/// A post and its rendered content.

View file

@ -1,6 +1,6 @@
import gloss/compiler.{type CompiledPage, type CompiledPost}
import gloss/models/page
import gloss/models/post
import scriptorium/compiler.{type CompiledPage, type CompiledPost}
import scriptorium/models/page
import scriptorium/models/post
import lustre/element.{type Element}
/// The base view renders the base page layout.

View file

@ -4,11 +4,11 @@ import gleam/int
import gleam/list
import gleam/option
import gleam/string
import gloss/config.{type Configuration}
import gloss/models/database.{type Database}
import gloss/models/menu.{type MenuItem}
import gloss/utils/date
import gloss/utils/ordered_tree
import scriptorium/config.{type Configuration}
import scriptorium/models/database.{type Database}
import scriptorium/models/menu.{type MenuItem}
import scriptorium/utils/date
import scriptorium/utils/ordered_tree
import lustre/attribute.{attribute, href, id, name, rel, role, style, type_}
import lustre/element.{type Element, text}
import lustre/element/html.{
@ -107,7 +107,7 @@ fn view(
text(", "),
a([href("https://hexdocs.pm/lustre")], [text("Lustre")]),
text(", "),
a([href("https://gitlab.com/Nicd/gloss")], [text("Gloss")]),
a([href("https://gitlab.com/Nicd/scriptorium")], [text("Scriptorium")]),
]),
]),
]),

View file

@ -1,10 +1,10 @@
import gleam/list
import gleam/option
import gloss/compiler.{type CompiledPost}
import gloss/config.{type Configuration}
import gloss/models/database.{type Database}
import gloss/models/post
import gloss/utils/luxon
import scriptorium/compiler.{type CompiledPost}
import scriptorium/config.{type Configuration}
import scriptorium/models/database.{type Database}
import scriptorium/models/post
import scriptorium/utils/luxon
import lustre/attribute.{attribute}
import lustre/element
import lustre/ssg/atom.{
@ -35,10 +35,10 @@ pub fn generate(_db: Database, config: Configuration) {
]),
generator(
[
attribute("uri", "https://gitlab.com/Nicd/gloss"),
attribute("uri", "https://gitlab.com/Nicd/scriptorium"),
attribute("version", "1.0.0"),
],
"Gloss",
"Scriptorium",
),
rights(config.rendering.copyright),
..list.map(posts, fn(post) {

View file

@ -1,8 +1,8 @@
import gleam/list
import gloss/config.{type Configuration}
import gloss/models/database.{type Database}
import gloss/rendering/views.{type ListInfo}
import gloss/rendering/views/nav
import scriptorium/config.{type Configuration}
import scriptorium/models/database.{type Database}
import scriptorium/rendering/views.{type ListInfo}
import scriptorium/rendering/views/nav
import lustre/attribute.{attribute, class}
import lustre/element
import lustre/element/html.{footer, nav}

View file

@ -2,11 +2,11 @@ import gleam/dict
import gleam/list
import gleam/option
import gleam/result
import gloss/config.{type Configuration}
import gloss/models/database.{type Database}
import gloss/models/page
import gloss/models/post
import gloss/rendering/views.{type PageType, Other, Page, Post}
import scriptorium/config.{type Configuration}
import scriptorium/models/database.{type Database}
import scriptorium/models/page
import scriptorium/models/post
import scriptorium/rendering/views.{type PageType, Other, Page, Post}
import lustre/attribute
import lustre/element/html

View file

@ -1,7 +1,7 @@
import gleam/int
import gleam/list
import gloss/config.{type Configuration}
import gloss/rendering/views.{type ListInfo}
import scriptorium/config.{type Configuration}
import scriptorium/rendering/views.{type ListInfo}
import lustre/attribute.{attribute, href}
import lustre/element.{text}
import lustre/element/html.{a, li, span, ul}

View file

@ -1,6 +1,6 @@
import gloss/compiler.{type CompiledPage}
import gloss/config.{type Configuration}
import gloss/models/database.{type Database}
import scriptorium/compiler.{type CompiledPage}
import scriptorium/config.{type Configuration}
import scriptorium/models/database.{type Database}
import lustre/attribute.{attribute, class}
import lustre/element.{text}
import lustre/element/html.{article, div, h2, header}

View file

@ -1,12 +1,12 @@
import gleam/list
import gleam/option
import gloss/compiler.{type CompiledPost}
import gloss/config.{type Configuration}
import gloss/models/database.{type Database}
import gloss/models/post.{type Post}
import gloss/utils/date
import gloss/utils/luxon
import gloss/utils/time
import scriptorium/compiler.{type CompiledPost}
import scriptorium/config.{type Configuration}
import scriptorium/models/database.{type Database}
import scriptorium/models/post.{type Post}
import scriptorium/utils/date
import scriptorium/utils/luxon
import scriptorium/utils/time
import lustre/attribute.{attribute, class, href}
import lustre/element.{type Element, text}
import lustre/element/html.{

View file

@ -2,7 +2,7 @@ import gleam/bool
import gleam/int
import gleam/order.{type Order, Eq}
import gleam/string
import gloss/utils/ints/day.{type Day}
import scriptorium/utils/ints/day.{type Day}
pub type Month {
Jan

View file

@ -1,7 +1,7 @@
//// Bindings to the Luxon library.
import gloss/utils/date.{type Date}
import gloss/utils/time.{type Time}
import scriptorium/utils/date.{type Date}
import scriptorium/utils/time.{type Time}
/// Luxon DateTime.
pub type DateTime

View file

@ -1,6 +1,6 @@
//// Bindings to the marked.js library.
import gloss/internal/utils/object.{type Object}
import scriptorium/internal/utils/object.{type Object}
/// Marked.js options object.
pub type Options =

View file

@ -1,8 +1,8 @@
import gleam/uri
import gloss/internal/utils/meta_url
import gloss/internal/utils/path
import scriptorium/internal/utils/meta_url
import scriptorium/internal/utils/path
/// Get the path to the `priv` directory of `gloss`.
/// Get the path to the `priv` directory of `scriptorium`.
pub fn path() -> String {
let assert Ok(meta_url) = uri.parse(meta_url.get())

View file

@ -1,8 +1,8 @@
import gleam/int
import gleam/order.{type Order, Eq}
import gleam/string
import gloss/utils/ints/hour.{type Hour}
import gloss/utils/ints/minute.{type Minute}
import scriptorium/utils/ints/hour.{type Hour}
import scriptorium/utils/ints/minute.{type Minute}
pub type Time {
Time(hours: Hour, minutes: Minute)

View file

@ -4,9 +4,9 @@ import gleam/dict
import gleam/list
import gleam/result
import gleam/string
import gloss/config.{type Configuration, WriteError}
import gloss/rendering/database.{type RenderDatabase} as _
import gloss/utils/priv
import scriptorium/config.{type Configuration, WriteError}
import scriptorium/rendering/database.{type RenderDatabase} as _
import scriptorium/utils/priv
import lustre/element
import lustre/ssg
import lustre/ssg/xml