j1-template 2023.7.0 → 2023.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/modules/searcher/procedures/topsearch.proc +2 -1
  3. data/_includes/themes/j1/procedures/global/create_bs_button.proc +0 -1
  4. data/_includes/themes/j1/procedures/global/create_word_cloud.proc +3 -2
  5. data/_includes/themes/j1/procedures/global/date-german.proc +2 -7
  6. data/_includes/themes/j1/procedures/global/get_category.proc +13 -19
  7. data/_includes/themes/j1/procedures/global/get_category_item.proc +29 -33
  8. data/_includes/themes/j1/procedures/global/get_documents_dir.proc +8 -8
  9. data/_includes/themes/j1/procedures/global/get_page_url.proc +9 -14
  10. data/_includes/themes/j1/procedures/global/select_color.proc +12 -17
  11. data/_includes/themes/j1/procedures/global/select_font_size.proc +31 -35
  12. data/_includes/themes/j1/procedures/global/select_icon_size.proc +38 -40
  13. data/_includes/themes/j1/procedures/global/select_location.proc +56 -59
  14. data/_includes/themes/j1/procedures/global/set_base_vars_folders.proc +2 -4
  15. data/_includes/themes/j1/procedures/global/set_image_block.proc +4 -2
  16. data/_includes/themes/j1/procedures/global/setup.proc +8 -3
  17. data/assets/data/masonry.html +13 -13
  18. data/assets/themes/j1/adapter/js/j1.js +39 -39
  19. data/assets/themes/j1/adapter/js/masterslider.js +2 -1
  20. data/assets/themes/j1/adapter/js/slick.js +13 -10
  21. data/assets/themes/j1/adapter/js/translator.js +62 -58
  22. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +70 -0
  23. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  24. data/assets/themes/j1/core/js/template.js +1339 -3
  25. data/assets/themes/j1/core/js/template.min.js +7 -7
  26. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  27. data/assets/themes/j1/modules/carousel/css/theme/uno.css +5 -0
  28. data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
  29. data/assets/themes/j1/modules/masonry/css/theme/readme +1 -0
  30. data/assets/themes/j1/modules/masterslider/css/theme/uno.css +2 -3
  31. data/assets/themes/j1/modules/masterslider/css/theme/uno.min.css +1 -1
  32. data/assets/themes/j1/modules/slick/lightbox/css/theme/uno.css +13 -2
  33. data/assets/themes/j1/modules/slick/lightbox/css/theme/uno.min.css +1 -1
  34. data/assets/themes/j1/modules/slick/lightbox/js/slick-lightbox.js +373 -347
  35. data/assets/themes/j1/modules/slick/slider/css/theme/uno.css +20 -51
  36. data/assets/themes/j1/modules/slick/slider/css/theme/uno.min.css +2 -2
  37. data/lib/j1/version.rb +1 -1
  38. data/lib/starter_web/Gemfile +2 -2
  39. data/lib/starter_web/README.md +5 -5
  40. data/lib/starter_web/_config.yml +1 -1
  41. data/lib/starter_web/_data/blocks/banner.yml +8 -9
  42. data/lib/starter_web/_data/blocks/footer.yml +8 -10
  43. data/lib/starter_web/_data/modules/masonry.yml +9 -1
  44. data/lib/starter_web/_data/modules/masterslider.yml +69 -116
  45. data/lib/starter_web/_data/modules/navigator_menu.yml +58 -51
  46. data/lib/starter_web/_data/resources.yml +3 -3
  47. data/lib/starter_web/_data/templates/feed.xml +1 -1
  48. data/lib/starter_web/_includes/attributes.asciidoc +1 -0
  49. data/lib/starter_web/_plugins/asciidoctor/callout.rb +2 -2
  50. data/lib/starter_web/_plugins/asciidoctor/masterslider-block.rb +1 -1
  51. data/lib/starter_web/_plugins/asciidoctor/slick-block.rb +1 -1
  52. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  53. data/lib/starter_web/assets/images/collections/books/biography/a_life_in_questions.jpg +0 -0
  54. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +5 -5
  55. data/lib/starter_web/index.html +6 -6
  56. data/lib/starter_web/package.json +1 -1
  57. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +0 -1
  58. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +148 -140
  59. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  60. data/lib/starter_web/utilsrv/package.json +1 -1
  61. metadata +3 -75
  62. data/assets/themes/j1/modules/carousel/js/carousel.js +0 -1517
  63. data/assets/themes/j1/modules/carousel/js/carousel.min.js +0 -57
  64. data/assets/themes/j1/modules/masonry/css/theme/uno.css +0 -35
  65. data/assets/themes/j1/modules/masonry/css/theme/uno.min.css +0 -15
  66. data/assets/themes/j1/modules/speak2me/LICENSE +0 -21
  67. data/assets/themes/j1/modules/speak2me/js/speak2me.js +0 -947
  68. data/assets/themes/j1/modules/speak2me/js/speak2me.min.js +0 -26
  69. data/lib/starter_web/_data/modules/buymeacoffee.yml +0 -30
  70. data/lib/starter_web/_data/modules/defaults/buymeacoffee.yml +0 -30
  71. data/lib/starter_web/assets/images/modules/masterslider/slider_5/ms-free-food-restaurant-140x80.jpg +0 -0
  72. data/lib/starter_web/assets/images/modules/masterslider/slider_5/ms-free-food-restaurant.jpg +0 -0
  73. data/lib/starter_web/assets/images/modules/masterslider/slider_5/ms-free-food-single-man-140x80.jpg +0 -0
  74. data/lib/starter_web/assets/images/modules/masterslider/slider_5/ms-free-food-single-man.jpg +0 -0
  75. data/lib/starter_web/assets/images/modules/masterslider/slider_5/ms-free-food-single-woman-140x80.jpg +0 -0
  76. data/lib/starter_web/assets/images/modules/masterslider/slider_5/ms-free-food-single-woman.jpg +0 -0
  77. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/attributes.asciidoc +0 -58
  78. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/accordion.asciidoc +0 -34
  79. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/alerts.asciidoc +0 -15
  80. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/badges.asciidoc +0 -9
  81. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/body.asciidoc +0 -14
  82. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/breadcrumbs.asciidoc +0 -14
  83. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/buttons.asciidoc +0 -75
  84. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/cards.asciidoc +0 -22
  85. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/carousel.asciidoc +0 -37
  86. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/close.asciidoc +0 -15
  87. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/code.asciidoc +0 -14
  88. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/color_system.asciidoc +0 -353
  89. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/components.asciidoc +0 -69
  90. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/dropdowns.asciidoc +0 -53
  91. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/figures.asciidoc +0 -5
  92. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/forms.asciidoc +0 -270
  93. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/grid.asciidoc +0 -49
  94. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/links.asciidoc +0 -21
  95. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/list_groups.asciidoc +0 -28
  96. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/modals.asciidoc +0 -43
  97. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/navbar.asciidoc +0 -45
  98. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/navs.asciidoc +0 -28
  99. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/offcanvas.asciidoc +0 -16
  100. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/options.asciidoc +0 -30
  101. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/pagination.asciidoc +0 -40
  102. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/paragraph.asciidoc +0 -5
  103. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/placeholders.asciidoc +0 -5
  104. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/popovers.asciidoc +0 -28
  105. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/position.asciidoc +0 -8
  106. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/progress_bars.asciidoc +0 -12
  107. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/spacing.asciidoc +0 -14
  108. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/spinners.asciidoc +0 -12
  109. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/tables.asciidoc +0 -55
  110. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/thumbnails.asciidoc +0 -9
  111. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/toasts.asciidoc +0 -18
  112. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/tooltips.asciidoc +0 -28
  113. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/typography.asciidoc +0 -115
  114. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/documents/z_index.asciidoc +0 -26
  115. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/tables/_table.asciidoc +0 -9
  116. data/lib/starter_web/pages/public/learn/bs_sass_variables/_includes/tables/accordion.asciidoc +0 -87
  117. data/lib/starter_web/pages/public/learn/bs_sass_variables/bs_sass_variables.adoc +0 -267
  118. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/attributes.asciidoc +0 -59
  119. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/documents/100_chapter.asciidoc +0 -541
  120. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/documents/200_chapter.asciidoc +0 -33
  121. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/tables/build_command_options.asciidoc +0 -72
  122. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/tables/files_and_folders.asciidoc +0 -66
  123. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/tables/global_configuration_options.asciidoc +0 -63
  124. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/tables/global_variables.asciidoc +0 -26
  125. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/tables/page_variables.asciidoc +0 -54
  126. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/tables/serve_command_options.asciidoc +0 -45
  127. data/lib/starter_web/pages/public/learn/core_web_vitals/_includes/tables/site_variables.asciidoc +0 -59
  128. data/lib/starter_web/pages/public/learn/core_web_vitals/core_web_vitals.adoc +0 -447
  129. data/lib/starter_web/pages/public/learn/roundtrip/lunr_search.1.asciidoc +0 -460
  130. data/lib/starter_web/pages/public/manuals/speak2me.adoc +0 -412
  131. data/lib/starter_web/pages/public/tools/cheatsheet/gem.adoc +0 -259
  132. data/lib/starter_web/pages/public/tools/cheatsheet/git.adoc +0 -1462
  133. data/lib/starter_web/pages/public/tools/cheatsheet/j1.adoc +0 -177
  134. data/lib/starter_web/pages/public/tools/cheatsheet/yaml.adoc +0 -522
