Skip to content

Commit

Permalink
feat(params): add example property (#72)
Browse files Browse the repository at this point in the history
feat(hugo/shortcode-params): add `example` property

Closes #70, #71
  • Loading branch information
razonyang authored Oct 11, 2024
1 parent b100768 commit a0ac8be
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ other = "Context"
[parameter_default]
other = "Default"

[parameter_example]
other = "Example"

[parameter_heading]
other = "Parameters"

Expand Down
3 changes: 3 additions & 0 deletions i18n/vi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ other = "Context"
[parameter_default]
other = "Default"

[parameter_example]
other = "Example"

[parameter_heading]
other = "Parameters"

Expand Down
3 changes: 3 additions & 0 deletions i18n/zh-hans.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ other = "上下文"
[parameter_default]
other = "默认值"

[parameter_example]
other = "示例"

[parameter_heading]
other = "参数"

Expand Down
3 changes: 3 additions & 0 deletions i18n/zh-hant.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ other = "默認值"
[parameter_heading]
other = "參數"

[parameter_example]
other = "示例"

[parameter_name]
other = "名稱"

Expand Down
8 changes: 5 additions & 3 deletions layouts/shortcodes/hugo/shortcode-params.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,25 @@
{{- end }}
{{- printf "%s %s\n" (strings.Repeat $paramHeadingLevel "#") $name }}
{{- printf
"| %s | %s | %s | %s | %s | %s |\n"
"| %s | %s | %s | %s | %s | %s | %s |\n"
(i18n "parameter_position")
(i18n "parameter_name")
(i18n "parameter_type")
(i18n "parameter_required")
(i18n "parameter_default")
(i18n "parameter_since")
(i18n "parameter_example")
}}
{{- printf "| --- | :-: | :-: | :-: | :-: | :-: |\n" }}
{{- printf "| --- | :-: | :-: | :-: | :-: | :-: | :-: |\n" }}
{{- printf
"| %s | %s | %s | %s | %s | %s |\n"
"| %s | %s | %s | %s | %s | %s | %s |\n"
(cond (isset . "position") (printf "`#%d`" .position) "-")
$name
$type
(cond (default false .required) "✓" "-")
(cond (isset . "default") (printf "`%s`" (string .default)) "-")
(cond (isset . "since") (printf "`%s`" (string .since)) "-")
(cond (isset . "example") (printf "`%s`" (string .example)) "-")
}}
{{- printf "\n" }}
{{- with .description }}
Expand Down
8 changes: 5 additions & 3 deletions layouts/shortcodes/params.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,25 @@
{{- end }}
{{- printf "%s %s\n" (strings.Repeat $paramHeadingLevel "#") $name }}
{{- printf
"| %s | %s | %s | %s | %s | %s |\n"
"| %s | %s | %s | %s | %s | %s | %s |\n"
(i18n "parameter_name")
(i18n "parameter_context")
(i18n "parameter_type")
(i18n "parameter_required")
(i18n "parameter_default")
(i18n "parameter_since")
(i18n "parameter_example")
}}
{{- printf "| --- | :-: | :-: | :-: | :-: | :-: |\n" }}
{{- printf "| --- | :-: | :-: | :-: | :-: | :-: | :-: |\n" }}
{{- printf
"| %s | %s | %s | %s | %s | %s |\n"
"| %s | %s | %s | %s | %s | %s | %s |\n"
$name
(cond (not $ctx) "-" $ctx | printf "`%s`")
$type
(cond (default false .required) "✓" "-")
(cond (isset . "default") (printf "`%s`" (string .default)) "-")
(cond (isset . "since") (printf "`%s`" (string .since)) "-")
(cond (isset . "example") (printf "`%s`" (string .example)) "-")
}}
{{- printf "\n" }}
{{- with .description }}
Expand Down

0 comments on commit a0ac8be

Please sign in to comment.