mirror of
https://github.com/SharpeTronics/jekyll-spaceship.git
synced 2025-06-23 00:01:17 -04:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8ca6d144a4 | ||
|
7847cac8c4 | ||
|
6973d6ab7e |
@ -966,7 +966,7 @@ Automatically adds a `target="_blank" rel="noopener noreferrer"` attribute to al
|
||||
jekyll-spaceship:
|
||||
element-processor:
|
||||
css:
|
||||
- a: # Replce all `a` tags
|
||||
- a: # Replace all `a` tags
|
||||
props:
|
||||
class: ['(^.*$)', '\0 ext-link'] # Add `ext-link` to class by regex pattern
|
||||
target: _blank # Replace `target` value to `_blank`
|
||||
@ -982,7 +982,7 @@ Automatically adds `loading="lazy"` to `img` and `iframe` tags to natively load
|
||||
jekyll-spaceship:
|
||||
element-processor:
|
||||
css:
|
||||
- a: # Replce all `a` tags
|
||||
- a: # Replace all `a` tags
|
||||
props: #
|
||||
loading: lazy # Replace `loading` value to `lazy`
|
||||
```
|
||||
@ -997,7 +997,7 @@ See the following examples to prevent lazy loading.
|
||||
jekyll-spaceship:
|
||||
element-processor:
|
||||
css:
|
||||
- a: # Replce all `a` tags
|
||||
- a: # Replace all `a` tags
|
||||
props: #
|
||||
loading: eager # Replace `loading` value to `eager`
|
||||
```
|
||||
|
@ -116,7 +116,7 @@ module Jekyll::Spaceship
|
||||
if self.respond_to? method
|
||||
@page.content = self.pre_exclude @page.content
|
||||
@page.content = self.send method, @page.content
|
||||
@page.content = self.after_exclude @page.content
|
||||
@page.content = self.post_exclude @page.content
|
||||
end
|
||||
else
|
||||
if Type.html? output_ext
|
||||
@ -151,8 +151,8 @@ module Jekyll::Spaceship
|
||||
logger.log file
|
||||
end
|
||||
|
||||
def pre_exclude(content)
|
||||
@exclusion_store = []
|
||||
def exclusion_regexs()
|
||||
regexs = []
|
||||
@exclusions.each do |type|
|
||||
regex = nil
|
||||
if type == :code
|
||||
@ -162,7 +162,14 @@ module Jekyll::Spaceship
|
||||
elsif type == :liquid_filter
|
||||
regex = /((?<!\\)((\{\{[^\n]*?\}\})|(\{%[^\n]*?%\})))/
|
||||
end
|
||||
next if regex.nil?
|
||||
regexs.push regex unless regex.nil?
|
||||
end
|
||||
regexs
|
||||
end
|
||||
|
||||
def pre_exclude(content, regexs = self.exclusion_regexs())
|
||||
@exclusion_store = []
|
||||
regexs.each do |regex|
|
||||
content.scan(regex) do |match_data|
|
||||
match = match_data[0]
|
||||
id = @exclusion_store.size
|
||||
@ -173,7 +180,7 @@ module Jekyll::Spaceship
|
||||
content
|
||||
end
|
||||
|
||||
def after_exclude(content)
|
||||
def post_exclude(content)
|
||||
while @exclusion_store.size > 0
|
||||
match = @exclusion_store.pop
|
||||
id = @exclusion_store.size
|
||||
|
@ -305,10 +305,12 @@ module Jekyll::Spaceship
|
||||
cvter = self.converter('markdown')
|
||||
return if cvter.nil?
|
||||
content = cell.inner_html
|
||||
content = self.pre_exclude(content, [/(\<code.*\>.*\<\/code\>)/])
|
||||
.gsub(/(?<!\\)\|/, '\\|')
|
||||
.gsub(/^\s+|\s+$/, '')
|
||||
.gsub(/</, '<')
|
||||
.gsub(/>/, '>')
|
||||
content = self.post_exclude(content)
|
||||
content = cvter.convert(content)
|
||||
content = Nokogiri::HTML.fragment(content)
|
||||
if content.children.first&.name == 'p'
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
module Jekyll
|
||||
module Spaceship
|
||||
VERSION = "0.9.2"
|
||||
VERSION = "0.9.3"
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user