jekyll-webawesome 0.5.1 → 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: 5f88821b94fa1042ddd81efc46e15e35eb4b0c53f1159ccba1f92f171bf3b498
4
- data.tar.gz: a10ad10f3477bbbe7da32eab5b9faaab0ef202e94aa6369ee28936ae52017d19
3
+ metadata.gz: 0eb043c7874298974076489ed4af4504d1bdce4e78f6e9820565ac30f5f5fb0d
4
+ data.tar.gz: 74533e8e3def155464fc7a29549884c8bc39cd0f7287a9f71f0586ad444227f2
5
5
  SHA512:
6
- metadata.gz: 78af1fefc803ab19f6da488775df860d49c0f7855afdec3ed9e2a8794b5e4261914bbd169ad275be7094a8aa10656c36c0ce6a3db88021544ffd6e7b81b2c47f
7
- data.tar.gz: 9bb145b074f07b779f0fec449d3b24c2c7727a7fd55e9cdeb1697460a8d0214bf6052d84ce0a2686a0b4e2c83264c1a0137cfdb71e20eef204d4d6febfe7cf5d
6
+ metadata.gz: 0d81de534b59e1b689794758c51b616f4d8832008ed7f6e64aebb7d6baccd27acfd4f849ed8b316792985a9e7f3ed918ff71b8b7886f8ebd841d286620622435
7
+ data.tar.gz: f61de46408da1b0b9da491d98cce8069cf9c93e8073d96fa1c1126e272832450e3e374db3a7aea2fcd47425c92606d7dc6dba0419009173438f3f61ebb6f7be1
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.2] - 2025-10-20
12
+
13
+ - Fix the image dialog auto-transformation feature protection again
14
+
11
15
  ## [0.5.1] - 2025-10-20
12
16
 
13
17
  - Image dialog auto-transformation feature fix: protect comparison components
@@ -10,8 +10,9 @@ 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 and comparison 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)
15
16
  protected_content, comparison_blocks = protect_comparisons(protected_content)
16
17
 
17
18
  # Match markdown images: ![alt](url) or ![alt](url "title")
@@ -34,19 +35,40 @@ module Jekyll
34
35
  end
35
36
  end
36
37
 
37
- # Restore protected comparison blocks first, then inline code
38
+ # Restore protected blocks in reverse order
38
39
  result = restore_comparisons(result, comparison_blocks)
39
- restore_inline_code(result, code_blocks)
40
+ result = restore_inline_code(result, inline_code_blocks)
41
+ restore_fenced_code_blocks(result, fenced_code_blocks)
40
42
  end
41
43
 
42
44
  class << self
43
45
  private
44
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
+
45
67
  # Protect inline code from transformation
46
68
  def protect_inline_code(content)
47
69
  code_blocks = []
48
70
  protected = content.gsub(/`[^`]+`/) do |match|
49
- placeholder = "INLINE_CODE_#{code_blocks.length}"
71
+ placeholder = "<!--IMAGE_DIALOG_INLINE_CODE_#{code_blocks.length}-->"
50
72
  code_blocks << match
51
73
  placeholder
52
74
  end
@@ -56,27 +78,37 @@ module Jekyll
56
78
  # Restore protected inline code
57
79
  def restore_inline_code(content, code_blocks)
58
80
  code_blocks.each_with_index do |code, index|
59
- content = content.gsub("INLINE_CODE_#{index}", code)
81
+ content = content.gsub("<!--IMAGE_DIALOG_INLINE_CODE_#{index}-->", code)
60
82
  end
61
83
  content
62
84
  end
63
85
 
64
86
  # Protect comparison blocks from image transformation
87
+ # Must protect both markdown syntax (|||...|||) and already-transformed HTML
65
88
  def protect_comparisons(content)
66
89
  comparison_blocks = []
67
- # Match comparison blocks: <wa-comparison ...>...</wa-comparison>
68
- protected = content.gsub(/<wa-comparison[^>]*>.*?<\/wa-comparison>/m) do |match|
69
- placeholder = "COMPARISON_BLOCK_#{comparison_blocks.length}"
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}-->"
70
101
  comparison_blocks << match
71
102
  placeholder
72
103
  end
104
+
73
105
  [protected, comparison_blocks]
74
106
  end
75
107
 
76
108
  # Restore protected comparison blocks
77
109
  def restore_comparisons(content, comparison_blocks)
78
110
  comparison_blocks.each_with_index do |block, index|
79
- content = content.gsub("COMPARISON_BLOCK_#{index}", block)
111
+ content = content.gsub("<!--IMAGE_DIALOG_COMPARISON_#{index}-->", block)
80
112
  end
81
113
  content
82
114
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module WebAwesome
5
- VERSION = '0.5.1'
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.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janne Waren