scriptorium/config
The configuration is the main way to customize Scriptorium’s behaviour.
Types
Author related configuration.
pub type Author {
Author(
name: String,
email: option.Option(String),
url: option.Option(String),
)
}
Constructors
-
Author( name: String, email: option.Option(String), url: option.Option(String), )
Arguments
- name
-
Name of the author.
-
Email address of the author, used in the feed’s author information.
- url
-
Website URL of the author, used in the feed’s author information and added as a
rel="me"
link in the base layout.
Compiling related configuration.
pub type Compiling {
Compiling(
database_compiler: fn(
database.Database,
fn(String, database.Database) -> String,
) -> compiler.CompileDatabase,
item_compiler: fn(String, database.Database) -> String,
)
}
Constructors
-
Compiling( database_compiler: fn( database.Database, fn(String, database.Database) -> String, ) -> compiler.CompileDatabase, item_compiler: fn(String, database.Database) -> String, )
Arguments
- database_compiler
-
The compiler to use for compiling the database.
- item_compiler
-
The compiler to use for compiling individual items.
pub type Configuration {
Configuration(
blog_name: String,
blog_url: String,
author: Author,
l10n: Localization,
compiling: Compiling,
rendering: Rendering,
paths: paths.PathConfiguration,
parser: fn(Configuration) -> Result(
database.Database,
ParseError,
),
writer: fn(database.RenderDatabase, Configuration) -> Result(
Nil,
WriteError,
),
output_path: String,
)
}
Constructors
-
Configuration( blog_name: String, blog_url: String, author: Author, l10n: Localization, compiling: Compiling, rendering: Rendering, paths: paths.PathConfiguration, parser: fn(Configuration) -> Result( database.Database, ParseError, ), writer: fn(database.RenderDatabase, Configuration) -> Result( Nil, WriteError, ), output_path: String, )
Arguments
- blog_name
-
Name of the blog.
- blog_url
-
Absolute URL of the blog, this is where you are deploying it.
- output_path
-
The folder to write the output into.
Localization related configuration.
pub type Localization {
Localization(language: String, context: context.Context)
}
Constructors
-
Localization(language: String, context: context.Context)
Arguments
- language
-
Language code of the blog, meaning the language of the content you are writing. The language code must be according to https://datatracker.ietf.org/doc/html/rfc5646.
- context
-
Context to use for gettext operations for translating built-in strings.
An error occurred when parsing input files.
pub type ParseError {
ParseError(err: String)
}
Constructors
-
ParseError(err: String)
The parser
pub type Parser =
fn(Configuration) -> Result(database.Database, ParseError)
Renders the content of the database into HTML.
pub type Renderer =
fn(database.Database, compiler.CompileDatabase, Configuration) -> database.RenderDatabase
Rendering related configuration.
pub type Rendering {
Rendering(
renderer: fn(
database.Database,
compiler.CompileDatabase,
Configuration,
) -> database.RenderDatabase,
views: Views,
copyright: String,
posts_per_page: Int,
posts_in_feed: Int,
)
}
Constructors
-
Rendering( renderer: fn( database.Database, compiler.CompileDatabase, Configuration, ) -> database.RenderDatabase, views: Views, copyright: String, posts_per_page: Int, posts_in_feed: Int, )
Arguments
- renderer
-
The renderer to use.
- views
-
The view generators to use.
- copyright
-
The copyright statement of the blog, used in the footer and the feed.
- posts_per_page
-
How many posts to show per page.
- posts_in_feed
-
How many posts to render in the feed.
View generators for the blog. These take the database and configuration and must return a view function that is used for rendering.
See the scriptorium/rendering/views
documentation for descriptions of the
individual views.
pub type Views {
Views(
base: fn(database.Database, Configuration) -> fn(
@internal Element(Nil),
List(@internal Element(Nil)),
String,
) -> @internal Element(Nil),
meta: fn(database.Database, Configuration) -> fn(
views.PageType,
) -> List(@internal Element(Nil)),
single_post_full: fn(database.Database, Configuration) -> fn(
compiler.CompiledPost,
) -> @internal Element(Nil),
single_post_list: fn(database.Database, Configuration) -> fn(
compiler.CompiledPost,
) -> @internal Element(Nil),
page: fn(database.Database, Configuration) -> fn(
compiler.CompiledPage,
) -> @internal Element(Nil),
list_page: fn(database.Database, Configuration) -> fn(
views.ListInfo,
) -> @internal Element(Nil),
feed: fn(database.Database, Configuration) -> fn(
List(compiler.CompiledPost),
) -> @internal Element(Nil),
)
}
Constructors
-
Views( base: fn(database.Database, Configuration) -> fn( @internal Element(Nil), List(@internal Element(Nil)), String, ) -> @internal Element(Nil), meta: fn(database.Database, Configuration) -> fn(views.PageType) -> List( @internal Element(Nil), ), single_post_full: fn(database.Database, Configuration) -> fn( compiler.CompiledPost, ) -> @internal Element(Nil), single_post_list: fn(database.Database, Configuration) -> fn( compiler.CompiledPost, ) -> @internal Element(Nil), page: fn(database.Database, Configuration) -> fn( compiler.CompiledPage, ) -> @internal Element(Nil), list_page: fn(database.Database, Configuration) -> fn( views.ListInfo, ) -> @internal Element(Nil), feed: fn(database.Database, Configuration) -> fn( List(compiler.CompiledPost), ) -> @internal Element(Nil), )
Arguments
- single_post_full
-
View for a single post that is rendered on its own.
- single_post_list
-
View for a single post rendered as part of a list.
An error occurred when writing the rendered results into files.
pub type WriteError {
WriteError(err: String)
}
Constructors
-
WriteError(err: String)
Writes the rendered HTML into files.
pub type Writer =
fn(database.RenderDatabase, Configuration) -> Result(
Nil,
WriteError,
)