module

Utils

Class methods

content_globs(base_path : Path) : Array(String)

Glob patterns for markdown, html and pandoc content under a base path

Source
create_content_file(sources : Hash(String, String), base : Path, kind : String) : Markdown::File | Nil

Create the right content file for a source based on its extension kind is used in error messages (e.g. "post", "page")

Source
find_all(path, extension)

Find all files with given extension in path, if two files are alternative languages of one another they are grouped together.

Source
lang_suffix(lang : String) : String

Suffix to append to a filename for a given language (empty for the default language, ".#{lang}" otherwise)

Source
output_prefix

The configured output directory with a trailing slash, for building URL prefixes (e.g. "output/", "public/site/")

Source
parallel_chunks(inputs : Array(String), chunk_size : Int32 = 100, &block : Array(String), Int32 -> T) : Array(T) forall T

Process inputs in parallel chunks, returning per-chunk results in order. Errors in a chunk are logged and that chunk is skipped.

Source
should_skip_file?(base_path : Path) : Bool

Filter out files from directories that correspond to disabled features

Source
slugify(string)
Source
text_excerpt(html : String, limit = 200) : String

Plain-text excerpt of an HTML fragment, for meta description tags: strips tags via lexbor, collapses whitespace, and truncates to at most limit characters at a word boundary with an ellipsis.

Source
titlecase(string)
Source
word_count(html : String) : Int32

Word count of an HTML fragment's text, for reading-time estimates in themes. Tags are replaced by spaces first: lexbor joins text at block boundaries without whitespace, which would merge the last word of one block into the first of the next.

Source