jekyll-webawesome 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +218 -0
- data/lib/jekyll/webawesome/transformer.rb +1 -0
- data/lib/jekyll/webawesome/transformers/carousel_transformer.rb +129 -0
- data/lib/jekyll/webawesome/transformers.rb +1 -0
- data/lib/jekyll/webawesome/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 006d303b4b8226fc4f479131a04650cdc071ca37447710f938241cb58e1bde2d
|
4
|
+
data.tar.gz: b07247507381997b47cfe8e15d1f0038f4b0845329d38de3fe16463d9ad641ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e11fdc51fb7a9fa64146067e1d0e8c6e567b66e0aaf3318643c5f30a55adbf6c3cf0e814a066c327bfabe2c6bba437f41fb8f10b608e6a583b3796618ca8f0f6
|
7
|
+
data.tar.gz: a62e77aa3a531e34d6a6e850030bf6ec12cd2e416c1acb99aa83ddcd0cb2d47e5ee5073e929b0a81005caa48f015ee40a639494e635cf53615bd3d3d110322db
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
8
8
|
|
9
9
|
- Placeholder
|
10
10
|
|
11
|
+
## [0.6.0] - 2025-10-22
|
12
|
+
|
13
|
+
- Support for wa-carousel component
|
14
|
+
|
11
15
|
## [0.5.4] - 2025-10-20
|
12
16
|
|
13
17
|
- Support for default width for the image_dialog like
|
data/README.md
CHANGED
@@ -16,6 +16,7 @@ This plugin focuses on the most commonly used Web Awesome components for Jekyll
|
|
16
16
|
| **Button** | `%%%variant` | `:::wa-button variant` | `<wa-button variant="brand" href="url">text</wa-button>` or `<wa-button variant="brand">text</wa-button>` |
|
17
17
|
| **Callouts** | `:::info` | `:::wa-callout info` | `<wa-callout variant="brand"><wa-icon name="circle-info"></wa-icon>content</wa-callout>` |
|
18
18
|
| **Card** | `===` | `:::wa-card` | `<wa-card>content</wa-card>` |
|
19
|
+
| **Carousel** | `~~~~~~` | `:::wa-carousel` | `<wa-carousel>` with carousel items |
|
19
20
|
| **Comparison** | `\|\|\|` or `\|\|\|25` | `:::wa-comparison` or `:::wa-comparison 25` | `<wa-comparison>` with before/after slots |
|
20
21
|
| **Copy Button** | `<<<` | `:::wa-copy-button` | `<wa-copy-button value="content">content</wa-copy-button>` |
|
21
22
|
| **Details** | `^^^appearance? icon-placement?` | `:::wa-details appearance? icon-placement?` | `<wa-details appearance="..." icon-placement="...">content</wa-details>` |
|
@@ -270,6 +271,207 @@ This card uses the accent appearance for emphasis.
|
|
270
271
|
|
271
272
|

