Skip to content

Commit 7b81148

Browse files
committed
Add site config file. Rename function. Add rubocop file.
1 parent 12dde47 commit 7b81148

15 files changed

+73
-47
lines changed

.rubocop.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
AllCops:
2+
TargetRubyVersion: 2.5
3+
4+
Metrics/LineLength:
5+
Exclude:
6+
- 'index.rb'

index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index.rb

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
#!/usr/bin/env ruby
22

3+
require 'yaml'
4+
35
# function to open and read in file
4-
def read_schema(schema)
5-
file = File.open(schema, 'r')
6+
def read_file(f)
7+
file = File.open(f, 'r')
68
data = file.read
79
file.close
810
data
911
end
1012

13+
# load website config file
14+
site_config = YAML.safe_load(read_file('site.yml'))
15+
1116
# function
1217
def ii(i)
1318
i.positive? ? i : ''
@@ -18,7 +23,7 @@ def generate_data
1823
tokens = []
1924
# loop over schema files
2025
Dir.glob('schema/*.xsd').map do |schema|
21-
data = read_schema(schema)
26+
data = read_file(schema)
2227
data.scan(/<xs:\w+|\w+="\w+"|\w+="xs:\w+"/).uniq do |x|
2328
tokens << x unless tokens.include? x
2429
end
@@ -32,7 +37,7 @@ def generate_data
3237
structure[i] = [x]
3338
Dir.glob('schema/*.xsd').map do |schema|
3439
filename = schema.split('/').last
35-
data = read_schema(schema)
40+
data = read_file(schema)
3641
filename = filename.split('.').first
3742
structure[i] << [filename, data.scan(x).size]
3843
end
@@ -52,7 +57,7 @@ def escape(s)
5257

5358
# common function for each chart
5459
def draw_chart(which_chart, data, chart_string, chart_values, chart_title, chart_div, width, height)
55-
%(
60+
%(
5661
function drawChart#{which_chart}() {
5762
// Create the data table.
5863
var data = new google.visualization.DataTable();
@@ -107,18 +112,18 @@ def clean_chart(chart)
107112
<meta name="viewport" content="width=device-width, initial-scale=1">
108113
<!-- The above 3 meta tags *must* come first in the head;
109114
any other head content must come *after* these tags -->
110-
<title>Analytics Dashboard</title>
115+
<title>#{site_config['title']}</title>
111116
<!-- Latest compiled and minified CSS -->
112117
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
113118
<!-- Optional theme -->
114119
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
115120
<style>
116121
.container-fluid { padding: 0px; }
117-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
122+
.navbar, .navbar-default { padding: 5pt; background-color: ##{site_config['theme_color']} !important; font-size: 12pt; }
118123
.navbar, .navbar-default li a { color: #000 !important; }
119124
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
120125
div[id^="chart_div"] > div > div { margin: auto; }
121-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
126+
footer { background-color: ##{site_config['theme_color']}; min-height: 200px; color: #fff !important; }
122127
footer ul a { color: #fff !important; }
123128
.selected { background-color: aliceblue; font-weight: bold; }
124129
.navbar-default li:hover a { background-color: red !important; }
@@ -136,7 +141,7 @@ def clean_chart(chart)
136141
<span class="icon-bar"></span>
137142
<span class="icon-bar"></span>
138143
</button>
139-
<a class="navbar-brand" href="index.html" id="head1">Analytics Dashboard</a>
144+
<a class="navbar-brand" href="index.html" id="head1">#{site_config['nav_heading']}</a>
140145
</div>
141146
<div id="navbar" class="navbar-collapse collapse">
142147
<ul class="nav navbar-nav">)
@@ -184,9 +189,9 @@ def clean_chart(chart)
184189
page_build(page_count)
185190
# restart common page region
186191
$page = %(
187-
<li><a href="#head1">Back to top</a></li>
192+
<li><a href="#head1">#{site_config['back_to_top']}</a></li>
188193
<li class="nuchecker">
189-
<a target="_blank" rel="noopener">Valid HTML</a>
194+
<a target="_blank" rel="noopener">#{site_config['valid_html']}</a>
190195
</li>
191196
</ul>
192197
<a href="http://s05.flagcounter.com/more/BHT"

index1.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index10.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index11.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index2.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index3.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index4.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index5.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index6.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index7.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

index8.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<!-- The above 3 meta tags *must* come first in the head;
88
any other head content must come *after* these tags -->
9-
<title>Analytics Dashboard</title>
9+
<title>Ruby Google charts text mining dashboard</title>
1010
<!-- Latest compiled and minified CSS -->
1111
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
1212
<!-- Optional theme -->
1313
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
1414
<style>
1515
.container-fluid { padding: 0px; }
16-
.navbar, .navbar-default { padding: 5pt; background-color: rgba(49,37,152,0.8) !important; font-size: 12pt; }
16+
.navbar, .navbar-default { padding: 5pt; background-color: #4286f4 !important; font-size: 12pt; }
1717
.navbar, .navbar-default li a { color: #000 !important; }
1818
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { color: #fff; font-size: 15pt; }
1919
div[id^="chart_div"] > div > div { margin: auto; }
20-
footer { background-color: rgba(49,37,152,0.8); min-height: 200px; color: #fff !important; }
20+
footer { background-color: #4286f4; min-height: 200px; color: #fff !important; }
2121
footer ul a { color: #fff !important; }
2222
.selected { background-color: aliceblue; font-weight: bold; }
2323
.navbar-default li:hover a { background-color: red !important; }

0 commit comments

Comments
 (0)