markawesome 0.8.0 → 0.9.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 +11 -0
- data/README.md +1 -1
- data/lib/markawesome/transformers/popover_transformer.rb +73 -1
- data/lib/markawesome/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: aad59927898fc25ed0af9ae66614cf194c64e89ae06d9ac08dc1b82d810f9c07
|
|
4
|
+
data.tar.gz: 0e54e43e57692c1041fe898e972b703030e09dadb569f5c8cc57a9c385599e79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad7fccbc59895042fd63920d75dc6c4cd7505852226736af79dc9b5cf94feb2fca824e5973f68487d41494dd27d22193f2d35b84e3170222bd2e4dcae8fbdc6b
|
|
7
|
+
data.tar.gz: 47dab2727e5dc838ad25ead4a7f882e6ee8245e6e31ac8d5454654ec1b0d24f5b176747ba6d9673b043a2daf53f9e79c28ceff1e1dd90f298a1ea3b4467bd2fd
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.9.0] - 2026-03-12
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **PopoverTransformer**: Inline syntax `&&&trigger text >>> popover content&&&` for use within sentences
|
|
12
|
+
- Always renders as link-styled trigger (underlined text button)
|
|
13
|
+
- Supports all parameters: placement, `without-arrow`, `distance:N`
|
|
14
|
+
- Parameters placed before trigger text, separated by spaces
|
|
15
|
+
- Plain text content (HTML-escaped, no markdown processing)
|
|
16
|
+
- Multiple inline popovers supported on the same line
|
|
17
|
+
|
|
7
18
|
## [0.8.0] - 2026-03-12
|
|
8
19
|
|
|
9
20
|
### Added
|
data/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Used as the transformation engine for the [jekyll-webawesome](https://github.com
|
|
|
25
25
|
| **Dialog** | `???params?` | `:::wa-dialog params?` | `<wa-dialog>` with trigger button and content |
|
|
26
26
|
| **Icon** | `$$$icon-name` | `:::wa-icon icon-name` | `<wa-icon name="icon-name"></wa-icon>` |
|
|
27
27
|
| **Image Dialog** | `` | — | Wraps images in clickable `<wa-dialog>` overlays |
|
|
28
|
-
| **Popover** | `&&¶ms?` | `:::wa-popover params?` | `<wa-popover>` with trigger button and content |
|
|
28
|
+
| **Popover** | `&&¶ms?` or inline `&&&trigger >>> content&&&` | `:::wa-popover params?` | `<wa-popover>` with trigger button and content |
|
|
29
29
|
| **Tab Group** | `++++++` | `:::wa-tabs` | `<wa-tab-group><wa-tab>content</wa-tab></wa-tab-group>` |
|
|
30
30
|
| **Tag** | `@@@brand` | `:::wa-tag brand` | `<wa-tag variant="brand">content</wa-tag>` |
|
|
31
31
|
|
|
@@ -8,6 +8,7 @@ module Markawesome
|
|
|
8
8
|
# Transforms popover syntax into wa-popover elements with trigger buttons
|
|
9
9
|
# Primary syntax: &&¶ms\ntrigger text\n>>>\ncontent\n&&&
|
|
10
10
|
# Alternative syntax: :::wa-popover params\ntrigger text\n>>>\ncontent\n:::
|
|
11
|
+
# Inline syntax: &&¶ms? trigger text >>> popover content&&&
|
|
11
12
|
#
|
|
12
13
|
# Params: space-separated tokens (order doesn't matter)
|
|
13
14
|
# Placement: top (default), bottom, left, right
|
|
@@ -21,9 +22,32 @@ module Markawesome
|
|
|
21
22
|
}.freeze
|
|
22
23
|
|
|
23
24
|
def self.transform(content)
|
|
25
|
+
# Inline regex (single-line, no newlines allowed)
|
|
26
|
+
inline_regex = /&&&[ \t]*([^\r\n]*?)[ \t]*>>>[ \t]*([^\r\n]+?)[ \t]*&&&/
|
|
27
|
+
|
|
28
|
+
# Block regexes (multiline)
|
|
24
29
|
primary_regex = /^&&&([^\n]*)$\n(.*?)\n^>>>$\n(.*?)\n^&&&$/m
|
|
25
30
|
alternative_regex = /^:::wa-popover([^\n]*)$\n(.*?)\n^>>>$\n(.*?)\n^:::$/m
|
|
26
31
|
|
|
32
|
+
# Inline transformation (always link style, plain text content)
|
|
33
|
+
inline_transform = {
|
|
34
|
+
regex: inline_regex,
|
|
35
|
+
block: proc do |_match, matchdata|
|
|
36
|
+
combined = matchdata[1]
|
|
37
|
+
popover_content = matchdata[2].strip
|
|
38
|
+
|
|
39
|
+
params_string, trigger_text = parse_inline_trigger_and_params(combined)
|
|
40
|
+
placement, without_arrow, distance, _link_style = parse_parameters(params_string)
|
|
41
|
+
|
|
42
|
+
popover_id = generate_popover_id(trigger_text, popover_content)
|
|
43
|
+
|
|
44
|
+
build_inline_popover_html(popover_id, trigger_text, popover_content,
|
|
45
|
+
{ placement: placement, without_arrow: without_arrow,
|
|
46
|
+
distance: distance })
|
|
47
|
+
end
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Block transformation (existing)
|
|
27
51
|
transform_proc = proc do |params_string, trigger_text, popover_content|
|
|
28
52
|
trigger_text = trigger_text.strip
|
|
29
53
|
popover_content = popover_content.strip
|
|
@@ -39,7 +63,11 @@ module Markawesome
|
|
|
39
63
|
distance: distance, link_style: link_style })
|
|
40
64
|
end
|
|
41
65
|
|
|
42
|
-
patterns
|
|
66
|
+
# Inline patterns first to avoid conflicts with block patterns
|
|
67
|
+
patterns = [
|
|
68
|
+
inline_transform,
|
|
69
|
+
*dual_syntax_patterns(primary_regex, alternative_regex, transform_proc)
|
|
70
|
+
]
|
|
43
71
|
apply_multiple_patterns(content, patterns)
|
|
44
72
|
end
|
|
45
73
|
|
|
@@ -68,6 +96,50 @@ module Markawesome
|
|
|
68
96
|
"popover-#{hash[0..7]}"
|
|
69
97
|
end
|
|
70
98
|
|
|
99
|
+
def parse_inline_trigger_and_params(combined_string)
|
|
100
|
+
tokens = combined_string.strip.split(/\s+/)
|
|
101
|
+
param_tokens = []
|
|
102
|
+
trigger_tokens = []
|
|
103
|
+
found_content = false
|
|
104
|
+
|
|
105
|
+
tokens.each do |token|
|
|
106
|
+
if !found_content && popover_param?(token)
|
|
107
|
+
param_tokens << token
|
|
108
|
+
else
|
|
109
|
+
found_content = true
|
|
110
|
+
trigger_tokens << token
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
trigger_text = trigger_tokens.join(' ')
|
|
115
|
+
|
|
116
|
+
# If no trigger text remains, treat entire string as trigger (no params)
|
|
117
|
+
if trigger_text.empty?
|
|
118
|
+
['', combined_string.strip]
|
|
119
|
+
else
|
|
120
|
+
[param_tokens.join(' '), trigger_text]
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def popover_param?(token)
|
|
125
|
+
POPOVER_ATTRIBUTES.any? { |_attr, values| values.include?(token) } ||
|
|
126
|
+
token.match?(/^distance:\d+$/)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def build_inline_popover_html(popover_id, trigger_text, content_text, options)
|
|
130
|
+
trigger_content = escape_html(trigger_text)
|
|
131
|
+
content_escaped = escape_html(content_text)
|
|
132
|
+
|
|
133
|
+
popover_attrs = ["for='#{popover_id}'"]
|
|
134
|
+
popover_attrs << "placement='#{options[:placement]}'"
|
|
135
|
+
popover_attrs << 'without-arrow' if options[:without_arrow]
|
|
136
|
+
popover_attrs << "distance='#{options[:distance]}'" if options[:distance]
|
|
137
|
+
|
|
138
|
+
trigger = build_trigger(popover_id, trigger_content, true)
|
|
139
|
+
|
|
140
|
+
"#{trigger}<wa-popover #{popover_attrs.join(' ')}>#{content_escaped}</wa-popover>"
|
|
141
|
+
end
|
|
142
|
+
|
|
71
143
|
def build_popover_html(popover_id, trigger_text, content_html, options)
|
|
72
144
|
# Escape trigger text for security
|
|
73
145
|
trigger_content = escape_html(trigger_text)
|
data/lib/markawesome/version.rb
CHANGED