|
272
273
|
|
274
|
+
### Carousel
|
275
|
+
|
276
|
+
Create carousels (image sliders/content rotators) using the `~~~~~~` syntax:
|
277
|
+
|
278
|
+
```markdown
|
279
|
+
~~~~~~
|
280
|
+
~~~
|
281
|
+

|
282
|
+
Beautiful mountain scenery
|
283
|
+
~~~
|
284
|
+
~~~
|
285
|
+

|
286
|
+
Peaceful ocean waves
|
287
|
+
~~~
|
288
|
+
~~~
|
289
|
+

|
290
|
+
Walking through the woods
|
291
|
+
~~~
|
292
|
+
~~~~~~
|
293
|
+
```
|
294
|
+
|
295
|
+
#### Multiple Slides Per View
|
296
|
+
|
297
|
+
Show multiple slides at once by specifying the number:
|
298
|
+
|
299
|
+
```markdown
|
300
|
+
~~~~~~3
|
301
|
+
~~~
|
302
|
+
Product 1 content
|
303
|
+
~~~
|
304
|
+
~~~
|
305
|
+
Product 2 content
|
306
|
+
~~~
|
307
|
+
~~~
|
308
|
+
Product 3 content
|
309
|
+
~~~
|
310
|
+
~~~
|
311
|
+
Product 4 content
|
312
|
+
~~~
|
313
|
+
~~~~~~
|
314
|
+
```
|
315
|
+
|
316
|
+
#### Navigation and Pagination
|
317
|
+
|
318
|
+
Add navigation arrows and pagination dots with keywords:
|
319
|
+
|
320
|
+
```markdown
|
321
|
+
~~~~~~navigation pagination
|
322
|
+
~~~
|
323
|
+
First slide
|
324
|
+
~~~
|
325
|
+
~~~
|
326
|
+
Second slide
|
327
|
+
~~~
|
328
|
+
~~~
|
329
|
+
Third slide
|
330
|
+
~~~
|
331
|
+
~~~~~~
|
332
|
+
```
|
333
|
+
|
334
|
+
#### Slides Per Move
|
335
|
+
|
336
|
+
Control how many slides advance at a time (first number is slides-per-page, second is slides-per-move):
|
337
|
+
|
338
|
+
```markdown
|
339
|
+
~~~~~~3 2 navigation
|
340
|
+
~~~
|
341
|
+
Slide 1
|
342
|
+
~~~
|
343
|
+
~~~
|
344
|
+
Slide 2
|
345
|
+
~~~
|
346
|
+
~~~
|
347
|
+
Slide 3
|
348
|
+
~~~
|
349
|
+
~~~
|
350
|
+
Slide 4
|
351
|
+
~~~
|
352
|
+
~~~
|
353
|
+
Slide 5
|
354
|
+
~~~
|
355
|
+
~~~~~~
|
356
|
+
```
|
357
|
+
|
358
|
+
This shows 3 slides at a time and moves 2 slides when navigating.
|
359
|
+
|
360
|
+
#### Looping
|
361
|
+
|
362
|
+
Enable continuous looping with the `loop` keyword:
|
363
|
+
|
364
|
+
```markdown
|
365
|
+
~~~~~~loop navigation
|
366
|
+
~~~
|
367
|
+
Slide 1
|
368
|
+
~~~
|
369
|
+
~~~
|
370
|
+
Slide 2
|
371
|
+
~~~
|
372
|
+
~~~
|
373
|
+
Slide 3
|
374
|
+
~~~
|
375
|
+
~~~~~~
|
376
|
+
```
|
377
|
+
|
378
|
+
#### Scroll Hint
|
379
|
+
|
380
|
+
Add padding to show adjacent slides as a hint using the `scroll-hint` CSS property:
|
381
|
+
|
382
|
+
```markdown
|
383
|
+
~~~~~~scroll-hint:3rem navigation
|
384
|
+
~~~
|
385
|
+

|
386
|
+
~~~
|
387
|
+
~~~
|
388
|
+

|
389
|
+
~~~
|
390
|
+
~~~
|
391
|
+

|
392
|
+
~~~
|
393
|
+
~~~~~~
|
394
|
+
```
|
395
|
+
|
396
|
+
#### Advanced Options
|
397
|
+
|
398
|
+
Combine multiple parameters for full control:
|
399
|
+
|
400
|
+
```markdown
|
401
|
+
~~~~~~3 2 loop navigation pagination scroll-hint:2rem
|
402
|
+
~~~
|
403
|
+

|
404
|
+
|
405
|
+
# Feature One
|
406
|
+
|
407
|
+
Description here
|
408
|
+
~~~
|
409
|
+
~~~
|
410
|
+

|
411
|
+
|
412
|
+
# Feature Two
|
413
|
+
|
414
|
+
More details
|
415
|
+
~~~
|
416
|
+
~~~
|
417
|
+

|
418
|
+
|
419
|
+
# Feature Three
|
420
|
+
|
421
|
+
Additional info
|
422
|
+
~~~
|
423
|
+
~~~~~~
|
424
|
+
```
|
425
|
+
|
426
|
+
#### Removing Fixed Aspect Ratio
|
427
|
+
|
428
|
+
For carousels with **text content, cards, or variable-height slides**, you may want to remove the default `16/9` aspect ratio to let content size naturally:
|
429
|
+
|
430
|
+
```markdown
|
431
|
+
~~~~~~aspect-ratio:auto navigation
|
432
|
+
~~~
|
433
|
+
# First Slide
|
434
|
+
|
435
|
+
This carousel will size based on content height, not a fixed aspect ratio.
|
436
|
+
|
437
|
+
Perfect for text-heavy slides or mixed content.
|
438
|
+
~~~
|
439
|
+
~~~
|
440
|
+
# Second Slide
|
441
|
+
|
442
|
+
Another slide with different content height.
|
443
|
+
~~~
|
444
|
+
~~~~~~
|
445
|
+
```
|
446
|
+
|
447
|
+
Use `aspect-ratio:auto` or `aspect-ratio:none` to override the default fixed height behavior.
|
448
|
+
|
449
|
+
#### Carousel Parameters
|
450
|
+
|
451
|
+
| Parameter Type | Syntax | Description |
|
452
|
+
|----------------|--------|-------------|
|
453
|
+
| **Slides Per Page** | First number (e.g., `3`) | How many slides visible at once (default: 1) |
|
454
|
+
| **Slides Per Move** | Second number (e.g., `2`) | How many slides to advance (default: 1) |
|
455
|
+
| **Loop** | `loop` | Enable continuous looping (default: off) |
|
456
|
+
| **Navigation** | `navigation` | Show previous/next buttons |
|
457
|
+
| **Pagination** | `pagination` | Show dot indicators |
|
458
|
+
| **Autoplay** | `autoplay` | Auto-advance slides |
|
459
|
+
| **Mouse Dragging** | `mouse-dragging` | Enable click-and-drag |
|
460
|
+
| **Vertical** | `vertical` | Vertical orientation |
|
461
|
+
| **Scroll Hint** | `scroll-hint:2rem` | Padding to show adjacent slides |
|
462
|
+
| **Aspect Ratio** | `aspect-ratio:3/2` | Viewport aspect ratio (default: 16/9) |
|
463
|
+
| **Slide Gap** | `slide-gap:1rem` | Space between slides |
|
464
|
+
|
465
|
+
All parameters are optional and can be combined in any order:
|
466
|
+
|
467
|
+
```markdown
|
468
|
+
~~~~~~vertical pagination autoplay
|
469
|
+
~~~
|
470
|
+
Content here
|
471
|
+
~~~
|
472
|
+
~~~~~~
|
473
|
+
```
|
474
|
+
|
273
475
|
### Tags
|
274
476
|
|
275
477
|
Create tags using the `@@@` syntax:
|
@@ -579,6 +781,22 @@ Cards automatically parse content into these slots:
|
|
579
781
|
- **Content**: Remaining content becomes main content
|
580
782
|
- **Footer**: Trailing links become footer buttons
|
581
783
|
|
784
|
+
### Carousel Options
|
785
|
+
|
786
|
+
| Parameter | Type | Description |
|
787
|
+
|-----------|------|-------------|
|
788
|
+
| Slides Per Page | Number (first numeric parameter) | How many slides visible at once (default: 1) |
|
789
|
+
| Slides Per Move | Number (second numeric parameter) | How many slides to advance (default: 1) |
|
790
|
+
| `loop` | Boolean | Enable continuous looping (default: off) |
|
791
|
+
| `navigation` | Boolean | Show previous/next buttons (default: off) |
|
792
|
+
| `pagination` | Boolean | Show dot indicators (default: off) |
|
793
|
+
| `autoplay` | Boolean | Auto-advance slides (default: off) |
|
794
|
+
| `mouse-dragging` | Boolean | Enable click-and-drag (default: off) |
|
795
|
+
| `vertical` | Keyword | Use vertical orientation (default: horizontal) |
|
796
|
+
| `scroll-hint:value` | CSS Property | Padding to show adjacent slides (e.g., `2rem`, `50px`) |
|
797
|
+
| `aspect-ratio:value` | CSS Property | Viewport aspect ratio (default: 16/9, e.g., `3/2`, `4/3`). Use `auto` or `none` for content-based height |
|
798
|
+
| `slide-gap:value` | CSS Property | Space between slides (default: `var(--wa-space-m)`) |
|
799
|
+
|
582
800
|
### Tag Variants
|
583
801
|
|
584
802
|
| Type | Description |
|
@@ -13,6 +13,7 @@ module Jekyll
|
|
13
13
|
content = ButtonTransformer.transform(content)
|
14
14
|
content = CalloutTransformer.transform(content)
|
15
15
|
content = CardTransformer.transform(content)
|
16
|
+
content = CarouselTransformer.transform(content)
|
16
17
|
content = ComparisonTransformer.transform(content)
|
17
18
|
content = CopyButtonTransformer.transform(content)
|
18
19
|
content = DetailsTransformer.transform(content)
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base_transformer'
|
4
|
+
|
5
|
+
module Jekyll
|
6
|
+
module WebAwesome
|
7
|
+
# Transforms carousel syntax into wa-carousel elements
|
8
|
+
# Primary syntax: ~~~~~~params\n~~~ slide1\ncontent\n~~~\n~~~ slide2\ncontent\n~~~\n~~~~~~
|
9
|
+
# Alternative syntax: :::wa-carousel params\n~~~ slide1\ncontent\n~~~\n~~~ slide2\ncontent\n~~~\n:::
|
10
|
+
# Params can include: numbers (slides-per-page, slides-per-move), keywords (loop, navigation, pagination,
|
11
|
+
# autoplay, mouse-dragging, vertical), and CSS properties (scroll-hint:value, aspect-ratio:value, slide-gap:value)
|
12
|
+
class CarouselTransformer < BaseTransformer
|
13
|
+
def self.transform(content)
|
14
|
+
# Define both regex patterns
|
15
|
+
# Match: ~~~~~~params (optional)
|
16
|
+
# ~~~
|
17
|
+
# content (can be empty)
|
18
|
+
# ~~~
|
19
|
+
# (repeat slides)
|
20
|
+
# ~~~~~~
|
21
|
+
primary_regex = /^~{6}([^\n]*)\n((?:~~~\n(?:.*?\n)?~~~\n?)+)~{6}/m
|
22
|
+
alternative_regex = /^:::wa-carousel\s*([^\n]*)\n((?:~~~\n(?:.*?\n)?~~~\n?)+):::/m
|
23
|
+
|
24
|
+
# Define shared transformation logic
|
25
|
+
transform_proc = proc do |params, slides_block, _third_capture|
|
26
|
+
parsed_params = parse_params(params)
|
27
|
+
slides = extract_slides(slides_block)
|
28
|
+
|
29
|
+
build_carousel_html(slides, parsed_params)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Apply both patterns
|
33
|
+
patterns = dual_syntax_patterns(primary_regex, alternative_regex, transform_proc)
|
34
|
+
apply_multiple_patterns(content, patterns)
|
35
|
+
end
|
36
|
+
|
37
|
+
class << self
|
38
|
+
private
|
39
|
+
|
40
|
+
def parse_params(params)
|
41
|
+
return {} if params.nil? || params.strip.empty?
|
42
|
+
|
43
|
+
result = {
|
44
|
+
attributes: {},
|
45
|
+
css_vars: {}
|
46
|
+
}
|
47
|
+
|
48
|
+
tokens = params.strip.split(/\s+/)
|
49
|
+
numeric_count = 0
|
50
|
+
|
51
|
+
tokens.each do |token|
|
52
|
+
# Check for CSS custom properties (key:value)
|
53
|
+
if token.include?(':')
|
54
|
+
key, value = token.split(':', 2)
|
55
|
+
case key
|
56
|
+
when 'scroll-hint'
|
57
|
+
result[:css_vars]['--scroll-hint'] = value
|
58
|
+
when 'aspect-ratio'
|
59
|
+
# Support 'auto', 'none', or 'unset' to remove the default aspect ratio
|
60
|
+
# This is useful for text content or variable-height slides
|
61
|
+
result[:css_vars]['--aspect-ratio'] = value
|
62
|
+
when 'slide-gap'
|
63
|
+
result[:css_vars]['--slide-gap'] = value
|
64
|
+
end
|
65
|
+
# Check for numeric values
|
66
|
+
elsif token.match?(/^\d+$/)
|
67
|
+
numeric_count += 1
|
68
|
+
if numeric_count == 1
|
69
|
+
result[:attributes]['slides-per-page'] = token
|
70
|
+
elsif numeric_count == 2
|
71
|
+
result[:attributes]['slides-per-move'] = token
|
72
|
+
end
|
73
|
+
# Check for boolean flags
|
74
|
+
elsif %w[loop navigation pagination autoplay mouse-dragging vertical].include?(token)
|
75
|
+
# For orientation, we need to handle it specially
|
76
|
+
if token == 'vertical'
|
77
|
+
result[:attributes]['orientation'] = 'vertical'
|
78
|
+
else
|
79
|
+
result[:attributes][token] = true
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
result
|
85
|
+
end
|
86
|
+
|
87
|
+
def extract_slides(slides_block)
|
88
|
+
# Extract individual slides using ~~~ markers
|
89
|
+
# Handle both content and empty slides
|
90
|
+
slide_contents = slides_block.scan(/~~~\n(.*?)~~~(?:\n|$)/m)
|
91
|
+
slide_contents.map { |match| match[0].strip }
|
92
|
+
end
|
93
|
+
|
94
|
+
def build_carousel_html(slides, parsed_params)
|
95
|
+
attributes = build_attributes(parsed_params[:attributes] || {})
|
96
|
+
style = build_style(parsed_params[:css_vars] || {})
|
97
|
+
|
98
|
+
attr_string = attributes.empty? ? '' : " #{attributes.join(' ')}"
|
99
|
+
style_string = style.empty? ? '' : " style=\"#{style}\""
|
100
|
+
|
101
|
+
slide_items = slides.map do |slide_content|
|
102
|
+
slide_html = markdown_to_html(slide_content)
|
103
|
+
"<wa-carousel-item>#{slide_html}</wa-carousel-item>"
|
104
|
+
end
|
105
|
+
|
106
|
+
"<wa-carousel#{attr_string}#{style_string}>#{slide_items.join}</wa-carousel>"
|
107
|
+
end
|
108
|
+
|
109
|
+
def build_attributes(attrs)
|
110
|
+
return [] if attrs.nil? || attrs.empty?
|
111
|
+
|
112
|
+
attrs.map do |key, value|
|
113
|
+
if value == true
|
114
|
+
key
|
115
|
+
else
|
116
|
+
"#{key}=\"#{value}\""
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def build_style(css_vars)
|
122
|
+
return '' if css_vars.nil? || css_vars.empty?
|
123
|
+
|
124
|
+
css_vars.map { |key, value| "#{key}: #{value}" }.join('; ')
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -8,6 +8,7 @@ require_relative 'transformers/badge_transformer'
|
|
8
8
|
require_relative 'transformers/button_transformer'
|
9
9
|
require_relative 'transformers/callout_transformer'
|
10
10
|
require_relative 'transformers/card_transformer'
|
11
|
+
require_relative 'transformers/carousel_transformer'
|
11
12
|
require_relative 'transformers/comparison_transformer'
|
12
13
|
require_relative 'transformers/copy_button_transformer'
|
13
14
|
require_relative 'transformers/details_transformer'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-webawesome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janne Waren
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- lib/jekyll/webawesome/transformers/button_transformer.rb
|
123
123
|
- lib/jekyll/webawesome/transformers/callout_transformer.rb
|
124
124
|
- lib/jekyll/webawesome/transformers/card_transformer.rb
|
125
|
+
- lib/jekyll/webawesome/transformers/carousel_transformer.rb
|
125
126
|
- lib/jekyll/webawesome/transformers/comparison_transformer.rb
|
126
127
|
- lib/jekyll/webawesome/transformers/copy_button_transformer.rb
|
127
128
|
- lib/jekyll/webawesome/transformers/details_transformer.rb
|