This repository has been archived by the owner on Dec 25, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple HTML export using built-in ERB template
- Loading branch information
Nicholas E. Rabenau
committed
Mar 10, 2012
1 parent
7b96209
commit 91bafd1
Showing
8 changed files
with
190 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>pwd export</title> | ||
<style type="text/css"> | ||
table { page-break-inside:auto } | ||
tr { page-break-inside:avoid; page-break-after:auto } | ||
thead { display:table-header-group } | ||
tfoot { display:table-footer-group } | ||
</style> | ||
</head> | ||
<body> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tfoot> | ||
<tr> | ||
<td>Exported from pwm</td> | ||
<td>Last modified: <%= store.last_modified.strftime('%F') rescue 'never' %></td> | ||
<td></td> | ||
</tr> | ||
</tfoot> | ||
<tbody> | ||
<% store.all.each{|key, value|%> | ||
<tr> | ||
<td><%= key %></td> | ||
<td><%= value %></td> | ||
</tr> | ||
<% } %> | ||
</tbody> | ||
</table> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'helper' | ||
|
||
# Tests `pwm export` | ||
class TestExport < Test::Pwm::AppTestCase | ||
def test_empty | ||
fixture = fixture("test_empty.html").gsub('DATE_TIME_STAMP', 'never') | ||
# assert_successful(fixture, 'export') | ||
end | ||
|
||
def test_all | ||
test_vector = Hash['foo', 'one', 'bar', 'two', 'Chuck Norris', 'Roundhouse Kick'] | ||
test_vector.each{|k,v| | ||
assert_successful('', "put '#{k}' '#{v}'") | ||
} | ||
|
||
fixture = fixture("test_all.html").gsub('DATE_TIME_STAMP', DateTime.now.strftime('%F')) | ||
assert_successful(fixture, 'export') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>pwd export</title> | ||
<style type="text/css"> | ||
table { page-break-inside:auto } | ||
tr { page-break-inside:avoid; page-break-after:auto } | ||
thead { display:table-header-group } | ||
tfoot { display:table-footer-group } | ||
</style> | ||
</head> | ||
<body> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tfoot> | ||
<tr> | ||
<td>Exported from pwm</td> | ||
<td>Last modified: 2012-03-10</td> | ||
<td></td> | ||
</tr> | ||
</tfoot> | ||
<tbody> | ||
|
||
<tr> | ||
<td>foo</td> | ||
<td>one</td> | ||
</tr> | ||
|
||
<tr> | ||
<td>bar</td> | ||
<td>two</td> | ||
</tr> | ||
|
||
<tr> | ||
<td>Chuck Norris</td> | ||
<td>Roundhouse Kick</td> | ||
</tr> | ||
|
||
</tbody> | ||
</table> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>pwd export</title> | ||
<style type="text/css"> | ||
table { page-break-inside:auto } | ||
tr { page-break-inside:avoid; page-break-after:auto } | ||
thead { display:table-header-group } | ||
tfoot { display:table-footer-group } | ||
</style> | ||
</head> | ||
<body> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tfoot> | ||
<tr> | ||
<td>Exported from pwm</td> | ||
<td>Last modified: DATE_TIME_STAMP</td> | ||
<td></td> | ||
</tr> | ||
</tfoot> | ||
<tbody> | ||
|
||
</tbody> | ||
</table> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters