table_analysis 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e813762b1cda137c54008ae20922d1612c401e6aa01e887faab65424912fa52
4
- data.tar.gz: 07ab0268902f1a12c2d4a84c9ad6352ac21bd0224c1f6e3dab0941c11546802f
3
+ metadata.gz: f270cedae12f7dc99ce053cf429857570df56149e7981200dc3eaf5b13c210f5
4
+ data.tar.gz: 3dc830dd2cac5e1f6e2bee1c1fcf20c491126556ac4aacdc1004c35607b4e49a
5
5
  SHA512:
6
- metadata.gz: '0871f376420e70f4648cae17ccb79bf4c5a9e2d6c204eaa1d7083e575e8e6849249a91eb673d28656eeacde0d266ffc5aedcd663058a33af3948ca25f5e706d3'
7
- data.tar.gz: 362c06533d49d828c1e4b77d9160780d0a86fcca25484ed6f8faaf85e1f5639cc91de540d02c4c8bec0f770783f623cc08d68517d57c190db188bf3d72332556
6
+ metadata.gz: 70f6d793a3bce2727a12d2d9621d23c0933a2635503964b027becd4ad192c26ff16874f43782387d7a4a6c544094e8ee567724461ad6bb0d4e94a0ba6b261711
7
+ data.tar.gz: 6ea75f94f16dcfba61525c69468853743d2c6a1d5d4db1491dea1d55af04bb1a12c3e47f3a8d441f8566f825850827765c9b2311935afb96b67be5d56c7938c0
data/demo.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require './lib/table_analysis.rb'
2
2
 
3
- doc = File.read('file/demo2.html')
3
+ doc = File.read('file/demo1.html')
4
4
 
5
- TableAnalysis::Main.generator(doc, 2, 1)
5
+ TableAnalysis::Main.generator(doc, 3, 1)
data/file/demo1.html ADDED
@@ -0,0 +1,106 @@
1
+ <div>
2
+ <table style="table-layout: fixed; width: 648px" cellpadding="0" cellspacing="0">
3
+ <colgroup>
4
+ <col style="width: 324px" />
5
+ <col style="width: 324px" />
6
+ </colgroup>
7
+ <thead>
8
+ <tr>
9
+ <td style="width: 323px; border-left: 1px solid transparent; border-right: 1px solid transparent" />
10
+ <td style="border-left: 1px solid transparent; border-right: 1px solid transparent" />
11
+ </tr>
12
+ <tr style="min-height: 27px">
13
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; border-bottom: 1px solid #000000; vertical-align: middle">
14
+ <p style="line-height: 13.3299999237061px; text-align: center">区分</p>
15
+ </td>
16
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; border-bottom: 1px solid #000000; vertical-align: middle">
17
+ <p style="line-height: 13.3299999237061px; text-align: center">金額(千円)</p>
18
+ </td>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <tr style="min-height: 27px">
23
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; border-bottom: 1px solid #000000; vertical-align: middle">
24
+ <p style="margin-left: 12px; margin-right: 12px;text-align: left">現金</p>
25
+ </td>
26
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; border-bottom: 1px solid #000000; vertical-align: middle">
27
+ <p style="margin-right: 72px; text-align: right">5,950</p>
28
+ </td>
29
+ </tr>
30
+ <tr style="min-height: 27px">
31
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; vertical-align: middle">
32
+ <p style="margin-left: 12px; margin-right: 12px;text-align: left">預金</p>
33
+ </td>
34
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; vertical-align: middle">
35
+ <p style="margin-right: 72px; text-align: right"> </p>
36
+ </td>
37
+ </tr>
38
+ <tr style="min-height: 27px">
39
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
40
+ <p style="margin-left: 24px; margin-right: 12px;text-align: left">当座預金</p>
41
+ </td>
42
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
43
+ <p style="margin-right: 72px; text-align: right">1,570,916</p>
44
+ </td>
45
+ </tr>
46
+ <tr style="min-height: 27px">
47
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
48
+ <p style="margin-left: 24px; margin-right: 12px;text-align: left">通知預金</p>
49
+ </td>
50
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
51
+ <p style="margin-right: 72px; text-align: right">-</p>
52
+ </td>
53
+ </tr>
54
+ <tr style="min-height: 27px">
55
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
56
+ <p style="margin-left: 24px; margin-right: 12px;text-align: left">定期預金</p>
57
+ </td>
58
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
59
+ <p style="margin-right: 72px; text-align: right">990,000</p>
60
+ </td>
61
+ </tr>
62
+ <tr style="min-height: 27px">
63
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
64
+ <p style="margin-left: 24px; margin-right: 12px;text-align: left">別段預金</p>
65
+ </td>
66
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
67
+ <p style="margin-right: 72px; text-align: right">2,645</p>
68
+ </td>
69
+ </tr>
70
+ <tr style="min-height: 27px">
71
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
72
+ <p style="margin-left: 24px; margin-right: 12px;text-align: left">振替貯金</p>
73
+ </td>
74
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; vertical-align: middle">
75
+ <p style="margin-right: 72px; text-align: right">29,750</p>
76
+ </td>
77
+ </tr>
78
+ <tr style="min-height: 27px">
79
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000; vertical-align: middle">
80
+ <p style="margin-left: 24px; margin-right: 12px;text-align: left">普通預金</p>
81
+ </td>
82
+ <td style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000; vertical-align: middle">
83
+ <p style="margin-right: 72px; text-align: right">20,034</p>
84
+ </td>
85
+ </tr>
86
+ <tr style="min-height: 27px">
87
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; border-bottom: 1px solid #000000; vertical-align: middle">
88
+ <p style="text-align: center">小計</p>
89
+ </td>
90
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; border-bottom: 1px solid #000000; vertical-align: middle">
91
+ <p style="margin-right: 72px; text-align: right">
92
+ <span style="font-weight: normal">2,613,346</span>
93
+ </p>
94
+ </td>
95
+ </tr>
96
+ <tr style="min-height: 27px">
97
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; border-bottom: 1px solid #000000; vertical-align: middle">
98
+ <p style="text-align: center">計</p>
99
+ </td>
100
+ <td style="border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid#000000; border-bottom: 1px solid #000000; vertical-align: middle">
101
+ <p style="margin-right: 72px; text-align: right">2,619,296</p>
102
+ </td>
103
+ </tr>
104
+ </tbody>
105
+ </table>
106
+ </div>
@@ -1,3 +1,3 @@
1
1
  module TableAnalysis
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
@@ -12,7 +12,7 @@ module TableAnalysis
12
12
  header_content_tds = []
13
13
  body_content_tds = []
14
14
  body_tr_size = 0
15
- table.xpath('./tr').each_with_index do |tr, tr_index|
15
+ table.xpath('.//tr').each_with_index do |tr, tr_index|
16
16
  if tr_index == selected_row.to_i - 1
17
17
  tr.xpath('./td').each do |td|
18
18
  header_name = td.content
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_analysis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mico_xiaozhen@sina.com
@@ -85,6 +85,7 @@ files:
85
85
  - bin/console
86
86
  - bin/setup
87
87
  - demo.rb
88
+ - file/demo1.html
88
89
  - file/demo2.html
89
90
  - lib/table_analysis.rb
90
91
  - lib/table_analysis/body.rb