polyrex-headings 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: 557c31bbb8767f09e6ba662efc9b23408ded60bb
4
- data.tar.gz: f3a4f1a4303426dc0e899843677a0afe4c85e317
3
+ metadata.gz: 45329a5459782efb5443545115b7d542109d37cf
4
+ data.tar.gz: '0258b757d7804bcd2dcef5067019bf5f90d0da1b'
5
5
  SHA512:
6
- metadata.gz: 05112117e37a2b3434248f472913c8df62d1d2f0e3787bce3b900ecf7e02f7dacf0961c37ecf1c5b865898a30da7f31353cae4bf48ad41bb00e3711122662324
7
- data.tar.gz: dd9f3dfb5d2beb5f62e05a1b4d01c451b883a745ce90d0164cc536ff9932b1fc7afab322618f8733faee2526f79695bb137e2dbd409b77bef25b36c4269d00b6
6
+ metadata.gz: 63bbefdc8cd3c8eebaa17b228dfb76b85a30d6654bab0c48ab55a699b4d36c07c5344ad106ab9df0a9d5e7dc46047715bd2ebea842352832e01d4b0f0c8b54e2
7
+ data.tar.gz: 8c6e208878418d049ce8193190e9db22ab9fd56a732034196b74e3b7903682f1be2c314d6878005cb05ed51f7a5fcf12b67bffde634c5815de1810e4ac541f80
checksums.yaml.gz.sig CHANGED
Binary file
@@ -14,10 +14,13 @@ class PolyrexHeadings
14
14
  # raw record between headings
15
15
 
16
16
  raw_s.gsub!(/(#+[^\n]+\n+)(?=\n#)/m,'\1 ')
17
-
18
- summary, *s = raw_s.split(/(?=(?:#|[^\n]+\n-+))/,2)
17
+ summary, *s = raw_s.split(/(?=(?:^#|[\n]+\n-+))/,2)
19
18
 
20
19
  a = if raw_s =~ /----/ then
20
+
21
+ # this was the original code which used dashes to make an underline
22
+ # of a heading. Typically the heading is now prefixed with a hash (#)
23
+ # which means this block is unlikely to be executed.
21
24
 
22
25
  s.join.lines.chunk{|x| x != "\n" }.map do |record, x|
23
26
 
@@ -32,21 +35,38 @@ class PolyrexHeadings
32
35
  else
33
36
 
34
37
  s.join.split(/^\n*#/)[1..-1].map do |x|
38
+
35
39
 
36
40
  lines = x.lines
37
41
 
38
- raw_heading = lines.shift.rstrip
42
+ raw_heading = lines.shift.rstrip
43
+
44
+ a2 = summary.gsub(/\n{2,}/,"\n").lines
45
+
46
+ if a2.last =~ /^--+/ then
47
+
48
+ a2.pop
49
+ summary = a2.join
50
+
51
+ lines = ["\n"] + RowX.new(lines.join, level: 0).to_lines(delimiter: ' # ')
52
+
53
+ end
54
+
39
55
  raw_indent = raw_heading.slice!(/#*/)
40
56
  n, heading = raw_indent.length, raw_heading.lstrip
41
57
 
42
- ([indent(n) + heading] + lines.map{|x| indent(n+1) + x}).join
58
+ ([indent(n) + heading] + lines.map{|x| indent(n+1) + x}).join
43
59
  end
44
60
 
45
61
  end
46
62
  summary.sub!(/^(<\?)(ph|polyrex-headings)/,'\1polyrex')
47
63
  @to_s = string = summary + a.join
64
+
65
+ px = Polyrex.new
66
+ px.parse(string, delimiter: ' # ')
67
+
68
+ @to_polyrex = px
48
69
 
49
- @to_polyrex = Polyrex.new.parse(string)
50
70
  end
51
71
 
52
72
  private
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-headings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  vMdoPmHODROmaBsBeXs0T155GSR9YIFca78CXJGUE108Vgao95n3mKksxyTbKm2Y
32
32
  nSBX7qKERZEaiQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-11-22 00:00:00.000000000 Z
34
+ date: 2017-01-08 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: polyrex
@@ -54,7 +54,7 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.0.1
56
56
  description:
57
- email: james@r0bertson.co.uk
57
+ email: james@jamesrobertson.eu
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.5.1
83
+ rubygems_version: 2.6.8
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: polyrex-headings
metadata.gz.sig CHANGED
Binary file