Skip to content

Commit 18fe8af

Browse files
committed
prettify tables
1 parent bee519c commit 18fe8af

File tree

3 files changed

+42
-25
lines changed

3 files changed

+42
-25
lines changed

render.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ def tags_from_cell(cell, type='ex'):
7272

7373

7474
def data_from_cell(cell):
75+
classes = "table table-sm table-striped table-responsive table-bordered"
7576
try:
7677
for c in cell['outputs']:
7778
if 'data' in c and 'text/html' in c['data']:
7879
table = ' '.join(c['data']['text/html'])
79-
table = table.replace('border="1" class="dataframe"', 'class="table table-sm table-striped table-responsive"')
80+
table = table.replace('border="1" class="dataframe"', 'class="{}"'.format(classes))
81+
table = table.replace('<thead>', '<thead class="thead-inverse">')
8082
return table
8183
except KeyError as e:
8284
logging.error("Can't find data in cell: %s", cell['source'])

web/index.html

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@
1919
<meta name="twitter:site" content="@tdhopper" />
2020
<meta name="twitter:creator" content="@tdhopper" />
2121

22+
<link rel="apple-touch-icon" sizes="57x57" href="/img/ico/apple-icon-57x57.png">
23+
<link rel="apple-touch-icon" sizes="60x60" href="/img/ico/apple-icon-60x60.png">
24+
<link rel="apple-touch-icon" sizes="72x72" href="/img/ico/apple-icon-72x72.png">
25+
<link rel="apple-touch-icon" sizes="76x76" href="/img/ico/apple-icon-76x76.png">
26+
<link rel="apple-touch-icon" sizes="114x114" href="/img/ico/apple-icon-114x114.png">
27+
<link rel="apple-touch-icon" sizes="120x120" href="/img/ico/apple-icon-120x120.png">
28+
<link rel="apple-touch-icon" sizes="144x144" href="/img/ico/apple-icon-144x144.png">
29+
<link rel="apple-touch-icon" sizes="152x152" href="/img/ico/apple-icon-152x152.png">
30+
<link rel="apple-touch-icon" sizes="180x180" href="/img/ico/apple-icon-180x180.png">
31+
<link rel="icon" type="image/png" sizes="192x192" href="/img/ico/android-icon-192x192.png">
32+
<link rel="icon" type="image/png" sizes="32x32" href="/img/ico/favicon-32x32.png">
33+
<link rel="icon" type="image/png" sizes="96x96" href="/img/ico/favicon-96x96.png">
34+
<link rel="icon" type="image/png" sizes="16x16" href="/img/ico/favicon-16x16.png">
2235
<!-- Bootstrap core CSS -->
2336
<link href="css/bootstrap.min.css" rel="stylesheet">
2437
<link href="css/bootstrap-grid.min.css" rel="stylesheet">
@@ -69,7 +82,10 @@
6982
<img class="img-fluid pb-4" src="http://pythonplot.com.s3-website-us-east-1.amazonaws.com/img/banner.png">
7083
<h1>Python Plotting for Exploratory Analysis</h1>
7184

72-
<blockquote>"The simple graph has brought more information to the data analyst's mind than any other device." — John Tukey</blockquote>
85+
<blockquote class="blockquote">
86+
<p>The simple graph has brought more information to the data analyst's mind than any other device.</p>
87+
<footer class="blockquote-footer">John Tukey in <cite title="Source Title"><a href="https://books.google.com/books?id=JuQD42kUxzIC&pg=PA457&lpg=PA457#v=onepage&q&f=false" target='_new'>The Future of Data Analysis</a></cite></footer>
88+
</blockquote>
7389

7490
<h3>Contents</h3>
7591
<ul id="outline">
@@ -156,12 +172,11 @@ <h4>Data</h4>
156172
</div>
157173

158174
<div class="row"><div class="col-xs-12 col-lg-8 offset-lg-2">
159-
<div class="card"><div class="card-block">
160-
161-
<h5>ts</h5>
175+
176+
<h5>ts</h5>
162177

