class

Hwaro::Services::Exporters::Base

Inherits Reference < Object

Constants

INDEX_PAGE_RE = /\A_?index(?:\.[^.\/]+)?\.(?:md|markdown)\z/

index.md, _index.md and their translations: the pages whose directory is a bundle (or section) with files of its own.

INTERNAL_LINK_RE = /\[([^\]]*)\]\(@\/([^\)]+)\)/
PROTECTED_SOURCE_DIRS = ["content", "templates", "static", "data", "i18n", "themes", "archetypes", ".git"] of ::String

Project directories that hold SOURCES, never export output. The exporters write each file with a plain File.write, so a destination that lands on one of these rewrites the project in place — front matter re-serialized into the target's dialect, comment lines dropped, @/page.md internal links flattened — with no backup and exit 0. Matching is on the RESOLVED path, so a destination that merely shares a prefix with one of these names (-o contents, -o static-site) is unaffected.

REFERENCE_DEF_RE = /^( {0,3}\[[^\]]+\]:[ \t]*)@\/(\S+)/m

A reference-style link definition ([ref]: @/posts/a.md "Title"), which the build resolves exactly like an inline link.

TOML_FRONTMATTER_RE = Utils::FrontmatterScanner::TOML_FRONTMATTER_RE
YAML_FRONTMATTER_RE = Utils::FrontmatterScanner::YAML_FRONTMATTER_RE

Class methods

guard_output_dir!(output_dir : String, content_dir : String) : Nil

Reject an export destination that isn't a safe place to write into.

hwaro build has guarded its -o since it started wiping the directory (Phases::Initialize#guard_output_dir!), but tool export had no check at all: hwaro tool export hugo -o . resolved every destination straight back onto the source file it had just read and overwrote the whole of content/, reporting success.

Unlike the build guard this one deliberately PERMITS a repository root and a non-empty directory: exporting into a sibling checkout (-o ../my-hugo-site) is the entire point of the command.

Source

Instance methods

dry_run

When set, the run resolves and reports every destination (counts, manifest) but writes nothing to disk.

Source
dry_run=(dry_run : Bool)

When set, the run resolves and reports every destination (counts, manifest) but writes nothing to disk.

Source
file_actions

Per-file manifest of this run, in write order. Unlike import, an export OVERWRITES an existing destination by design (re-exporting into the same directory is the normal refresh workflow) — the manifest marks those rows overwritten so the caller can see exactly which pre-existing files a run replaced.

Source
run(options : Config::Options::ExportOptions) : ExportResult
Source