Skip to content

Commit

Permalink
Merge pull request #670 from gethinode/validation
Browse files Browse the repository at this point in the history
Refactor argument validation and documentation
  • Loading branch information
markdumay authored Dec 24, 2023
2 parents 2d6c3c7 + 44ace26 commit 865898a
Show file tree
Hide file tree
Showing 13 changed files with 452 additions and 183 deletions.
173 changes: 173 additions & 0 deletions data/structures/card.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
comment: >-
Displays a Bootstrap card. Either specify a valid path, or set the arguments
title, href, header, description, and thumbnail individually. The latter
arguments override any page attributes.
arguments:
title:
type: string
optional: true
comment: >-
Title of the card.
path:
type: path
optional: true
comment: >-
Path of the page, override with other parameters.
href:
type: url
optional: true
comment: >-
Optional address for the button or hyperlink.
group: partial
class:
type: string
optional: true
parent: merge
comment: >-
Optional class attribute of the card element, e.g. “w-50”.
color:
type: select
optional: true
parent: cascade
comment: >-
Theme color of the card. By default, no color is specified.
options:
values:
- primary
- secondary
- success
- danger
- warning
- info
- light
- dark
- white
- black
- body
- body-tertiary
padding:
type: select
optional: true
default: auto
parent: cascade
comment: >-
Optional padding of the content.
options:
values:
- "0"
- "1"
- "2"
- "3"
- "4"
- "5"
- "auto"
gutter:
type: select
optional: true
default: "0"
parent: cascade
comment: >-
Gutter between columns in a group.
options:
values:
- "0"
- "1"
- "2"
- "3"
- "4"
- "5"
header:
type: select
optional: true
default: full
parent: cascade
comment: >-
Optional header components of the card, displayed in small caps.
options:
values:
- full
- publication
- tags
- none
footer:
type: select
optional: true
default: none
parent: cascade
comment: >-
Optional footer components of the card, displayed in small caps.
options:
values:
- full
- publication
- tags
- none
description:
type:
- string
- template.HTML
optional: true
comment: >-
Optional description of the card.
group: partial
loading:
type: select
optional: true
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
should reduce the initial loading time of the website. It is recommended
to lazily load only those images that are below the page fold.
options:
values:
- lazy
- eager
group: partial
thumbnail:
type: path
optional: true
comment: >-
Optional thumbnail image url, displayed on top or the left of the card.
ratio:
type: select
optional: true
comment: >-
Ratio of the thumbnail image, defaults to "16x9" (stacked orientation)
or "1x1" (horizontal orientation).
options:
values:
- 1x1
- 3x2
- 4x3
- 16x9
- 21x9
group: partial
alt:
type: string
optional: true
comment: >-
Alternate text for the thumbnail, uses "title" by default.
icon:
type: string
optional: true
comment: >-
Font Awesome icon, displayed on top or the left of the card.
orientation:
type: select
optional: true
default: stacked
parent: cascade
comment: >-
Placement of the thumbnail or icon.
options:
values:
- stacked
- horizontal
- horizontal-sm
- none
body:
optional: true
comment: >-
Optional description of the card.
group: shortcode
8 changes: 8 additions & 0 deletions exampleSite/hugo_stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@
"sub",
"sup",
"svg",
"table",
"tbody",
"td",
"th",
"thead",
"time",
"title",
"tr",
"ul",
"use"
],
Expand Down Expand Up @@ -358,6 +364,8 @@
"syntax-highlight",
"tab-content",
"tab-pane",
"table",
"table-responsive",
"tag-link",
"text-bg-body",
"text-bg-body-tertiary",
Expand Down
14 changes: 14 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,17 @@
translation: "Show"
- id: comments
translation: "Comments"

# Arguments
- id: name
translation: "Name"
- id: type
translation: "Type"
- id: required
translation: "Required"
- id: default
translation: "Default"
- id: comment
translation: "Comment"
- id: supportedValues
translation: "Supported values"
15 changes: 15 additions & 0 deletions i18n/nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,18 @@
translation: "Tonen"
- id: comments
translation: "Reacties"


# Arguments
- id: name
translation: "Naam"
- id: type
translation: "Type"
- id: required
translation: "Verplicht"
- id: default
translation: "Standaardwaarde"
- id: comment
translation: "Toelichting"
- id: supportedValues
translation: "Toegestane waarden"
Loading

0 comments on commit 865898a

Please sign in to comment.