jekyll-webawesome 0.5.0 → 0.5.2

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: e958cd124d7cb081e95cc61a14db48b6c0059daa49fef318c452a3cab30fecfb
4
- data.tar.gz: b531b0aa50c859837a7500fbdb45d0c46dc0c936163b139715592b60fc3b05c5
3
+ metadata.gz: 0eb043c7874298974076489ed4af4504d1bdce4e78f6e9820565ac30f5f5fb0d
4
+ data.tar.gz: 74533e8e3def155464fc7a29549884c8bc39cd0f7287a9f71f0586ad444227f2
5
5
  SHA512:
6
- metadata.gz: 042c0a994e97c359c06edf42103fd0308bcab11f9c241b43e402fdae0bb0176ce72ab30e371a0d521fda3149245187c92447e201e0073b219573d649260c187a
7
- data.tar.gz: f44d6a009eee1d5f2b807bb2fdcc858d2372646a3900165f42d2c6c7dd0eaa7ad2b30d506d63f95ed3de9f47c130ea6a4b2f9560ff8ee7f2e95eea165508e70b
6
+ metadata.gz: 0d81de534b59e1b689794758c51b616f4d8832008ed7f6e64aebb7d6baccd27acfd4f849ed8b316792985a9e7f3ed918ff71b8b7886f8ebd841d286620622435
7
+ data.tar.gz: f61de46408da1b0b9da491d98cce8069cf9c93e8073d96fa1c1126e272832450e3e374db3a7aea2fcd47425c92606d7dc6dba0419009173438f3f61ebb6f7be1
data/CHANGELOG.md CHANGED
@@ -8,6 +8,14 @@ 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.2] - 2025-10-20
12
+
13
+ - Fix the image dialog auto-transformation feature protection again
14
+
15
+ ## [0.5.1] - 2025-10-20
16
+
17
+ - Image dialog auto-transformation feature fix: protect comparison components
18
+
11
19
  ## [0.5.0] - 2025-10-20
12
20
 
13
21
  - Add support for wa-dialog component
@@ -10,8 +10,10 @@ module Jekyll
10
10
  # Example: ![Alt text](image.png "nodialog")
11
11
  class ImageDialogTransformer < BaseTransformer
12
12
  def self.transform(content)
13
- # First, protect inline code blocks from transformation
14
- protected_content, code_blocks = protect_inline_code(content)
13
+ # First, protect code blocks, inline code, and comparison blocks from transformation
14
+ protected_content, fenced_code_blocks = protect_fenced_code_blocks(content)
15
+ protected_content, inline_code_blocks = protect_inline_code(protected_content)
16
+ protected_content, comparison_blocks = protect_comparisons(protected_content)
15
17
 
16
18
  # Match markdown images: ![alt](url) or ![alt](url "title")
17
19
  # Capture alt text, URL, and optional title
@@ -33,18 +35,40 @@ module Jekyll
33
35
  end
34
36
  end
35
37
 
36
- # Restore protected inline code
37
- restore_inline_code(result, code_blocks)
38
+ # Restore protected blocks in reverse order
39
+ result = restore_comparisons(result, comparison_blocks)
40
+ result = restore_inline_code(result, inline_code_blocks)
41
+ restore_fenced_code_blocks(result, fenced_code_blocks)
38
42
  end
39
43
 
40
44
  class << self
41
45
  private
42
46
 
47
+ # Protect fenced code blocks from transformation
48
+ def protect_fenced_code_blocks(content)
49
+ code_blocks = []
50
+ # Match both ``` and ~~~ style code blocks with optional language
51
+ protected = content.gsub(/^```.*?^```$|^~~~.*?^~~~$/m) do |match|
52
+ placeholder = "<!--IMAGE_DIALOG_FENCED_CODE_#{code_blocks.length}-->"
53
+ code_blocks << match
54
+ placeholder
55
+ end
56
+ [protected, code_blocks]
57
+ end
58
+
59
+ # Restore protected fenced code blocks
60
+ def restore_fenced_code_blocks(content, code_blocks)
61
+ code_blocks.each_with_index do |code, index|
62
+ content = content.gsub("<!--IMAGE_DIALOG_FENCED_CODE_#{index}-->", code)
63
+ end
64
+ content
65
+ end
66
+
43
67
  # Protect inline code from transformation
44
68
  def protect_inline_code(content)
45
69
  code_blocks = []
46
70
  protected = content.gsub(/`[^`]+`/) do |match|
47
- placeholder = "INLINE_CODE_#{code_blocks.length}"
71
+ placeholder = "<!--IMAGE_DIALOG_INLINE_CODE_#{code_blocks.length}-->"
48
72
  code_blocks << match
49
73
  placeholder
50
74
  end
@@ -54,7 +78,37 @@ module Jekyll
54
78
  # Restore protected inline code
55
79
  def restore_inline_code(content, code_blocks)
56
80
  code_blocks.each_with_index do |code, index|
57
- content = content.gsub("INLINE_CODE_#{index}", code)
81
+ content = content.gsub("<!--IMAGE_DIALOG_INLINE_CODE_#{index}-->", code)
82
+ end
83
+ content
84
+ end
85
+
86
+ # Protect comparison blocks from image transformation
87
+ # Must protect both markdown syntax (|||...|||) and already-transformed HTML
88
+ def protect_comparisons(content)
89
+ comparison_blocks = []
90
+
91
+ # First protect markdown comparison syntax: |||...|||
92
+ protected = content.gsub(/\|\|\|(\d+)?\n.*?\n\|\|\|/m) do |match|
93
+ placeholder = "<!--IMAGE_DIALOG_COMPARISON_#{comparison_blocks.length}-->"
94
+ comparison_blocks << match
95
+ placeholder
96
+ end
97
+
98
+ # Also protect already-transformed HTML comparison blocks: <wa-comparison ...>...</wa-comparison>
99
+ protected = protected.gsub(/<wa-comparison[^>]*>.*?<\/wa-comparison>/m) do |match|
100
+ placeholder = "<!--IMAGE_DIALOG_COMPARISON_#{comparison_blocks.length}-->"
101
+ comparison_blocks << match
102
+ placeholder
103
+ end
104
+
105
+ [protected, comparison_blocks]
106
+ end
107
+
108
+ # Restore protected comparison blocks
109
+ def restore_comparisons(content, comparison_blocks)
110
+ comparison_blocks.each_with_index do |block, index|
111
+ content = content.gsub("<!--IMAGE_DIALOG_COMPARISON_#{index}-->", block)
58
112
  end
59
113
  content
60
114
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module WebAwesome
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.2'
6
6
  end
7
7
  end
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.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janne Waren