maruku-ext-ltsv_table 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module MaRuKu
2
2
  module Ext
3
3
  module LtsvTable
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ module MaRuKu
11
11
  labels = []
12
12
  while src.cur_line =~ Regexp
13
13
  lines.push(line = src.shift_line)
14
- line.split("\t").map {|lv| lv.split(":")}.each {|l, v|
14
+ line.gsub(/\t+/, "\t").split("\t").map {|lv| lv.split(":")}.each {|l, v|
15
15
  labels.push(l) unless labels.include?(l)
16
16
  }
17
17
  end
@@ -20,7 +20,7 @@ module MaRuKu
20
20
  lines.map {|line|
21
21
  hash = {}
22
22
  labels.each {|l| hash[l] = doc.md_el(el_sym, doc.parse_span_better('')) }
23
- line.split("\t").map {|lv| lv.split(":")}.each {|l, v|
23
+ line.gsub(/\t+/, "\t").split("\t").map {|lv| lv.split(":")}.each {|l, v|
24
24
  hash[l] = doc.md_el(el_sym, doc.parse_span_better(v))
25
25
  }
26
26
  labels.map {|l| hash[l]}
@@ -23,4 +23,16 @@ describe "parse_ltsv" do
23
23
  expect( doc.children[0].children[3].children[0] ).to eq "td_2"
24
24
  end
25
25
 
26
+ it "should parse a text which has continuous tab" do
27
+ doc1 = Maruku.new("
28
+ 1:th_1\t\t2:th_2
29
+ 1:td_1\t\t2:td_2
30
+ ")
31
+ doc2 = Maruku.new("
32
+ 1:th_1\t\t2:th_2
33
+ 1:td_1\t\t2:td_2
34
+ ")
35
+ expect( doc1 ).to eq doc2
36
+ end
37
+
26
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maruku-ext-ltsv_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-09 00:00:00.000000000 Z
12
+ date: 2013-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: maruku
@@ -55,7 +55,6 @@ files:
55
55
  - LICENSE.txt
56
56
  - README.md
57
57
  - Rakefile
58
- - TODO.md
59
58
  - lib/maruku-ext-ltsv_table.rb
60
59
  - lib/maruku-ext-ltsv_table/version.rb
61
60
  - lib/maruku/ext/ltsv_table.rb
data/TODO.md DELETED
@@ -1,2 +0,0 @@
1
- * handle continuous tab(null value case).
2
- * spec! spec! spec!