jekyll-koziolekweb-deorphanter 0.1.2 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/jekyll/koziolekweb/deorphanter/version.rb +1 -1
- data/lib/jekyll/koziolekweb/deorphanter.rb +22 -1
- data/sig/koziolekweb/deorphanter.rbs +7 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b754ff78635e182af4220f5a898db4f129feddaf73e1f757b77f459f1981718f
|
4
|
+
data.tar.gz: b132fd13d15ef1f3364a3582fbc3dacb4d7a94443c65026bbabe8390ae142390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 225c4c56a57b60319c8f56ea15370a1d8dfcfad589337cbd064b74dc2a2ced0d66573fe6a05c18db4d9499d566ff1b26bf66de587f19cdc8b03abb158e7f4b2d
|
7
|
+
data.tar.gz: fa517f73ced442ca37a31895ef4eb2c493463ddb33590b08185f2b35596637fccbe7bc1ee43fc50ff7cbd679e5885c182e5372b1d8216d9025f676fe208bcf73
|
data/CHANGELOG.md
ADDED
@@ -4,11 +4,32 @@ require_relative "deorphanter/version"
|
|
4
4
|
|
5
5
|
module Koziolekweb
|
6
6
|
module Deorphanter
|
7
|
+
|
8
|
+
SINGLE_LETTER = /\b([a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ\-–])\b(?:\s|$)/
|
9
|
+
REPLACE = '\1 '
|
10
|
+
BLOCK_REGEX = /```.*?```/m.freeze
|
11
|
+
|
12
|
+
# Metoda zastępująca pojedyncze litery przekształcone w ` `
|
7
13
|
def self.replace_single_letter_spaces(content)
|
8
14
|
return content unless content && content.is_a?(String)
|
9
|
-
|
15
|
+
|
16
|
+
chunks = []
|
17
|
+
# Podział treści na części (wewnątrz bloków kodu i poza nimi)
|
18
|
+
content.split(BLOCK_REGEX).each_with_index do |chunk, index|
|
19
|
+
chunk = chunk.gsub(SINGLE_LETTER, REPLACE)
|
20
|
+
chunks << chunk
|
21
|
+
end
|
22
|
+
|
23
|
+
# Wstawianie nieruszonych bloków kodu z powrotem na swoje miejsca
|
24
|
+
content.scan(BLOCK_REGEX).each_with_index do |code_block, i|
|
25
|
+
chunks.insert(2 * i + 1, code_block)
|
26
|
+
end
|
27
|
+
|
28
|
+
chunks.join
|
10
29
|
end
|
11
30
|
|
31
|
+
|
32
|
+
|
12
33
|
def self.apply_hook_to(document)
|
13
34
|
document.content = replace_single_letter_spaces(document.content)
|
14
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-koziolekweb-deorphanter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koziolek
|
@@ -37,6 +37,7 @@ executables: []
|
|
37
37
|
extensions: []
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
|
+
- CHANGELOG.md
|
40
41
|
- LICENSE.txt
|
41
42
|
- README.md
|
42
43
|
- Rakefile
|
@@ -44,6 +45,7 @@ files:
|
|
44
45
|
- lib/jekyll/koziolekweb/deorphanter.rb
|
45
46
|
- lib/jekyll/koziolekweb/deorphanter/version.rb
|
46
47
|
- sig/jekyll/koziolekweb/deorphanter.rbs
|
48
|
+
- sig/koziolekweb/deorphanter.rbs
|
47
49
|
homepage: https://github.com/Koziolek/jekyll-koziolekweb-deorphanter
|
48
50
|
licenses:
|
49
51
|
- MIT
|