refactor: split template helpers and slug utils out of markdown.go#459
refactor: split template helpers and slug utils out of markdown.go#459Caesarsage wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Caesarsage The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Only wanna understand your intention that why is |
| // kebabCase lowercases and slugifies any string into a kebab-case identifier | ||
| // used for directory and file names. | ||
| func kebabCase(s string) string { | ||
| return strings.Trim(anchorRegex.ReplaceAllString(strings.ToLower(s), "-"), "-") |
There was a problem hiding this comment.
operationSlug and kebabCase have identical implementations. is keeping them separate intentional to allow independent divergence later, or should operationSlug just assign to kebabCase
Two design choices, each with trade-offs: On the separate file: On |
|
Make sense. |
Pure relocation; no behavior change. Tests pass without golden updates.
template_helpers.goholds theresource.tmplparse block +escape,hugoRef, and their regex vars.anchor,kebabCase,kebabName,groupVersionString,operationSlug,constValueFor) move into the existingutil.go.markdown.godrops the moved symbols + now-unused imports.markdown.gohad grown to ~950 lines mixing view-model, writer methods, slug helpers, and template primitives. The extraction lets each file have one concern.Sets up cleaner ground for the upcoming #440 PRs.