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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5db0496bf832cebe0959a267725e518ede3f0e83a291c418e907e9b4bafdc9c0
4
- data.tar.gz: f4e1344c4e340081ccd58f70e527145457458de6c8e88a5043fa072aee3f4116
3
+ metadata.gz: 8a02eefba53cc637d5defc6c938f15fa6843b54ed78be4ee50484717393989f6
4
+ data.tar.gz: 8badf22ea0722232973679184f4bf2c0d54b68b18625b7cb61b1d098f8a23a55
5
5
  SHA512:
6
- metadata.gz: 68be99302d787374ba40f278b1afaf35f83496071d1c26335333bd4eb285a9e2d8ee3f2969769863d6f104b8f2d07dba2cd5bbe1e8205c6ce31ad386a3d003b1
7
- data.tar.gz: 6e3ed7a9e161456f6965479ae3511b9dcca162658c37f7088287ee3bbfb82dffadd498036ba6108f502438cc3cfa9dc82dcb802d74fcf24fcb83dc238a72b165
6
+ metadata.gz: 3add7ba2dfa0504a7da93472c7534d2f7d62b26c62293bd4a39d8105acd08bc7017db5d4d35c65484ee367f89cf0be01306492fdc76b5d9df6a586fba57cbedf
7
+ data.tar.gz: afef08fea0bdc8df013ea9a1c5a8e5839ced4cb2b3addad0c240fa8059f91da67a7a0c1cd3767e09c03790a0ca008a9fd6f7acdfef11aae4c0e470d4ff93444c
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Microtypo
5
- VERSION = "1.2.2"
5
+ VERSION = "1.2.3"
6
6
  end
7
7
  end
@@ -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
- # prefix = " " + (" " * 3 * (QUEUE.size-index))
38
- # p prefix + 'Recursive_parser for ' + input unless index.zero?
39
- # p prefix + ' Fix microtypo for ' + input if index.zero?
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
- # p prefix + input
51
- # p prefix + 'doest not contain '+head+' then '+tail
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
- # p prefix + input
56
- # p prefix + 'contains '+head+' and '+tail
57
- # p prefix + 'cuts the input in parts around '+ head
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
- # p prefix + '-----part----'
62
- # p prefix + item
66
+ p prefix + '-----part----' if DEBUG
67
+ p prefix + item if DEBUG
63
68
 
64
69
  if item.include?(tail)
65
- # p prefix + 'contains '+tail
70
+ p prefix + 'contains '+tail if DEBUG
66
71
  end_items = item.split(tail)
67
72
 
68
- # p prefix + end_items.to_s
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
- # p prefix + bucket.to_s
76
- item = end_items.last
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-microtypo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Schapira