jekyll-webawesome 0.3.0 → 0.4.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 -4
- data/README.md +40 -1
- data/lib/jekyll/webawesome/transformers/details_transformer.rb +38 -7
- data/lib/jekyll/webawesome/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 248a4b65617851cba2e7b5cc7b1a14f9424fa38649b0efbe7f5af4417b71df7f
|
4
|
+
data.tar.gz: 157cfaef53cc8d38d1b7d3d0ddd6fc2c383a9a2989da6f5be9a62e9dc9d19bd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb931b98a57633b9924bbaf3143f4b3cda7bab15e3778f1d698775c95e349a3802d6f1d9fa537ebe8424e3e4debbf9d0d411101e2fd9481bbd9aee7224e86bc9
|
7
|
+
data.tar.gz: b0d50534280129717c3fa47445a66cf44313995b31061728679ad3324c05e9927934686e1b9a9343f7037f62fde575581c25571ebe437c2f1ed70c90cd8ba803
|
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.4.0] - 2025-09-29
|
12
|
+
|
13
|
+
- Support for icon placement in wa-details component
|
14
|
+
|
11
15
|
## [0.3.0] - 2025-09-29
|
12
16
|
|
13
17
|
- Support for wa-copy-button component (`<<<...<<<` or `:::wa-copy-button`)
|
@@ -18,8 +22,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
18
22
|
|
19
23
|
## [0.2.0] - 2025-09-03
|
20
24
|
|
21
|
-
### Added
|
22
|
-
|
23
25
|
- Configuration options to control transformation scope
|
24
26
|
- `transform_pages` - Enable/disable transformations for pages (default: true)
|
25
27
|
- `transform_documents` - Enable/disable transformations for documents/posts (default: true)
|
@@ -30,8 +32,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
30
32
|
|
31
33
|
## [0.1.0] - 2025-08-09
|
32
34
|
|
33
|
-
### Added
|
34
|
-
|
35
35
|
- Initial release of jekyll-webawesome gem
|
36
36
|
- Support for Badge components (`!!!variant` or `:::wa-badge variant`)
|
37
37
|
- Support for Button components (`%%%variant` or `:::wa-button variant`)
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ This plugin focuses on the most commonly used Web Awesome components for Jekyll
|
|
18
18
|
| **Card** | `===` | `:::wa-card` | `<wa-card>content</wa-card>` |
|
19
19
|
| **Comparison** | `\|\|\|` or `\|\|\|25` | `:::wa-comparison` or `:::wa-comparison 25` | `<wa-comparison>` with before/after slots |
|
20
20
|
| **Copy Button** | `<<<` | `:::wa-copy-button` | `<wa-copy-button value="content">content</wa-copy-button>` |
|
21
|
-
| **Details** |
|
21
|
+
| **Details** | `^^^appearance? icon-placement?` | `:::wa-details appearance? icon-placement?` | `<wa-details appearance="..." icon-placement="...">content</wa-details>` |
|
22
22
|
| **Tab Group** | `++++++` | `:::wa-tabs` | `<wa-tab-group><wa-tab>content</wa-tab></wa-tab-group>` |
|
23
23
|
| **Tag** | `@@@brand` | `:::wa-tag brand` | `<wa-tag variant="brand">content</wa-tag>` |
|
24
24
|
|
@@ -372,6 +372,38 @@ Content goes here
|
|
372
372
|
^^^
|
373
373
|
```
|
374
374
|
|
375
|
+
You can also control icon placement (expand/collapse icon location):
|
376
|
+
|
377
|
+
```markdown
|
378
|
+
^^^start
|
379
|
+
Summary with icon on the start (left)
|
380
|
+
>>>
|
381
|
+
The expand/collapse icon appears on the left side
|
382
|
+
^^^
|
383
|
+
|
384
|
+
^^^end
|
385
|
+
Summary with icon on the end (right)
|
386
|
+
>>>
|
387
|
+
The expand/collapse icon appears on the right side (default)
|
388
|
+
^^^
|
389
|
+
```
|
390
|
+
|
391
|
+
You can combine appearance and icon placement:
|
392
|
+
|
393
|
+
```markdown
|
394
|
+
^^^filled start
|
395
|
+
Filled appearance with icon on the start
|
396
|
+
>>>
|
397
|
+
Content with both styling and icon positioning
|
398
|
+
^^^
|
399
|
+
|
400
|
+
^^^plain end
|
401
|
+
Plain appearance with icon on the end
|
402
|
+
>>>
|
403
|
+
Parameters can be in any order: start filled, filled start, etc.
|
404
|
+
^^^
|
405
|
+
```
|
406
|
+
|
375
407
|
### Tab Groups
|
376
408
|
|
377
409
|
Create tabbed content using the `++++++` syntax for tab groups and `+++` for tabs.
|
@@ -471,6 +503,13 @@ Cards automatically parse content into these slots:
|
|
471
503
|
| `plain` | plain |
|
472
504
|
| `filled-outlined` | filled outlined |
|
473
505
|
|
506
|
+
### Details Icon Placement
|
507
|
+
|
508
|
+
| Position | Description |
|
509
|
+
|----------|-------------|
|
510
|
+
| `end` (default) | Icon appears on the right side |
|
511
|
+
| `start` | Icon appears on the left side |
|
512
|
+
|
474
513
|
### Tab Placements
|
475
514
|
|
476
515
|
- `top` (default)
|
@@ -5,25 +5,30 @@ require_relative 'base_transformer'
|
|
5
5
|
module Jekyll
|
6
6
|
module WebAwesome
|
7
7
|
# Transforms summary/details syntax into wa-details elements
|
8
|
-
# Primary syntax: ^^^appearance?\nsummary\n>>>\ndetails\n^^^
|
9
|
-
# Alternative syntax: :::wa-details appearance?\nsummary\n>>>\ndetails\n:::
|
8
|
+
# Primary syntax: ^^^appearance? icon-placement?\nsummary\n>>>\ndetails\n^^^
|
9
|
+
# Alternative syntax: :::wa-details appearance? icon-placement?\nsummary\n>>>\ndetails\n:::
|
10
10
|
# Appearances: outlined (default), filled, filled-outlined, plain
|
11
|
+
# Icon placement: start, end (default)
|
11
12
|
class DetailsTransformer < BaseTransformer
|
12
13
|
def self.transform(content)
|
13
|
-
# Define both regex patterns
|
14
|
-
primary_regex = /^\^\^\^?(
|
15
|
-
alternative_regex = /^:::wa-details\s*(
|
14
|
+
# Define both regex patterns - capture parameter string
|
15
|
+
primary_regex = /^\^\^\^?(.*?)\n(.*?)\n^>>>\n(.*?)\n^\^\^\^?/m
|
16
|
+
alternative_regex = /^:::wa-details\s*(.*?)\n(.*?)\n^>>>\n(.*?)\n:::/m
|
16
17
|
|
17
18
|
# Define shared transformation logic
|
18
|
-
transform_proc = proc do |
|
19
|
+
transform_proc = proc do |params_string, summary_content, details_content|
|
19
20
|
summary_content = summary_content.strip
|
20
21
|
details_content = details_content.strip
|
21
22
|
|
23
|
+
# Parse parameters from the params string
|
24
|
+
appearance_param, icon_placement_param = parse_parameters(params_string)
|
25
|
+
|
22
26
|
appearance_class = normalize_appearance(appearance_param)
|
27
|
+
icon_placement = normalize_icon_placement(icon_placement_param)
|
23
28
|
summary_html = markdown_to_html(summary_content)
|
24
29
|
details_html = markdown_to_html(details_content)
|
25
30
|
|
26
|
-
"<wa-details appearance='#{appearance_class}'>" \
|
31
|
+
"<wa-details appearance='#{appearance_class}' icon-placement='#{icon_placement}'>" \
|
27
32
|
"<span slot='summary'>#{summary_html}</span>" \
|
28
33
|
"#{details_html}</wa-details>"
|
29
34
|
end
|
@@ -36,6 +41,21 @@ module Jekyll
|
|
36
41
|
class << self
|
37
42
|
private
|
38
43
|
|
44
|
+
def parse_parameters(params_string)
|
45
|
+
return [nil, nil] if params_string.nil? || params_string.strip.empty?
|
46
|
+
|
47
|
+
# Split by whitespace and extract known parameters
|
48
|
+
tokens = params_string.strip.split(/\s+/)
|
49
|
+
|
50
|
+
appearance_options = %w[outlined filled filled-outlined plain]
|
51
|
+
placement_options = %w[start end]
|
52
|
+
|
53
|
+
appearance_param = tokens.find { |token| appearance_options.include?(token) }
|
54
|
+
icon_placement_param = tokens.find { |token| placement_options.include?(token) }
|
55
|
+
|
56
|
+
[appearance_param, icon_placement_param]
|
57
|
+
end
|
58
|
+
|
39
59
|
def normalize_appearance(appearance_param)
|
40
60
|
case appearance_param
|
41
61
|
when 'filled'
|
@@ -48,6 +68,17 @@ module Jekyll
|
|
48
68
|
'outlined'
|
49
69
|
end
|
50
70
|
end
|
71
|
+
|
72
|
+
def normalize_icon_placement(icon_placement_param)
|
73
|
+
case icon_placement_param
|
74
|
+
when 'start'
|
75
|
+
'start'
|
76
|
+
when 'end'
|
77
|
+
'end'
|
78
|
+
else
|
79
|
+
'end'
|
80
|
+
end
|
81
|
+
end
|
51
82
|
end
|
52
83
|
end
|
53
84
|
end
|