factbook 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,8 +13,9 @@ class TestJson < MiniTest::Test
13
13
 
14
14
  def test_json
15
15
  Dir.mkdir( 'tmp' ) unless Dir.exists?( 'tmp' )
16
-
16
+
17
17
  codes = [ 'au',
18
+ 'ag',
18
19
  'be',
19
20
  #'br',
20
21
  #'mx',
@@ -25,13 +26,13 @@ class TestJson < MiniTest::Test
25
26
  ]
26
27
 
27
28
  codes.each do |code|
28
-
29
- html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
30
- page = Factbook::Page.new( code, html: html )
31
-
29
+
30
+ html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
31
+ page = Factbook::Page.new( code, html: html )
32
+
32
33
  h = page.data
33
34
  pp h
34
-
35
+
35
36
  ### save to json
36
37
  puts "saving a copy to #{code}.json for debugging"
37
38
  File.open( "tmp/#{code}.json", 'w' ) do |f|
@@ -12,7 +12,10 @@ class TestSanitizer < MiniTest::Test
12
12
 
13
13
  def test_sanitize
14
14
 
15
- ['au','be'].each do |cnty|
15
+ ## austria (au)
16
+ ## algeria (ag)
17
+ ## belgium (be)
18
+ ['au','ag','be'].each do |cnty|
16
19
 
17
20
  ## use/fix: ASCII-8BIT (e.g.keep as is) -???
18
21
  html_ascii = File.read( "#{Factbook.root}/test/data/src/#{cnty}.html" ) ## fix/todo: use ASCII8BIT/binary reader ??
@@ -59,6 +59,31 @@ HTML
59
59
  pp m
60
60
 
61
61
  assert m.nil? == false
62
- end
62
+ end # method test_pop_pyramid
63
+
64
+
65
+ def test_rel_affiliation
66
+
67
+ html =<<HTML
68
+ <div class='disTable relAffiliation'><span class='category tCell' style='margin-bottom:0px; vertical-align:bottom;'>religious affiliation:</span>
69
+ <span class="tCell"><a data-toggle="modal" href="#relAffiliationModal"><img title="" src="../graphics/middle-east-religion-icon.jpg" style="cursor:pointer; border: 0px solid #CCC;"></span></a></div>
70
+
71
+ <div class="modal fade" id="relAffiliationModal" role="dialog">
72
+ <div class="wfb-modal-dialog">
73
+ <div class="modal-content" >
74
+ <div class="wfb-modal-header" style="border-radius: 4px; font-family: Verdana,Arial,sans-serif; font-size: 14px !important; font-weight: bold; padding: 0.4em 16px 0.4em 1em; background: #cccccc url("..images/ui-bg_highlight-soft_75_cccccc_1x100.png") repeat-x scroll 50% 50%;" >
75
+ <span style="font-size: 14px !important; margin: 0.1em 16px 0.1em 0;" class="modal-title wfb-title">The World Factbook</span><span style="float: right; margin-top: -4px;">
76
+ <button type="button" class="close" title="close" data-dismiss="modal">&times;</button></span>
77
+ </div>
78
+ <div class="wfb-modal-body">
79
+ ...
80
+ <div id='field'
81
+ HTML
82
+
83
+ m = Factbook::Sanitizer::REL_AFFILIATION_CATEGORY_REGEX.match( html )
84
+ pp m
85
+
86
+ assert m.nil? == false
87
+ end # method test_rel_affiliation
63
88
 
64
89
  end # class TestSanitizerRegex
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-05 00:00:00.000000000 Z
11
+ date: 2016-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logutils
@@ -148,6 +148,7 @@ files:
148
148
  - test/data/be.html
149
149
  - test/data/be.yml
150
150
  - test/data/json/au.json
151
+ - test/data/src/ag.html
151
152
  - test/data/src/au-2015-09-24.html
152
153
  - test/data/src/au.html
153
154
  - test/data/src/be-2015-09-24.html
@@ -169,7 +170,7 @@ files:
169
170
  - test/test_page.rb
170
171
  - test/test_sanitizer.rb
171
172
  - test/test_sanitizer_regex.rb
172
- homepage: https://github.com/worlddb/factbook
173
+ homepage: https://github.com/factbook/factbook
173
174
  licenses:
174
175
  - Public Domain
175
176
  metadata: {}