Skip to content

Commit

Permalink
Merge pull request #688 from gethinode/validation
Browse files Browse the repository at this point in the history
Refine args handling
  • Loading branch information
markdumay authored Dec 30, 2023
2 parents 2b5b643 + b0c8326 commit d27c04d
Show file tree
Hide file tree
Showing 35 changed files with 136 additions and 87 deletions.
4 changes: 2 additions & 2 deletions data/structures/accordion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ arguments:
type: string
optional: true
comment: >-
ID of the accordion, defaults to accordion-n with a sequential number n.
ID of the accordion, defaults to `accordion-n` with a sequential number n.
always-open:
type: bool
optional: true
Expand All @@ -15,4 +15,4 @@ arguments:
class:
type: string
optional: true
comment: Class attribute of the accordion, e.g. w-50.
comment: Class attribute of the accordion, e.g. `w-50`.
2 changes: 1 addition & 1 deletion data/structures/badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ comment: >-
arguments:
title:
type: string
optional: true
optional: false
comment: >-
Title of the badge.
class:
Expand Down
20 changes: 13 additions & 7 deletions data/structures/button.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ arguments:
type: string
optional: true
comment: >-
Class attribute of the button element, e.g. p-5.
Class attribute of the button element, e.g. `p-5`.
color:
type: select
optional: true
Expand Down Expand Up @@ -48,7 +48,7 @@ arguments:
id:
type: string
optional: true
comment: ID of the button, to be used in the DOM.
comment: Identifier of the button, to be used in the DOM.
state:
type: select
optional: true
Expand All @@ -61,7 +61,7 @@ arguments:
- active
- inactive
size:
type: string
type: select
optional: true
default: md
comment: Size of the button.
Expand All @@ -85,7 +85,12 @@ arguments:
comment: >-
Assistive label for the button or badge. The label is applied
to the badge instead of the button when a badge has been defined.
The default value of the button aria-label is its title.
The default value of the button's assistive label is its title.
aria-label:
type: string
optional: true
comment: Alias for label.
group: shortcode
tooltip:
type: string
optional: true
Expand All @@ -108,7 +113,7 @@ arguments:
- link
- button
placement:
type: string
type: select
optional: true
default: top
comment: Position of the tooltip.
Expand All @@ -134,7 +139,7 @@ arguments:
- first
- last
justify:
type: string
type: select
optional: true
default: center
comment: Justification of the button title and icon.
Expand All @@ -149,7 +154,7 @@ arguments:
toast:
type: string
optional: true
comment: ID of the toast to display when the button is clicked.
comment: Identifier (ID) of the toast to display when the button is clicked.
clipboard:
type:
- string
Expand All @@ -174,6 +179,7 @@ arguments:
comment: >-
Dictionary of key-value pairs added as custom attributes to the button
element ('<a>').
group: partial
spacing:
type: bool
optional: true
Expand Down
14 changes: 11 additions & 3 deletions data/structures/card-group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ arguments:
- '*hugolib.pageForShortcode'
optional: true
comment: Context of the current page.
group: partial
title:
type: string
optional: true
comment: >-
Title of the card, replaces the title of the referenced page (if any).
comment: Title of the card group.
gutter:
type: int
optional: true
Expand All @@ -24,20 +24,24 @@ arguments:
options:
min: 0
max: 5
release: v0.19.0
list:
type:
- page.Pages
- resource.Resources
optional: true
comment: Array of pages to be rendered as cards.
group: partial
cards:
type: string
optional: true
comment: String of rendered cards.
group: partial
max:
type: int
optional: true
comment: Maximum number of cards to display.
group: partial
cols:
type: select
optional: true
Expand All @@ -51,23 +55,27 @@ arguments:
- "4"
- "5"
- "auto"
release: v0.19.0
paginate:
type: bool
optional: true
comment: >-
Flag indicating if pagination should be added to the card group, if the
list exceeds the maximum number of cards to display.
group: partial
href:
type: string
optional: true
comment: >-
address for the button or hyperlink. If set, a button is added if the
Address for the button or hyperlink. If set, a button is added if the
list exceeds the maximum number of cards to display.
group: partial
hrefTitle:
type: string
optional: true
comment: >-
Title of the button or hyperlink as companion to href.
group: partial
separator:
type: bool
optional: true
Expand Down
5 changes: 1 addition & 4 deletions data/structures/card.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,14 @@ arguments:
- string
- template.HTML
optional: true
parent: cascade
comment: >-
Description of the card.
group: partial
loading:
type: select
optional: true
default: eager
parent: cascade
default: eager
comment: >-
Loading behavior of the image. The loading of lazily loaded images is
deferred until the image is within scrolling range of the viewport. This
Expand All @@ -130,7 +129,6 @@ arguments:
thumbnail:
type: path
optional: true
parent: cascade
comment: >-
Thumbnail image url, displayed on top or the left of the card.
ratio:
Expand All @@ -157,7 +155,6 @@ arguments:
icon:
type: string
optional: true
parent: cascade
comment: >-
Font Awesome icon, displayed on top or the left of the card.
orientation:
Expand Down
2 changes: 2 additions & 0 deletions data/structures/carousel-item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ arguments:
- 4x3
- 16x9
- 21x9
group: partial
portrait:
type: bool
optional: true
Expand All @@ -32,6 +33,7 @@ arguments:
Flag to adjust the ratio from landscape to portrait. The image itself
is not rotated, only the crop area is adjusted. Not applicable to vector
graphics.
group: partial
loading:
type: select
default: eager
Expand Down
11 changes: 6 additions & 5 deletions data/structures/carousel.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
comment: >-
Displays a carousel of several responsive images (see the image shortcode for
more details). Add inner <img> elements to define individual image slides.
more details). Add inner `img` elements to define individual image slides.
arguments:
id:
type: string
optional: true
comment: >-
ID of the carousel, defaults to `carousel-` with a sequential number.
ID of the carousel, defaults to `carousel-n` with a sequential number `n`.
ratio:
type: string
type: select
optional: true
comment: >-
Ratio of the images. If set, the images are resized and cropped to match the
Expand All @@ -28,11 +28,12 @@ arguments:
Flag to adjust the ratio from landscape to portrait. The images themselves
are not rotated, only the crop area is adjusted. Not applicable to vector
graphics.
release: v0.18.3
class:
type: string
optional: true
comment: Class attribute of the carousel element, e.g. w-75.
comment: Class attribute of the carousel element, e.g. `w-75`.
body:
type: string
optional: false
comment: Inner <img> elements that define the individual image slides.
comment: Inner `img` elements that define the individual image slides.
2 changes: 1 addition & 1 deletion data/structures/command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ arguments:
type: select
optional: true
default: bash
comment: Type of shell
comment: Type of shell.
options:
values:
- bash
Expand Down
8 changes: 6 additions & 2 deletions data/structures/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ arguments:
optional: true
default: true
comment: >-
If unset, shows the filename only. By default, the full relative path is
shown.
If unset, shows the filename only. By default, the entire path (relative
to the base path) is shown.
id:
type: string
optional: true
comment: >-
ID of the collapse panel holding the code snippet, defaults to
`docs-collapse-n` with a sequential number `n` starting at `1`.
class:
type: string
optional: true
comment: Class attribute of the tab control that wraps the docs element.
8 changes: 7 additions & 1 deletion data/structures/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ comment: >-
Display a code example and render a preview of the same input. The shortcode
accepts the languages supported by Hugo's highlight function.
arguments:
id:
type: string
optional: true
comment: Identifier of the element’s container.
lang:
type: string
optional: true
default: markdown
comment: Language used to display the code.
comment: >-
Language used to display the code. Use `hugo` to process Hugo (escaped)
shortcodes.
show_markup:
type: bool
optional: true
Expand Down
15 changes: 8 additions & 7 deletions data/structures/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ arguments:
comment: >-
If unset, shows the panel with the code in collapsed state. By default,
the panel is expanded.
full:
type: string
full:
type: bool
optional: true
default: true
comment: >-
If unset, shows the filename only. By default, the full relative path is
shown.
If unset, shows the filename only. By default, the entire path (relative
to the base path) is shown.
id:
type: string
optional: true
comment: >-
ID of the collapse panel, defaults to `file-collapse-n` with a sequential
number `n` starting at 1.
Identifier of the collapse panel, defaults to `file-collapse-n` with a
sequential number `n` starting at 1.
class:
type: string
optional: true
comment: Class argument of the tab control.
comment: Class attribute of the tab control that wraps the file element.
15 changes: 12 additions & 3 deletions data/structures/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ arguments:
url:
type: string
optional: true
comment: Path or url of the image, e.g. `img/example.jpg`.
comment: >-
Path or url of the image, e.g. `img/example.jpg`. Images with multiple
color modes are expected to have a basename that ends with either `-dark`
or `-light`.
src:
type: string
optional: true
Expand All @@ -39,9 +42,12 @@ arguments:
type: bool
default: false
optional: true
comment: Flag indicating if the image should support color modes.
comment: >-
Flag indicating if the image should support color modes. If set, the
shortcode searches for images that having a matching color-mode suffix
such as `-light` or `-dark`.
ratio:
type: string
type: select
optional: true
comment: >-
Ratio of the image. If set, the image is resized and cropped to match the
Expand All @@ -62,6 +68,7 @@ arguments:
Flag to adjust the ratio from landscape to portrait. The image itself is
not rotated, only the crop area is adjusted. Not applicable to vector
graphics.
release: v0.18.3
loading:
type: select
default: eager
Expand All @@ -75,6 +82,7 @@ arguments:
values:
- eager
- lazy
release: v0.21.0
priority:
type: select
default: auto
Expand Down Expand Up @@ -102,6 +110,7 @@ arguments:
type: string
optional: true
comment: Class attributes of the wrapper element, e.g. `mx-auto`.
release: v0.18.3
class:
type: string
optional: true
Expand Down
4 changes: 2 additions & 2 deletions data/structures/link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ arguments:
position: 0
optional: true
comment: >-
Reference to either an external link (if it starts with http), a named
link (if it can be found in params.links), or internal reference.
Reference to either an external link (if it starts with `http`), a named
link (if it can be found in `params.links`), or internal reference.
Both external and internal references may include an anchor `#`.
name:
type: string
Expand Down
2 changes: 1 addition & 1 deletion data/structures/mark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ arguments:
optional: true
comment: >-
Theme color of the highlight. By default, the highlight uses the color of
the HTML mark function.
the HTML mark function (usually yellow).
options:
values:
- primary
Expand Down
Loading

0 comments on commit d27c04d

Please sign in to comment.