jekyll-spaceship 0.9.2 → 0.9.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: 604e55f37a3597c851c56fd267f316eea0a180adcb8613c0908efa9f5ea87869
4
- data.tar.gz: a32c960d432a348eb583d2e5d114f66564de56e2726b680765166bce86adbd6f
3
+ metadata.gz: 993252decbad6e7d20ed20245f3ba7c7858eb5845402b06605a8b05d6268225f
4
+ data.tar.gz: 45012fc8ca11671a98d36b1e1c6dfbfef67cc1c12f01f265ed507760e96f40fd
5
5
  SHA512:
6
- metadata.gz: 4f8383046d4a550ddacd859e14699b90b7a92d3759ebddf34430a8cbe421bfe1334f9a80186b80942aaff96a5802415ff7d01b78ec70939719aa483686238778
7
- data.tar.gz: c9c98d831503df109e943d49030c7a6b7d0a37cd0d1eb0dba6fe39f555ee05ceaf5550d8cbcab10ec8160eb7bdc559db9ca8bcd6a7ec3ddefc813b97ecb7a585
6
+ metadata.gz: 139508a04521719d9160e2a0cff09a75600dffc5cae80c9dd75ec047495be87a1a7b786b859d5e335df9226d35617aa9e6470a4905fb497799f2c0c9981d6da2
7
+ data.tar.gz: 00b615b28c36a335749d5b3dcd7a60e55b8639b2d86ae8e027243985c939e75333fd4c882ed84999f3de07b43ff07c632db62f88f3641dc4634c744f91a2b279
data/README.md CHANGED
@@ -966,7 +966,7 @@ Automatically adds a `target="_blank" rel="noopener noreferrer"` attribute to al
966
966
  jekyll-spaceship:
967
967
  element-processor:
968
968
  css:
969
- - a: # Replce all `a` tags
969
+ - a: # Replace all `a` tags
970
970
  props:
971
971
  class: ['(^.*$)', '\0 ext-link'] # Add `ext-link` to class by regex pattern
972
972
  target: _blank # Replace `target` value to `_blank`
@@ -982,7 +982,7 @@ Automatically adds `loading="lazy"` to `img` and `iframe` tags to natively load
982
982
  jekyll-spaceship:
983
983
  element-processor:
984
984
  css:
985
- - a: # Replce all `a` tags
985
+ - a: # Replace all `a` tags
986
986
  props: #
987
987
  loading: lazy # Replace `loading` value to `lazy`
988
988
  ```
@@ -997,7 +997,7 @@ See the following examples to prevent lazy loading.
997
997
  jekyll-spaceship:
998
998
  element-processor:
999
999
  css:
1000
- - a: # Replce all `a` tags
1000
+ - a: # Replace all `a` tags
1001
1001
  props: #
1002
1002
  loading: eager # Replace `loading` value to `eager`
1003
1003
  ```
@@ -116,7 +116,7 @@ module Jekyll::Spaceship
116
116
  if self.respond_to? method
117
117
  @page.content = self.pre_exclude @page.content
118
118
  @page.content = self.send method, @page.content
119
- @page.content = self.after_exclude @page.content
119
+ @page.content = self.post_exclude @page.content
120
120
  end
121
121
  else
122
122
  if Type.html? output_ext
@@ -151,8 +151,8 @@ module Jekyll::Spaceship
151
151
  logger.log file
152
152
  end
153
153
 
154
- def pre_exclude(content)
155
- @exclusion_store = []
154
+ def exclusion_regexs()
155
+ regexs = []
156
156
  @exclusions.each do |type|
157
157
  regex = nil
158
158
  if type == :code
@@ -162,7 +162,14 @@ module Jekyll::Spaceship
162
162
  elsif type == :liquid_filter
163
163
  regex = /((?<!\\)((\{\{[^\n]*?\}\})|(\{%[^\n]*?%\})))/
164
164
  end
165
- next if regex.nil?
165
+ regexs.push regex unless regex.nil?
166
+ end
167
+ regexs
168
+ end
169
+
170
+ def pre_exclude(content, regexs = self.exclusion_regexs())
171
+ @exclusion_store = []
172
+ regexs.each do |regex|
166
173
  content.scan(regex) do |match_data|
167
174
  match = match_data[0]
168
175
  id = @exclusion_store.size
@@ -173,7 +180,7 @@ module Jekyll::Spaceship
173
180
  content
174
181
  end
175
182
 
176
- def after_exclude(content)
183
+ def post_exclude(content)
177
184
  while @exclusion_store.size > 0
178
185
  match = @exclusion_store.pop
179
186
  id = @exclusion_store.size
@@ -305,10 +305,12 @@ module Jekyll::Spaceship
305
305
  cvter = self.converter('markdown')
306
306
  return if cvter.nil?
307
307
  content = cell.inner_html
308
+ content = self.pre_exclude(content, [/(\<code.*\>.*\<\/code\>)/])
308
309
  .gsub(/(?<!\\)\|/, '\\|')
309
310
  .gsub(/^\s+|\s+$/, '')
310
311
  .gsub(/&lt;/, '<')
311
312
  .gsub(/&gt;/, '>')
313
+ content = self.post_exclude(content)
312
314
  content = cvter.convert(content)
313
315
  content = Nokogiri::HTML.fragment(content)
314
316
  if content.children.first&.name == 'p'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Spaceship
5
- VERSION = "0.9.2"
5
+ VERSION = "0.9.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-spaceship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jeffreytse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-18 00:00:00.000000000 Z
11
+ date: 2020-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll