jekyll-webawesome 0.5.2 → 0.5.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 229fd8aa9734c6c6c21684d05420d80db94b6b5a271f1dc2d8b901773bc61d3a
|
|
4
|
+
data.tar.gz: 373f57b7afbcfe0cccc2857f20987d91c1433768f3d0257773da9d7b3018f7f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f76a3acdd6417715ed2a928a94705f99b402a843f2cfa74b30ab4b0f9b632fe90182fac3d50aa18780d98ce260e6c7de460a5b3dd565cc45ea534e89aaaaa4d
|
|
7
|
+
data.tar.gz: d68c37818e5ae0a20f9ff236914110f163bc775374dde1c886baa210231c1a50596aaabd1ae6357c4bdbe3667385678a669a22b9ef04c72a1273135566187797
|
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.5.3] - 2025-10-20
|
|
12
|
+
|
|
13
|
+
- Always have a header with X button on the dialogs
|
|
14
|
+
|
|
11
15
|
## [0.5.2] - 2025-10-20
|
|
12
16
|
|
|
13
17
|
- Fix the image dialog auto-transformation feature protection again
|
data/README.md
CHANGED
|
@@ -387,16 +387,6 @@ Click outside to close this dialog.
|
|
|
387
387
|
???
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
**Without Header** - Remove the dialog header entirely:
|
|
391
|
-
|
|
392
|
-
```markdown
|
|
393
|
-
???without-header
|
|
394
|
-
Open Dialog
|
|
395
|
-
>>>
|
|
396
|
-
This dialog has no header.
|
|
397
|
-
???
|
|
398
|
-
```
|
|
399
|
-
|
|
400
390
|
**Custom Width** - Set a specific width using CSS units (px, em, rem, vw, vh, %):
|
|
401
391
|
|
|
402
392
|
```markdown
|
|
@@ -428,15 +418,9 @@ Open Dialog
|
|
|
428
418
|
# Custom Dialog
|
|
429
419
|
This dialog has light dismiss enabled and is 700px wide.
|
|
430
420
|
???
|
|
431
|
-
|
|
432
|
-
???without-header light-dismiss 45em
|
|
433
|
-
Open Simple Dialog
|
|
434
|
-
>>>
|
|
435
|
-
This dialog has no header, light dismiss, and is 45em wide.
|
|
436
|
-
???
|
|
437
421
|
```
|
|
438
422
|
|
|
439
|
-
> **Note**: The dialog uses Web Awesome's declarative `data-dialog` API, so no custom JavaScript is needed. Each dialog gets a unique ID automatically generated from its content, and a
|
|
423
|
+
> **Note**: The dialog uses Web Awesome's declarative `data-dialog` API, so no custom JavaScript is needed. Each dialog gets a unique ID automatically generated from its content. The header with X close button is always shown for accessibility, and a "Close" button is automatically added to the footer.
|
|
440
424
|
|
|
441
425
|
### Details/Summary (Collapsible Content)
|
|
442
426
|
|
|
@@ -621,12 +605,12 @@ Cards automatically parse content into these slots:
|
|
|
621
605
|
| Option | Description |
|
|
622
606
|
|--------|-------------|
|
|
623
607
|
| `light-dismiss` | Dialog closes when clicking outside/on overlay |
|
|
624
|
-
| `without-header` | Removes the dialog header entirely |
|
|
625
608
|
| Width (e.g., `500px`, `50vw`, `40em`) | Sets custom width using CSS units (px, em, rem, vw, vh, %) |
|
|
626
609
|
|
|
627
610
|
### Dialog Features
|
|
628
611
|
|
|
629
612
|
- **Automatic ID Generation**: Each dialog gets a unique ID based on MD5 hash of its content
|
|
613
|
+
- **Header with X Button**: The header with X close button is always shown for accessibility
|
|
630
614
|
- **Auto-close Button**: A "Close" button is automatically added to the footer
|
|
631
615
|
- **Declarative API**: Uses Web Awesome's `data-dialog` attributes - no custom JavaScript needed
|
|
632
616
|
- **Label Extraction**: First `#` heading becomes the dialog label, or button text is used as fallback
|
|
@@ -8,7 +8,8 @@ module Jekyll
|
|
|
8
8
|
# Transforms dialog syntax into wa-dialog elements with trigger buttons
|
|
9
9
|
# Primary syntax: ???params\nbutton text\n>>>\ncontent\n???
|
|
10
10
|
# Alternative syntax: :::wa-dialog params\nbutton text\n>>>\ncontent\n:::
|
|
11
|
-
# Params: light-dismiss
|
|
11
|
+
# Params: light-dismiss and optional width (e.g., 500px, 50vw, 40em)
|
|
12
|
+
# Note: Header with close X button is always enabled for accessibility
|
|
12
13
|
class DialogTransformer < BaseTransformer
|
|
13
14
|
def self.transform(content)
|
|
14
15
|
# Define both regex patterns - capture parameter string, button text, and content
|
|
@@ -24,7 +25,7 @@ module Jekyll
|
|
|
24
25
|
dialog_content = dialog_content.strip
|
|
25
26
|
|
|
26
27
|
# Parse parameters
|
|
27
|
-
light_dismiss,
|
|
28
|
+
light_dismiss, width = parse_parameters(params_string)
|
|
28
29
|
|
|
29
30
|
# Extract label from first heading or use button text
|
|
30
31
|
label, content_without_label = extract_label(dialog_content, button_text)
|
|
@@ -37,7 +38,7 @@ module Jekyll
|
|
|
37
38
|
|
|
38
39
|
# Build the dialog HTML
|
|
39
40
|
build_dialog_html(dialog_id, button_text, label, content_html,
|
|
40
|
-
light_dismiss,
|
|
41
|
+
light_dismiss, width)
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
# Apply both patterns
|
|
@@ -50,12 +51,11 @@ module Jekyll
|
|
|
50
51
|
|
|
51
52
|
# Parse parameters from the params string
|
|
52
53
|
def parse_parameters(params_string)
|
|
53
|
-
return [false,
|
|
54
|
+
return [false, nil] if params_string.nil? || params_string.strip.empty?
|
|
54
55
|
|
|
55
56
|
tokens = params_string.strip.split(/\s+/)
|
|
56
57
|
|
|
57
58
|
light_dismiss = tokens.include?('light-dismiss')
|
|
58
|
-
without_header = tokens.include?('without-header')
|
|
59
59
|
|
|
60
60
|
# Look for width parameter (last token with CSS units)
|
|
61
61
|
width = nil
|
|
@@ -66,10 +66,11 @@ module Jekyll
|
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
[light_dismiss,
|
|
69
|
+
[light_dismiss, width]
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
# Extract label from first heading in content
|
|
73
|
+
# Always returns a label - uses heading if available, otherwise default_label
|
|
73
74
|
def extract_label(content, default_label)
|
|
74
75
|
# Check if content starts with a heading
|
|
75
76
|
if content.match(/^#\s+(.+?)$/)
|
|
@@ -78,6 +79,7 @@ module Jekyll
|
|
|
78
79
|
content_without_label = content.sub(/^#\s+.+?\n/, '').strip
|
|
79
80
|
[label, content_without_label]
|
|
80
81
|
else
|
|
82
|
+
# Use default label (button text) to ensure header is always shown
|
|
81
83
|
[default_label, content]
|
|
82
84
|
end
|
|
83
85
|
end
|
|
@@ -90,13 +92,14 @@ module Jekyll
|
|
|
90
92
|
end
|
|
91
93
|
|
|
92
94
|
# Build the complete dialog HTML with trigger button
|
|
95
|
+
# Header with X close button is always enabled for accessibility
|
|
93
96
|
def build_dialog_html(dialog_id, button_text, label, content_html,
|
|
94
|
-
light_dismiss,
|
|
97
|
+
light_dismiss, width)
|
|
95
98
|
# Build dialog attributes
|
|
96
99
|
dialog_attrs = ["id='#{dialog_id}'"]
|
|
97
100
|
# Escape both HTML and attribute characters for label
|
|
98
|
-
|
|
99
|
-
dialog_attrs << '
|
|
101
|
+
# Header is always shown to provide the X close button
|
|
102
|
+
dialog_attrs << "label='#{escape_attribute(escape_html(label))}'"
|
|
100
103
|
dialog_attrs << 'light-dismiss' if light_dismiss
|
|
101
104
|
|
|
102
105
|
# Build style attribute for width if specified
|
|
@@ -120,7 +120,8 @@ module Jekyll
|
|
|
120
120
|
width = extract_width_from_title(title)
|
|
121
121
|
|
|
122
122
|
# Build dialog parameters
|
|
123
|
-
|
|
123
|
+
# Always include header with X close button for accessibility
|
|
124
|
+
params = ['light-dismiss']
|
|
124
125
|
params << width if width
|
|
125
126
|
params_string = params.join(' ')
|
|
126
127
|
|
|
@@ -129,8 +130,10 @@ module Jekyll
|
|
|
129
130
|
title_attr = title && !title.include?('nodialog') && !contains_width?(title) ? " title=\"#{title}\"" : ''
|
|
130
131
|
button_content = "<img src=\"#{image_url}\" alt=\"#{alt_text}\" style=\"cursor: zoom-in; display: block; width: 100%; height: auto;\"#{title_attr} />"
|
|
131
132
|
|
|
132
|
-
# Build the dialog content
|
|
133
|
-
|
|
133
|
+
# Build the dialog content with alt text as heading for the label
|
|
134
|
+
# Use alt text for the label, or "Image" as fallback if alt is empty
|
|
135
|
+
label_text = alt_text.empty? ? 'Image' : alt_text
|
|
136
|
+
dialog_content = "# #{label_text}\n\n<img src=\"#{image_url}\" alt=\"#{alt_text}\" style=\"max-width: 100%; height: auto; display: block; margin: 0 auto;\" />"
|
|
134
137
|
|
|
135
138
|
# Use our custom dialog syntax that will be processed by DialogTransformer
|
|
136
139
|
# Format: ???params\nbutton_content\n>>>\ndialog_content\n???
|