Skip to content

feat: text passes through and a name is substituted - #1

Open
juliantellez wants to merge 1 commit into
mainfrom
feat-text-and-substitution
Open

juliantellez wants to merge 1 commit into
mainfrom
feat-text-and-substitution

Conversation

@juliantellez

Copy link
Copy Markdown
Contributor

What. Weft turns a template and a data object into a string. Plain text passes through unchanged. A tag such as {{ name }} renders the value of that name from the data.

Why. This is step 1 of the path. The repository held only a readme, so this step stands the package up: package.json, a strict tsconfig.json, vitest, and a pipeline job that runs the same command on every pull request. Node runs the TypeScript directly, so there is no build step.

The parser returns text and value pieces only. Dotted paths, loops, conditions and HTML escaping come in the later steps.

One thing goes beyond the step, and it is small. A name that is not in the data throws. The design says a missing value is an error, never an empty string. Without that guard this step renders the word undefined, which is the failure mode step 2 exists to stop.

Proof. npm test reports 12 passed in 383 ms. I mutated three things and watched each one go red: the trim of the tag name (8 tests failed), the missing name guard (1 test failed), and the trailing text piece (6 tests failed). Each source file is byte identical to the version before the mutation.

@juliantellez juliantellez self-assigned this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant