sutty-liquid 0.7.4 → 0.8.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll/filters/strings.rb +41 -0
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 217763268e487f10aec0b09212b07618f8a5ffedefd3afe52b8892462c616304
4
- data.tar.gz: b1b4edef6669cf7388672c178f68463ca14492d1b306715280b85c3ecdb5bd19
3
+ metadata.gz: 87fd0fcf5790752421b8e8021608a594ef80754282e6803b5da298da36e378ec
4
+ data.tar.gz: af41713f124353d976f4278a3321b0cdad298a31e45c7028d4dfb76d840d3beb
5
5
  SHA512:
6
- metadata.gz: 8493787622d5f8bc8dcda86c9a3e57be96e4d8192f46235e0c3477d70262aa13e7f96fb0f5edaf94585d314eb0d6196851fb44edab8a09ef1eab45912efbd7d0
7
- data.tar.gz: 517de2fa67d73f37583a1ba38baea81cca79eb31e96988a260f217eb4a86e726b54ea5f8622d93689c52714306dd06aea6e81831c3d2cff40dc1498b66393c72
6
+ metadata.gz: 1af5be783fea85a363199c45623d838be6dc0481706510d6138e253f508c20ac9e98e0a38908e95684a37a93d8b8f4840d9a48c2226ea819529729b073d62a48
7
+ data.tar.gz: 42efd85cbbffb56ce771c5148ab3b7a81ec8152f56b0fdad483cb58cae4d08c521ad5ede0643967ebc1381a7c555fb1527410d3dd3a84a5a166173e1d7b2441d
@@ -20,6 +20,47 @@ module Jekyll
20
20
 
21
21
  hay.join(search) + needle
22
22
  end
23
+
24
+ # We often use * for inclusive language, where language is
25
+ # gendered. This clashes with Commonmark's understanding of
26
+ # emphasis delimiters.
27
+ #
28
+ # But we want to support inclusive language and we don't
29
+ # necessarily need to know what a escape character is to do it.
30
+ #
31
+ # This filter disables *emphasis* in favor of _emphasis_ and
32
+ # escapes them.
33
+ #
34
+ # @see {https://spec.commonmark.org/0.30/#emphasis-and-strong-emphasis}
35
+ # @param :input [String]
36
+ # @return [String]
37
+ def allow_inclusive_language_in_markdown(input)
38
+ return if input.nil? || input.empty?
39
+ return unless input.to_s.include? '*'
40
+
41
+ require 'securerandom'
42
+
43
+ # Something that can't be accidentally replaced
44
+ star_delimiter = "||#{SecureRandom.hex}||"
45
+ escaped_delimiter = "||#{SecureRandom.hex}||"
46
+
47
+ # 1. Exclude escaped stars
48
+ #
49
+ # 2. Exclude bold
50
+ #
51
+ # 3. Exclude list items
52
+ #
53
+ # 4. Escape remaining stars
54
+ #
55
+ # 5. Recover original stars
56
+ input.to_s
57
+ .gsub('\*', escaped_delimiter)
58
+ .gsub('**', star_delimiter * 2)
59
+ .gsub(/^(\s*)\*/, "\\1#{star_delimiter}")
60
+ .gsub('*', '\*')
61
+ .gsub(star_delimiter, '*')
62
+ .gsub(escaped_delimiter, '\*')
63
+ end
23
64
  end
24
65
  end
25
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sutty-liquid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-05 00:00:00.000000000 Z
11
+ date: 2022-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubygems_version: 3.1.2
140
+ rubygems_version: 3.3.5
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Liquid filters