Crate hwpforge_blueprint

Crate hwpforge_blueprint 

Source
Expand description

HwpForge Blueprint: YAML-based style template system.

Blueprint is the design pattern layer in the Forge metaphor. It defines style templates (fonts, sizes, colors, spacing) in human-readable YAML that can be applied to Core documents.

§Architecture

foundation (HwpUnit, Color, Index<T>)
    |
    v
core (Document, Section, Paragraph, Run)
    |
    v
blueprint (THIS CRATE: Template, StyleRegistry, CharShape, ParaShape)
    |
    v
smithy-* (HWPX, HWP5, Markdown codecs)

Core contains document structure with style references (indices). Blueprint contains style definitions that those indices resolve to. This separation mirrors HTML (structure) + CSS (style).

§Quick Start

use hwpforge_blueprint::template::Template;
use hwpforge_blueprint::registry::StyleRegistry;
use hwpforge_blueprint::builtins::builtin_default;

// Load a built-in template
let template = builtin_default().unwrap();
assert_eq!(template.meta.name, "default");

// Convert to indexed registry for document rendering
let registry = StyleRegistry::from_template(&template).unwrap();
let body = registry.get_style("body").unwrap();
let char_shape = registry.char_shape(body.char_shape_id).unwrap();
assert_eq!(char_shape.font, "한컴바탕");

§Workflow

YAML template file
  -> Template::from_yaml()
    -> Inheritance resolution (DFS merge)
      -> StyleRegistry::from_template()
        -> Indexed CharShape/ParaShape collections

Re-exports§

pub use border_fill::Border;
pub use border_fill::BorderFill;
pub use border_fill::BorderSide;
pub use border_fill::Fill;
pub use border_fill::PartialBorderFill;

Modules§

border_fill
Border and fill types for paragraph and table styling.
builtins
Built-in templates embedded at compile time.
error
Error types for the Blueprint crate.
inheritance
Template inheritance resolution with DFS and circular detection.
registry
StyleRegistry: converts Template styles into indexed collections.
schema
JSON Schema generation for Template validation.
serde_helpers
Custom serde helpers for human-friendly YAML values.
style
Style types: character shapes, paragraph shapes, and their partial variants.
template
Template definition and YAML parsing.