jekyll-microtypo 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/microtypo/version.rb +1 -1
- data/lib/jekyll/microtypo.rb +26 -17
- 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: 8a02eefba53cc637d5defc6c938f15fa6843b54ed78be4ee50484717393989f6
|
4
|
+
data.tar.gz: 8badf22ea0722232973679184f4bf2c0d54b68b18625b7cb61b1d098f8a23a55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3add7ba2dfa0504a7da93472c7534d2f7d62b26c62293bd4a39d8105acd08bc7017db5d4d35c65484ee367f89cf0be01306492fdc76b5d9df6a586fba57cbedf
|
7
|
+
data.tar.gz: afef08fea0bdc8df013ea9a1c5a8e5839ced4cb2b3addad0c240fa8059f91da67a7a0c1cd3767e09c03790a0ca008a9fd6f7acdfef11aae4c0e470d4ff93444c
|
data/lib/jekyll/microtypo.rb
CHANGED
@@ -9,7 +9,10 @@ module Jekyll
|
|
9
9
|
["<code", "</code>", true],
|
10
10
|
["<!-- nomicrotypo -->", "<!-- endnomicrotypo -->", false],
|
11
11
|
].freeze
|
12
|
+
DEBUG = false
|
13
|
+
|
12
14
|
private_constant :QUEUE
|
15
|
+
private_constant :DEBUG
|
13
16
|
|
14
17
|
def self.settings(config)
|
15
18
|
@settings ||= {}
|
@@ -34,11 +37,12 @@ module Jekyll
|
|
34
37
|
def recursive_parser(input, locale, bucket, index)
|
35
38
|
input = input.to_s
|
36
39
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
# p prefix + ' and place it in the bucket' if index.zero?
|
40
|
+
prefix = " " + (" " * 3 * (QUEUE.size-index))
|
41
|
+
p prefix + ' Fix microtypo for ' + input if DEBUG && index.zero? && DEBUG
|
42
|
+
p prefix + ' and place it in the bucket' if DEBUG && index.zero?
|
41
43
|
return fix_microtypo(+input, locale, bucket) if index.zero?
|
44
|
+
|
45
|
+
p prefix + 'Recursive_parser for ' + input if DEBUG
|
42
46
|
|
43
47
|
index -= 1
|
44
48
|
head, tail, flag = QUEUE[index]
|
@@ -47,36 +51,41 @@ module Jekyll
|
|
47
51
|
indexTail = input.index(tail)
|
48
52
|
|
49
53
|
if indexHead.nil? || indexTail.nil? || indexHead > indexTail
|
50
|
-
|
51
|
-
|
54
|
+
p prefix + input if DEBUG
|
55
|
+
p prefix + 'doest not contain '+head+' then '+tail if DEBUG
|
52
56
|
return recursive_parser(input, locale, bucket, index)
|
53
57
|
end
|
54
58
|
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
p prefix + input if DEBUG
|
60
|
+
p prefix + 'contains '+head+' then '+tail if DEBUG
|
61
|
+
|
62
|
+
p prefix + 'cuts the input in parts around '+ head if DEBUG
|
58
63
|
input.split(head).each do |item|
|
59
64
|
item = item.to_s
|
60
65
|
|
61
|
-
|
62
|
-
|
66
|
+
p prefix + '-----part----' if DEBUG
|
67
|
+
p prefix + item if DEBUG
|
63
68
|
|
64
69
|
if item.include?(tail)
|
65
|
-
|
70
|
+
p prefix + 'contains '+tail if DEBUG
|
66
71
|
end_items = item.split(tail)
|
67
72
|
|
68
|
-
|
73
|
+
p prefix + end_items.to_s if DEBUG
|
69
74
|
if flag
|
70
75
|
bucket << head << end_items[0] << tail
|
71
76
|
else
|
72
77
|
bucket << end_items[0]
|
73
78
|
end
|
74
79
|
|
75
|
-
|
76
|
-
|
80
|
+
p prefix + bucket.to_s if DEBUG
|
81
|
+
if(end_items.length >= 2)
|
82
|
+
item = end_items.last
|
83
|
+
index += 1
|
84
|
+
recursive_parser(item, locale, bucket, index)
|
85
|
+
end
|
86
|
+
else
|
87
|
+
recursive_parser(item, locale, bucket, index)
|
77
88
|
end
|
78
|
-
|
79
|
-
recursive_parser(item, locale, bucket, index)
|
80
89
|
end
|
81
90
|
end
|
82
91
|
|