163-
<table class="table table-sm table-striped table-responsive">
164-
<thead>
178+
<table class="table table-sm table-striped table-responsive table-bordered">
179+
<thead class="thead-inverse">
165180
<tr style="text-align: right;">
166181
<th>date</th>
167182
<th>value</th>
@@ -190,11 +205,11 @@ <h5>ts</h5>
190205
</tr>
191206
</tbody>
192207
</table>
193-
194-
<h5>mpg</h5>
208+
209+
<h5>mpg</h5>
195210

196-
<table class="table table-sm table-striped table-responsive">
197-
<thead>
211+
<table class="table table-sm table-striped table-responsive table-bordered">
212+
<thead class="thead-inverse">
198213
<tr style="text-align: right;">
199214
<th>manufacturer</th>
200215
<th>model</th>
@@ -277,11 +292,11 @@ <h5>mpg</h5>
277292
</tr>
278293
</tbody>
279294
</table>
280-
281-
<h5>diamonds</h5>
295+
296+
<h5>diamonds</h5>
282297

283-
<table class="table table-sm table-striped table-responsive">
284-
<thead>
298+
<table class="table table-sm table-striped table-responsive table-bordered">
299+
<thead class="thead-inverse">
285300
<tr style="text-align: right;">
286301
<th>carat</th>
287302
<th>cut</th>
@@ -358,8 +373,7 @@ <h5>diamonds</h5>
358373
</tr>
359374
</tbody>
360375
</table>
361-
362-
</div></div>
376+
363377
</div></div>
364378

365379
<hr>
@@ -1808,7 +1822,7 @@ <h6 class="text-muted mb-0 pb-0 pt-3 px-3">Code:</h6>
18081822
<div class="row">
18091823
<div class="col-3">© 2017 <a href="http://tdhopper.com">Tim Hopper</a></div>
18101824
<div class="col-7">© 2017 <a href="https://github.com/tdhopper/pythonplot.com/blob/master/Examples.ipynb">
1811-
Generated from an IPython Notebook on Github</a> (<a href="https://github.com/tdhopper/pythonplot.com/commit/fec7469">fec7469</a>) <a href="https://travis-ci.org/tdhopper/pythonplot.com" target="_blank"><img src="https://travis-ci.org/tdhopper/pythonplot.com.svg?branch=master"></a></div>
1825+
Generated from an IPython Notebook on Github</a> (<a href="https://github.com/tdhopper/pythonplot.com/commit/bee519c">bee519c</a>) <a href="https://travis-ci.org/tdhopper/pythonplot.com" target="_blank"><img src="https://travis-ci.org/tdhopper/pythonplot.com.svg?branch=master"></a></div>
18121826

18131827
<div class="col-2"><p class="float-right"><i class="fa fa-arrow-up"></i> <a href="#">Back to top</a></p></div>
18141828
</div>

web/t_index.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@
8282
<img class="img-fluid pb-4" src="http://pythonplot.com.s3-website-us-east-1.amazonaws.com/img/banner.png">
8383
<h1>Python Plotting for Exploratory Analysis</h1>
8484

85-
<blockquote>"The simple graph has brought more information to the data analyst's mind than any other device." — John Tukey</blockquote>
85+
<blockquote class="blockquote">
86+
<p>The simple graph has brought more information to the data analyst's mind than any other device.</p>
87+
<footer class="blockquote-footer">John Tukey in <cite title="Source Title"><a href="https://books.google.com/books?id=JuQD42kUxzIC&pg=PA457&lpg=PA457#v=onepage&q&f=false" target='_new'>The Future of Data Analysis</a></cite></footer>
88+
</blockquote>
8689

8790
<h3>Contents</h3>
8891
<ul id="outline">
@@ -98,13 +101,11 @@ <h3>Contents</h3>
98101
</div>
99102

100103
<div class="row"><div class="col-xs-12 col-lg-8 offset-lg-2">
101-
<div class="card"><div class="card-block">
102-
{% for name, table in data.items() %}
103-
<h5>{{ name }}</h5>
104+
{% for name, table in data.items() %}
105+
<h5>{{ name }}</h5>
104106

105-
{{ table }}
106-
{% endfor %}
107-
</div></div>
107+
{{ table }}
108+
{% endfor %}
108109
</div></div>
109110

110111
<hr>

0 commit comments

Comments
 (0)