@@ -1,177 +0,0 @@
1
- ---
2
- title: J1 Template
3
- tagline: Cheatsheet for daily use
4
-
5
- date: 2023-05-19
6
- #last_modified: 2023-01-01
7
-
8
- description: >
9
- J1 Template is a Bootstrap V5 website template for the static
10
- site generator Jekyll.
11
- The Cheatsheet discuss j1 commands for daily use.
12
- The Template system J1 is a creation tool used to build
13
- simple but fully configurable modern static websites
14
- using the generator Jekyll.
15
- keywords: >
16
- Jekyll, Theme, JekyllOne, Info, Manual, Cheatsheet, J1, Template
17
-
18
- categories: [ Manual ]
19
- tags: [ Cheatsheet, JekyllOne, Template ]
20
-
21
- image:
22
- path: /assets/images/modules/attics/1920x1280/recha-oktaviani.jpg
23
- width: 1920
24
- height: 1280
25
-
26
- regenerate: false
27
- permalink: /pages/public/tools/cheatsheet/j1/
28
-
29
- resources: [ animate, clipboard, rouge ]
30
- resource_options:
31
- - attic:
32
- slides:
33
- - url: /assets/images/modules/attics/1920x1280/recha-oktaviani.jpg
34
- alt: Photo by Recha Oktaviani on Unsplash
35
- badge:
36
- type: unsplash
37
- author: Recha Oktaviani
38
- href: https://unsplash.com/de/@rechaoktaviani
39
- ---
40
-
41
- // Page Initializer
42
- // =============================================================================
43
- // Enable the Liquid Preprocessor
44
- :page-liquid:
45
-
46
- // Set (local) page attributes here
47
- // -----------------------------------------------------------------------------
48
- // :page--attr: <attr-value>
49
-
50
- // Load Liquid procedures
51
- // -----------------------------------------------------------------------------
52
- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
53
-
54
- // Load page attributes
55
- // -----------------------------------------------------------------------------
56
- {% include {{load_attributes}} scope="global" %}
57
-
58
-
59
- // Page content
60
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61
-
62
- // Include sub-documents (if any)
63
- // -----------------------------------------------------------------------------
64
- [role="dropcap"]
65
- The Cheatsheet discusses management commands for daily use. The Template
66
- system J1 is a creation tool to build simple but fully configurable modern
67
- static websites using the generator _Jekyll_. No deep knowledge of using
68
- _Jekyll_ is needed for the template system _J1_.
69
-
70
- J1 Templated provides a handy command, `j1`, to manage and run websites
71
- created by Jekyll One. Find all commands supported below.
72
-
73
- CAUTION: The command `j1` is a *wrapper* around the *top-level* scripts
74
- defined in the _NodeJS_ project file `package.json`. To run a J1 project,
75
- an installation of _NodeJS_ is *required*.
76
-
77
- .Project Management commands
78
- [cols="2a, 5a, 5a", options="header", width="100%", role="rtable mt-3 mb-5"]
79
- |===
80
- |Command |Description |Example
81
-
82
- |`app`
83
- |Run the website of a J1 project as a standalone *web application*. In
84
- difference to the command `j1 site`, the web application does *not* use
85
- _Jekyll_ to serve the web. The application use the web server _Puma_ based
86
- on web *root* folder `_site` located in the project.
87
- |
88
- [source, sh]
89
- ----
90
- j1 app
91
- ----
92
-
93
- NOTE: To run a project as a standalone web application, a previous `setup`
94
- is *required* to serve the site out of the `_site` folder.
95
-
96
- |`generate`
97
- |Creates a J1 project *scaffold* in folder `<project name>`. When the
98
- scaffold is created, change to that (project-)folder and run `j1 setup` to
99
- make the project ready to use.
100
- |
101
- [source, sh]
102
- ----
103
- j1 generate <project name>
104
- ----
105
-
106
- |`help`
107
- |Show the help message, optionally for a given *subcommand* (e.g. generate).
108
- |
109
- [source, sh]
110
- ----
111
- j1 help
112
- j1 help generate
113
- ----
114
-
115
- |`patch`
116
- |Install available patches for a J1 project. For default, patches are
117
- installed *userized* in the users `gem` folder `~/.gem`. +
118
- See more details running `j1 help patch`.
119
- |
120
- [source, sh]
121
- ----
122
- j1 patch
123
- ----
124
-
125
- NOTE: Installing patches are only required for the _Windows_ platform and
126
- installed automatically if a project is being *generated*. For _Linux_ or
127
- _OSX_ platforms, the installation of patches is *skipped*.
128
-
129
- |`rebuild`
130
- |Rebuild a all *sources* of a project. If you run a website in *development*
131
- mode (`j1 site`), most of the changes of your content (source) is detected
132
- *automatically* and *rebuild*.
133
- |
134
- [source, sh]
135
- ----
136
- j1 rebuild
137
- ----
138
-
139
- CAUTION: Fundamental changes of the configuration like the *site* config
140
- `_config.yml` (Jekyll) affect your web's base settings, and a `rebuild`
141
- is *required* to apply those changes.
142
-
143
- |`reset`
144
- |Reset a J1 project to factory state. A reset of a project removes all
145
- *project* related files but all *sources* of a web are *untouched*.
146
- |
147
- [source, sh]
148
- ----
149
- j1 reset
150
- ----
151
-
152
- |`setup`
153
- |Initialize a J1 project scaffold for first use. The management of a J1
154
- site requires _NodeJS_ libraries and larger number of _Ruby_ GEM files
155
- (_Ruby_ libraies) to be installed and initialized.
156
- |
157
- [source, sh]
158
- ----
159
- j1 setup
160
- ----
161
-
162
- |`site`
163
- |Run the web site of a J1 project in *development* mode. For development,
164
- the site generator of _Jekyll_ is running in background to detect changes
165
- on your site *sources*.
166
- |
167
- [source, sh]
168
- ----
169
- j1 site
170
- ----
171
-
172
- NOTE: The generator of _Jekyll_ is running in `incremental` mode and rebuild
173
- modified source files automatically. If the base configuration of a website
174
- is changed, a rebuild of the web is required. +
175
- See command `rebuild` for more details.
176
-
177
- |===
@@ -1,522 +0,0 @@
1
- ---
2
- title: YAML
3
- tagline: Cheatsheet for daily use
4
-
5
- date: 2023-05-19
6
- #last_modified: 2023-01-01
7
-
8
- description: >
9
- J1 Template is a Bootstrap V5 website template for the static
10
- site generator Jekyll.
11
- The Cheatsheet discuss YAML Markups for daily use.
12
- YAML (short for "YAML Ain't Markup Language") is a human-readable data
13
- serialization format. Its simplicity and readability stand out, making it
14
- popular for configuration files and data exchange between systems.
15
- keywords: >
16
- Jekyll, Theme, JekyllOne, Info, Manual, Cheatsheet, Ruby, Gem
17
-
18
- categories: [ Manual ]
19
- tags: [ Cheatsheet, Gem ]
20
-
21
- image:
22
- path: /assets/images/modules/attics/1920x1280/recha-oktaviani.jpg
23
- width: 1920
24
- height: 1280
25
-
26
- regenerate: false
27
- permalink: /pages/public/tools/cheatsheet/yaml/
28
-
29
- resources: [ animate, clipboard, rouge ]
30
- resource_options:
31
- - attic:
32
- slides:
33
- - url: /assets/images/modules/attics/1920x1280/recha-oktaviani.jpg
34
- alt: Photo by Recha Oktaviani on Unsplash
35
- badge:
36
- type: unsplash
37
- author: Recha Oktaviani
38
- href: https://unsplash.com/de/@rechaoktaviani
39
- ---
40
-
41
- // Page Initializer
42
- // =============================================================================
43
- // Enable the Liquid Preprocessor
44
- :page-liquid:
45
-
46
- // Set (local) page attributes here
47
- // -----------------------------------------------------------------------------
48
- // :page--attr: <attr-value>
49
- :yaml-multiline: https://yaml-multiline.info/
50
-
51
-
52
- // Load Liquid procedures
53
- // -----------------------------------------------------------------------------
54
- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
55
-
56
- // Load page attributes
57
- // -----------------------------------------------------------------------------
58
- {% include {{load_attributes}} scope="global" %}
59
-
60
-
61
- // Page content
62
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63
-
64
- // Include sub-documents (if any)
65
- // -----------------------------------------------------------------------------
66
- [role="dropcap"]
67
- The Cheatsheet discuss Yaml Markups for daily use.
68
- _YAML_ (short for YAML Ain't Markup Language) is a human-readable data
69
- serialization format. Its simplicity and readability stand out, making it
70
- popular for configuration files and data exchange between systems.
71
- _YAML_ was designed to be easily readable by humans, focusing on simplicity
72
- and conciseness. It uses indentation and whitespace to define the data
73
- structure, similar to how Python uses indentation.
74
-
75
- The Markup Language is widely used for *configuration files* in applications,
76
- such as specifying settings for software or defining deployment configurations
77
- in infrastructure-as-code tools. _YAML_ is used for data exchange
78
- between different systems or programming languages. Jekyll is primarily
79
- using the language for defining general *datafiles* like the site config
80
- `_config.yml` and the *frontmatter* of pages, posts, and other content files.
81
-
82
- NOTE: The *frontmatter* provides the data to Jekyll on processing and
83
- rendering the content of posts and pages.
84
-
85
- [role="mb-5"]
86
- The following examples give a good overview of YAML documents' most common
87
- data structures. Many modern applications, like Jekyll, use YAML documents
88
- to provide control data.
89
-
90
- // Include sub-documents (if any)
91
- // -----------------------------------------------------------------------------
92
- [role="mt-5"]
93
- == Helpful Links
94
-
95
- The documentation of _YAML_ is a good source of information but is challenging
96
- to read. The tools given below can help to write the correct YAML document,
97
- or test your own YAML data codes:
98
-
99
- mdi:link-variant[24px, md-gray mr-2 ml-3]
100
- http://www.yaml.org/spec/1.2/spec.html[YAML 1.2 Spec, {browser-window--new}] +
101
- mdi:link-variant[24px, md-gray mr-2 ml-3]
102
- http://www.yamllint.com/[Online YAML Linter, {browser-window--new}] +
103
- mdi:link-variant[24px, md-gray mr-2 ml-3]
104
- https://yaml-online-parser.appspot.com/[Online YAML Parser, {browser-window--new}]
105
-
106
- NOTE: YAML and JSON are related as data serialization formats, with YAML
107
- providing a more human-friendly and expressive syntax, while JSON focuses
108
- on simplicity and machine readability. They have overlapping use cases but
109
- exhibit some differences in syntax, data types, and readability. JavaScript
110
- has built-in support for working with JSON data, making it a popular choice
111
- for handling data exchange in web applications.
112
-
113
-
114
- [role="mt-5"]
115
- == Scalars
116
-
117
- In _YAML_, a *scalar* is a basic data element representing a *single value*.
118
- Scalars can define strings, numbers, booleans, and null values. Here are
119
- the different types of YAML scalars:
120
-
121
- * *Strings* -- *strings* enclosed in *quotes* or double quotes
122
- * *Numbers* -- *numeric* values, including integers and floats
123
- * *Booleans* -- *boolean* values, either true or false
124
- * *Null* -- *empty* values
125
-
126
- [source, yaml]
127
- ----
128
- integer: 1
129
- float: 1.234
130
- string1: 'abc'
131
- string2: "abc"
132
- string3: abc
133
- boolean: false
134
- empty: null
135
- ----
136
-
137
- .JSON data structure
138
- [source, json, role="noclip"]
139
- ----
140
- {
141
- "integer": 1,
142
- "float": 1.234,
143
- "string1": "abc",
144
- "string2": "abc",
145
- "string3": "abc",
146
- "boolean": false,
147
- "empty": null
148
- }
149
- ----
150
-
151
- === Date Strings
152
-
153
- Date strings are *scalars* of type *string* follow the *ISO 8601 standard*
154
- format. The most common representations of *date* in _YAML_ are:
155
-
156
- * *Date Only* -- `YYYY-MM-DD`, example: 2023-05-23
157
- * *Date and Time* -- `YYYY-MM-DDTHH:MM:SSZ`, example: 2023-05-23T10:30:00Z
158
-
159
- In the above format, `T` separates the date and time components,
160
- `HH` represents hours in 24-hour format, `MM` represents minutes,
161
- `SS` represents seconds, and `Z` indicates that the time is in
162
- *UTC* (Coordinated Universal Time).
163
-
164
- TIP: The time component can also include *milliseconds*, such as
165
- `HH:MM:SS.sssZ` (triple `s`).
166
-
167
- _YAML_ also supports alternative formats for date strings, such as:
168
-
169
- * *Date and Time with Timezone Offset* -- `YYYY-MM-DDTHH:MM:SS±HH:MM`,
170
- example: 2023-05-23T10:30:00-04:00. In this format, the timezone
171
- offset is represented as `±HH:MM`, indicating the time difference
172
- from *UTC*.
173
- * *Date and Time without Timezone* -- `YYYY-MM-DDTHH:MM:SS`,
174
- example: 2023-05-23T10:30:00
175
-
176
- TIP: When *no timezone* is specified, the time is assumed to be in the
177
- *local timezone*.
178
-
179
- [source, yaml]
180
- ----
181
- date1: 2015-04-05
182
- date2: 2022-11-03 +100
183
- ----
184
-
185
- .JSON data structure
186
- [source, json, role="noclip"]
187
- ----
188
- {
189
- "date1": "2015-04-05T00:00:00.000Z",
190
- "date2": "2022-11-03 +100"
191
- }
192
- ----
193
-
194
- === Multiline strings (HereDoc)
195
-
196
- A *HereDoc* (short for *here document*) is a way to represent *multi-line*
197
- strings or blocks of text within YAML documents. It allows you to define
198
- a string value that spans *multiple lines* while preserving the line breaks
199
- and formatting.
200
-
201
- _YAML_ indicates a HereDoc using the *pipe* character (`|`) followed by an
202
- optional *indentation level*. The HereDoc block starts on the next line
203
- and continues until the indentation is reduced to the level of the initial
204
- pipe character or until the end of the document.
205
-
206
- [source, yaml]
207
- ----
208
- message: |
209
- This is a multi-line
210
- string using a HereDoc.
211
- It preserves line breaks and formatting.
212
- ----
213
-
214
- In this example, the message field contains a multi-line string defined
215
- using a HereDoc. The pipe `|` character indicates the start of the HereDoc,
216
- and the following lines are indented with two spaces. The resulting value
217
- of the message field will include the line breaks and indentation specified
218
- within the HereDoc block.
219
-
220
- [source, json, role="noclip"]
221
- ----
222
- {
223
- "message": "This is a multi-line\nstring using a HereDoc.\nIt preserves line breaks and formatting.\n"
224
- }
225
- ----
226
-
227
- You can also control the handling of leading and trailing white space within
228
- a HereDoc by using *additional symbols*:
229
-
230
- * `|+` symbol preserves the line breaks and removes trailing
231
- white space. It *trims* any spaces or tabs at the *end* of each line.
232
- * `|-` symbol preserves the line breaks and removes any leading
233
- white space. It *trims* any spaces or tabs at the *beginning* of each line.
234
-
235
- Here's an example using the different HereDoc *symbols*:
236
-
237
- [source, yaml]
238
- ----
239
- message1: |-
240
- This is a HereDoc with leading and trailing spaces.
241
- This line has leading spaces.
242
- This line has trailing spaces.
243
- message2: |+
244
- This is a HereDoc with trailing spaces trimmed.
245
- This line has trailing spaces.
246
- This line has leading spaces.
247
- ----
248
-
249
- .JSON data structure
250
- [source, json, role="noclip"]
251
- ----
252
- {
253
- "message1": "This is a HereDoc with leading and trailing spaces.\n This line has leading spaces.\nThis line has trailing spaces. ",
254
- "message2": "This is a HereDoc with trailing spaces trimmed.\nThis line has trailing spaces. \nThis line has leading spaces. \n",
255
- }
256
- ----
257
-
258
- In this example:
259
-
260
- * *message1* uses `|-` to trim *leading* spaces
261
- * *message2* uses `|+` to trim *trailing* spaces
262
-
263
- TIP: Using HereDocs, you can include long, formatted text blocks in your YAML
264
- documents without requiring *manual* line concatenation or escaping characters.
265
- There is a good online previewer for the different heredoc modes at
266
- link:{yaml-multiline}[YAML Multiline, {browser-window--new}].
267
-
268
-
269
- [role="mt-5"]
270
- == Sequences (Arrays)
271
-
272
- A sequence is a way to represent a *collection* of items. It allows you
273
- to define an *ordered list* of values, similar to an *array* or a list
274
- in other programming languages. Sequences in _YAML_ are denoted by a *dash*
275
- followed by a *space* (` `), and each item in the sequence is placed on a
276
- *new line* and *indented*.
277
-
278
- === Simple sequence
279
-
280
- In this example, the sequence is represented by the key *fruits* followed
281
- by a colon (`:`). The items in the sequence *apple*, *banana*, and *orange*
282
- are indented under the key *fruits* using the dash (`- `) notation.
283
-
284
- [source, yaml]
285
- ----
286
- fruits:
287
- - apple
288
- - banana
289
- - orange
290
- ----
291
-
292
- or written like so:
293
-
294
- [source, yaml]
295
- ----
296
- fruits: [ apple, banana, orange ]
297
- ----
298
-
299
- .JSON data structure
300
- [source, json, role="noclip"]
301
- ----
302
- {
303
- "fruits": [
304
- "apple",
305
- "banana",
306
- "orange"
307
- ]
308
- }
309
- ----
310
-
311
- === Sequence of sequences
312
-
313
- In _YAML_, a sequence of sequences (Array of arrays) refers to a structure
314
- where a sequence contains other sequences as its elements. Each item in the
315
- outer sequence is itself a sequence. It allows you to create a nested
316
- collection within an collection.
317
-
318
- Here's an example of a YAML sequence of sequences:
319
-
320
- [source, yaml]
321
- ----
322
- list_of_lists:
323
- - fruits: [ apple, banana, orange ]
324
- - colors: [ red, blue, green ]
325
- ----
326
-
327
- .JSON data structure
328
- [source, json, role="noclip"]
329
- ----
330
- {
331
- "list_of_lists": [
332
- {
333
- "fruits": [
334
- "apple",
335
- "banana",
336
- "orange"
337
- ]
338
- },
339
- {
340
- "colors": [
341
- "red",
342
- "blue",
343
- "green"
344
- ]
345
- }
346
- ]
347
- }
348
- ----
349
-
350
- You can nest sequences of sequences to represent more complex structures
351
- or hierarchical data. Nesting sequences allow you to organize and represent
352
- data in a structured manner within YAML documents.
353
-
354
-
355
- [role="mt-5"]
356
- == Hash (Dictionary)
357
-
358
- A hash is a data structure used to represent *key-value pairs*. It is also
359
- known as a mapping or *dictionary* in other programming languages.
360
- Hashes in YAML are denoted using indentation and a colon to separate
361
- the *key* and *value*.
362
-
363
- === Simple hash
364
-
365
- [source, yaml]
366
- ----
367
- name: John Doe
368
- age: 30
369
- email: johndoe@example.com
370
- ----
371
-
372
- The hash represents a collection of related *key-value pairs*. In the example,
373
- *name*, *age*, and *email* are `keys`, and *John Doe+, *30*,
374
- and *johndoe@example.com* are their corresponding `values`.
375
-
376
- .JSON data structure
377
- [source, json, role="noclip"]
378
- ----
379
- {
380
- "name": "John Doe",
381
- "age": 30,
382
- "email": "johndoe@example.com"
383
- }
384
- ----
385
-
386
- === Named hash
387
-
388
- [source, yaml]
389
- ----
390
- person:
391
- name: John Doe
392
- age: 30
393
- email: johndoe@example.com
394
- ----
395
-
396
- .JSON data structure
397
- [source, json, role="noclip"]
398
- ----
399
- {
400
- "person": {
401
- "name": "John Doe",
402
- "age": 30,
403
- "email": "johndoe@example.com"
404
- }
405
- }
406
- ----
407
-
408
- === Nested hash
409
-
410
- Hashes can also be *nested* within other hashes (Hash of Hashes), allowing
411
- for more *complex* data structures. Here's an example of a nested hash
412
- in _YAML_.
413
-
414
- [source, yaml]
415
- ----
416
- nested_hash:
417
- hash1:
418
- subsubkey1: 5
419
- subsubkey2: 6
420
- hash2:
421
- somethingelse: Important!
422
- ----
423
-
424
- .JSON data structure
425
- [source, json, role="noclip"]
426
- ----
427
- {
428
- "nested_hash": {
429
- "hash1": {
430
- "subsubkey1": 5,
431
- "subsubkey2": 6
432
- },
433
- "hash2": {
434
- "somethingelse": "Important!"
435
- }
436
- }
437
- }
438
- ----
439
-
440
- [NOTE]
441
- ====
442
- Hashes with *JSON* syntax (mixing is possible)
443
-
444
- [source, yaml]
445
- ----
446
- my_hash: { nr1: 5, nr2: 6 }
447
- ----
448
-
449
- .JSON data structure
450
- [source, json, role="noclip"]
451
- ----
452
- {
453
- "my_hash": {
454
- "nr1": 5,
455
- "nr2": 6
456
- }
457
- }
458
- ----
459
- ====
460
-
461
-
462
- [role="mt-5"]
463
- == Content References (Aliases)
464
-
465
- In _YAML_, content references are a feature that allows you to reference
466
- and *reuse* data from one part of a YAML document in another part. They
467
- are indicated by an ampersand (`&`) followed by an identifier, and then
468
- the *same* identifier preceded by an asterisk (`*`) where the referenced
469
- content is to be used.
470
-
471
- TIP: Content references in _YAML_ provide a way to avoid *duplicating data*
472
- and promote reusability. They are particularly useful when you have complex
473
- data structures and want to refer to them multiple times within the *same*
474
- document.
475
-
476
- [source, yaml]
477
- ----
478
- default_settings: &default_settings
479
- install:
480
- dir: /usr/local
481
- owner: root
482
- config:
483
- enabled: false
484
- run:
485
- enabled: true
486
- my_app_settings:
487
- <<: *default_settings
488
- install:
489
- owner: my_user
490
- group: my_group
491
- ----
492
-
493
- .JSON data structure
494
- [source, json, role="noclip"]
495
- ----
496
- {
497
- "default_settings": {
498
- "install": {
499
- "dir": "/usr/local",
500
- "owner": "root"
501
- },
502
- "config": {
503
- "enabled": false
504
- },
505
- "run": {
506
- "enabled": true
507
- }
508
- },
509
- "my_app_settings": {
510
- "install": {
511
- "owner": "my_user",
512
- "group": "my_group"
513
- },
514
- "config": {
515
- "enabled": false
516
- },
517
- "run": {
518
- "enabled": true
519
- }
520
- }
521
- }
522
- ----