jekyll-client-search 0.3.0 → 0.3.1
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 +13 -0
- data/lib/jekyll/client_search/document_builder.rb +2 -2
- data/lib/jekyll/client_search/related_tag.rb +27 -11
- data/lib/jekyll/client_search/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: 1d3574c3adc2e2e00dd76ef5b5011358fcb9abfe3ed0cfbd372dffee00f913fc
|
|
4
|
+
data.tar.gz: 76f691ec62695d6e99677bc952fe85ae07c477df563f83b29f063a58f5b0d8c0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23b5534d2c60626e5ee068687f2c4313f6e7494f1e382b89928f37b3eaf50fad3f979808e696c6a2bf3d17a5a00764674667b9f8f4041b4fc6f73a71953fcee7
|
|
7
|
+
data.tar.gz: 9403f90fd84ee7798fa07281001faf534028247e2f99aea46a9a305b8c3ac57191ae0059cb49ca8eb377b1ba7633b5960f3c481bc24e0cc6de872d30132b3521
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.3.1 — 2026-09-09
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Fix CodeQL `rb/bad-tag-filter` (high) in `DocumentBuilder#clean` — closing tag regex `</script\s*>` only matched whitespace before `>`, missing browser-accepted tags like `</script\t\n bar>`; changed to `</script[^>]*>` and `</style[^>]*>` to match any non-`>` content
|
|
9
|
+
- Fix CodeQL `rb/polynomial-redos` (high) in `RelatedTag` — `\s*` patterns between optional groups in SYNTAX regex caused O(n²) backtracking on input with many spaces; replaced single regex with token-split parser that validates each token individually
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Update `simplecov` 1.1.1 → 1.2.0
|
|
13
|
+
- Update `google-protobuf` 4.36.0 → 4.36.1 (transitive)
|
|
14
|
+
- Update `sass-embedded` 1.103.1 → 1.104.0 (transitive)
|
|
15
|
+
- Update `eslint` 10.9.1 → 10.10.0 (dev)
|
|
16
|
+
- Update `globals` 17.11.0 → 17.12.0 (dev)
|
|
17
|
+
|
|
5
18
|
## 0.3.0 — 2026-09-02
|
|
6
19
|
|
|
7
20
|
### Added
|
|
@@ -67,8 +67,8 @@ module Jekyll
|
|
|
67
67
|
|
|
68
68
|
def clean(value)
|
|
69
69
|
cleaned = value.to_s
|
|
70
|
-
.gsub(%r{<script\b[^>]*>.*?</script
|
|
71
|
-
.gsub(%r{<style\b[^>]*>.*?</style
|
|
70
|
+
.gsub(%r{<script\b[^>]*>.*?</script[^>]*>}mi, " ")
|
|
71
|
+
.gsub(%r{<style\b[^>]*>.*?</style[^>]*>}mi, " ")
|
|
72
72
|
.gsub(/\{%.*?%\}/m, " ")
|
|
73
73
|
.gsub(/\{\{.*?\}\}/m, " ")
|
|
74
74
|
.gsub(/!\[[^\]]*\]\([^)]*\)/, " ")
|
|
@@ -14,23 +14,39 @@ module Jekyll
|
|
|
14
14
|
# When +related.enabled+ is false the tag renders nothing, so it is safe
|
|
15
15
|
# to leave in a layout even when the feature is off.
|
|
16
16
|
class RelatedTag < Liquid::Tag
|
|
17
|
-
|
|
17
|
+
TOKEN_SYNTAX = /\A(sort:\w+|max:\d+|no_scripts)\z/
|
|
18
18
|
|
|
19
19
|
def initialize(tag_name, markup, tokens)
|
|
20
20
|
super
|
|
21
21
|
@markup = markup.to_s.strip
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
parse_tokens(@markup)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def parse_tokens(markup)
|
|
26
|
+
@sort = nil
|
|
27
|
+
@max_items = nil
|
|
28
|
+
@include_scripts = true
|
|
29
|
+
return if markup.empty?
|
|
30
|
+
|
|
31
|
+
markup.split(/\s+/).each { |token| apply_token(token) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def apply_token(token)
|
|
35
|
+
raise Liquid::SyntaxError, syntax_error_msg unless token.match(TOKEN_SYNTAX)
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
@
|
|
31
|
-
|
|
37
|
+
case token
|
|
38
|
+
when /\Asort:(\w+)\z/ then @sort = Regexp.last_match(1)
|
|
39
|
+
when /\Amax:(\d+)\z/
|
|
40
|
+
@max_items = Regexp.last_match(1).to_i
|
|
41
|
+
raise Liquid::SyntaxError, "related_articles: max must be greater than zero" if @max_items < 1
|
|
42
|
+
when "no_scripts" then @include_scripts = false
|
|
43
|
+
end
|
|
44
|
+
end
|
|
32
45
|
|
|
33
|
-
|
|
46
|
+
def syntax_error_msg
|
|
47
|
+
"related_articles: invalid syntax. Use {% related_articles %}, " \
|
|
48
|
+
"{% related_articles sort:date %}, {% related_articles max:3 %}, " \
|
|
49
|
+
"or {% related_articles no_scripts %}"
|
|
34
50
|
end
|
|
35
51
|
|
|
36
52
|
def render(context)
|