class

Hwaro::Content::Processors::Wikilinks::Index

Inherits Reference < Object

Page and file lookup for one page set. Read-only after construction except for the lazily built file index, behind the mutex (render workers share one index).

Constructors

new(pages : Enumerable(Models::Page), default_language : String, files_source : Proc(Array(Tuple(String, String))) = -> do [] of ::Tuple(String, String) end, warned : WarnLog = WarnLog.new)

files lists every published non-page file as {relative path, URL}; it is only called on the first file link that is not one of the source page's own bundle assets.

Source

Class methods

container_dir(page : Models::Page) : String

The directory a page sits in: a bundle or section index counts as living beside its siblings, in its directory's parent.

Source
keys_for(page : Models::Page, default_language : String) : Tuple(String, String) | Nil

{name, content path} a page answers to, lowercased: the file stem without extension and language suffix (the directory name for a bundle or section index), and the content-relative path without them. nil for the root index.

Source

Instance methods

resolve(target : String, source : Models::Page) : Models::Page | Nil
Source
resolve_file(target : String, source : Models::Page) : String | Nil

The URL of the file an embed names: one of the source page's own bundle assets (relative), else a published file anywhere.

Source