mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
2c0b48370b
* feat(gen-docs): add documentation generation package with SassDoc and TypeDoc support Add new `@hugo-fixit/gen-docs` package that parses Hugo config (hugo.toml) and generates documentation. Includes SassDoc annotations for SCSS variables and mixins, TypeDoc config for TypeScript source docs, and a `.sassdocrc` configuration file. * docs(readme): add browsers support section * feat(gen-docs): add Hugo partials docs generation and fix config empty sections - Add partial-parser.ts: parses Hugo partial comment blocks (@param/@return/@example) - Add partials.ts renderer: generates grouped Markdown with param tables - Add `partials` subcommand with -t/-o options for template injection - Fix config-parser: empty TOML sections (library.js/library.css) now retain descriptions - Fix config-parser: correctly distinguish section-level vs key-level comments - Update README with partials subcommand documentation
20 lines
801 B
HTML
20 lines
801 B
HTML
{{- /*
|
|
Validate if the given path has a valid suffix.
|
|
@param Path string The path to validate.
|
|
@param Suffixes []string The list of valid suffixes.
|
|
@return bool True if the path has a valid suffix, false otherwise.
|
|
|
|
@example
|
|
{{- $suffixList := slice ".jpeg" ".jpg" ".png" ".gif" ".bmp" ".tif" ".tiff" ".webp" ".avif" ".svg" -}}
|
|
{{- $suffixValid := (dict "Path" .Path "Suffixes" $suffixList | partial "function/suffix-validation.html") -}}
|
|
*/ -}}
|
|
{{- $url := urls.Parse .Path -}}
|
|
{{- $path := path.Clean ((printf "%v%v" $url.Host $url.Path) | lower) -}}
|
|
{{- with $url.Scheme -}}
|
|
{{- $path = printf "%v://%v" . $path -}}
|
|
{{- end -}}
|
|
{{- $suffix := path.Ext $path -}}
|
|
{{- $suffixes := .Suffixes | default slice -}}
|
|
{{- $suffixValid := in $suffixes $suffix -}}
|
|
{{- return $suffixValid -}}
|