hilighter 1.5.2 → 1.5.9

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/hilighter/methods.rb +6 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12de20d926f333f17c63422220db0c8c5baf18e7870127de78e8ad55cf4598d6
4
- data.tar.gz: 23057327a183158182505494e5943733c8da2ab55995af832d363c315dd61b1f
3
+ metadata.gz: 38a7e41d03cc21a6083c092f0e067b0ce7fb70e179a94a4d680bff20f07c3833
4
+ data.tar.gz: 8e817d830d790589ca99fe8e11caf3c0cec1a6eda9439c52f52692d321de4818
5
5
  SHA512:
6
- metadata.gz: fd5a67726beb497ed99e5357275fe6cabb23ca575152172010fab86873faa40039db76050dad00bcafa987df923dbca75ff12024adfd0ddb4e0f6aa1bf74cf0b
7
- data.tar.gz: e139afef30ae8387e7e9dde274a48b907f41d62df8c091a1c2f9eed8eb34c4e3f870c9ce4bcf4a20e23f0f33ff9084dcd8cb705878f90dbcb5829d41baff95ff
6
+ metadata.gz: a828064e051c5f144a3af6b7a48bf321ef6bd2b866f879e4d4fafe9e815eac62893746ae5277d60a42b6a49eda2f4a72976151fab9bd0f44fc02d41febe3f989
7
+ data.tar.gz: 61ac2c722528eef80206714b29f1c6f57c2f1ca7790354a2228f1c18647e6cbbecd1f52924d2c6bb582988560494974a9942c31e60a628888e3bf75f239fe459
@@ -87,17 +87,18 @@ class Hilighter
87
87
  line = ""
88
88
  lines = Array.new
89
89
  self.split(/\s+/).each do |word|
90
- if ((line.plain.size + word.plain.size) > width)
91
- lines.push("#{line}\n")
90
+ if (line.empty?)
92
91
  line = word
93
- elsif (line.empty?)
92
+ elsif ((line.plain.size + word.plain.size) + 1 > width)
93
+ lines.push(line)
94
94
  line = word
95
95
  else
96
96
  line += " #{word}"
97
97
  end
98
98
  end
99
- lines.push("#{line}\n") if (!line.empty?)
100
- return lines.join
99
+ lines.push(line) if (!line.empty?)
100
+ lines.push("") if (self.end_with?("\n"))
101
+ return lines.join("\n")
101
102
  end
102
103
  end
103
104
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hilighter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-26 00:00:00.000000000 Z
11
+ date: 2019-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake