Spreadsheet-HTML 0.0.2 → 0.0.3
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 +4 -4
- data/Changes +3 -0
- data/Spreadsheet-HTML.gemspec +1 -1
- data/doc/HTML.rdoc +137 -0
- data/lib/Spreadsheet/HTML/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 612af177715bcdf3a5a7f501b589e6e024510584
|
4
|
+
data.tar.gz: 70722e9638560cbe20a7009ec90cc71d5739dc29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c18b62c5538242233732ec5ef6220c08a05fd39f7cbc4e3d3492b6fab0de584cd04195b49aff3aeea0adda670b0c5b2e5be2b7025168738b3b4d1d1a2ad7beba
|
7
|
+
data.tar.gz: f4ae6f8eb48f98b519cc75317849df37e09cecf8e4cbe18bee880c98532cf452e429f0e81de9cf89f56e9b5ed0a41cf430eca775e78564384fe1da2ab12ee634
|
data/Changes
CHANGED
data/Spreadsheet-HTML.gemspec
CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency 'rake'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
23
|
spec.add_runtime_dependency 'HTML-AutoTag', '~> 1.0', '>= 1.0.1'
|
24
24
|
end
|
data/doc/HTML.rdoc
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
== Description
|
2
|
+
Just another HTML table generator for ruby.
|
3
|
+
Generate HTML tables with ease (HTML4, XHTML and HTML5).
|
4
|
+
Generate portrait, landscape and other rotated views. Handles
|
5
|
+
rotating table attributes via HTML-AutoTag.
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
gem install Spreadsheet-HTML
|
10
|
+
|
11
|
+
== Synopsis
|
12
|
+
require 'Spreadsheet/HTML'
|
13
|
+
|
14
|
+
data = Array[ [1,2,3], [4,5,6] ]
|
15
|
+
generator = Spreadsheet::HTML.new()
|
16
|
+
puts generator.generate( data )
|
17
|
+
puts generator.generate( 'data' => data )
|
18
|
+
|
19
|
+
generator = Spreadsheet::HTML.new( 'data' => data )
|
20
|
+
puts generator.portrait( 'indent' => "\t" )
|
21
|
+
puts generator.landscape( 'encodes' => 1 )
|
22
|
+
|
23
|
+
puts generator.generate( 'tgroups' => 1 )
|
24
|
+
puts generator.generate( 'tgroups' => 2 )
|
25
|
+
|
26
|
+
puts generator.generate( 'tr' => { 'class' => %w{ odd even } } )
|
27
|
+
|
28
|
+
# See t/ directory for more examples
|
29
|
+
|
30
|
+
== Methods
|
31
|
+
With the exception of new, all methods return an HTML table as a string.
|
32
|
+
|
33
|
+
new( params )
|
34
|
+
Constructs a new generator configured with given params. These params will be used
|
35
|
+
for each call to a generator method. Any params specified in the constructor
|
36
|
+
may be overriden in a subsequent call to a generator method (which are listed next).
|
37
|
+
|
38
|
+
generate( params )
|
39
|
+
portrait( params )
|
40
|
+
north( params )
|
41
|
+
These three methods all generate an HTML table with headings positioned at the top.
|
42
|
+
|
43
|
+
landscape( params )
|
44
|
+
west( params )
|
45
|
+
These two methods generate an HTML table with headings positioned at the left.
|
46
|
+
|
47
|
+
south( params )
|
48
|
+
This method generates an HTML table with headings positioned at the bottom.
|
49
|
+
|
50
|
+
east( params )
|
51
|
+
This method generates an HTML table with headings positioned at the right.
|
52
|
+
|
53
|
+
== Literal Parameters
|
54
|
+
Literal Parameters provides the means to modify the macro aspects of the table,
|
55
|
+
such as indentation, encoding, data source and table orientation.
|
56
|
+
|
57
|
+
data
|
58
|
+
The data to be rendered as an HTML table. Array of Arrays.
|
59
|
+
|
60
|
+
tgroups
|
61
|
+
Integer (0, 1 or 2). Group table rows into <thead>, <tbody> and <tfoot> sections.
|
62
|
+
When tgroups is set to 1, the <tfoot> section is omitted. The last row of the data
|
63
|
+
is found at the end of the <tbody> section instead. (loose) When tgroups is set to 2,
|
64
|
+
the <tfoot> section is found in between the <thead> and <tbody> sections. (strict)
|
65
|
+
|
66
|
+
indent
|
67
|
+
The string to indent each row by. Defaults to undefined which produces no indentation.
|
68
|
+
Automatically adds newlines when set to any defined value.
|
69
|
+
|
70
|
+
level
|
71
|
+
Positive integer. The level to start indentation at. This is useful for matching the nesting styles of
|
72
|
+
original HTML text that you may wish in insert into. (A value of 4 says "apply the repitition operator
|
73
|
+
to the value of indent 4 times.)
|
74
|
+
|
75
|
+
empty
|
76
|
+
String. Render any empty cells with this value. Defaults to &nbps;
|
77
|
+
|
78
|
+
matrix
|
79
|
+
Boolean. Render the headings row with only <td> tags, no <th> tags.
|
80
|
+
|
81
|
+
headless
|
82
|
+
Boolean. Render the table without the headings row at all.
|
83
|
+
|
84
|
+
theta
|
85
|
+
Rotates table clockwise for positive values and counter-clockwise for negative values.
|
86
|
+
Default is 0: headings at top. 90 yields headings at right, 180 yields headings at bottom.
|
87
|
+
270 yields headings at left. To achieve landscape, use -270.
|
88
|
+
|
89
|
+
flip
|
90
|
+
Flips the table horizontally from the perspective of the headings "row" by
|
91
|
+
negating the value of theta.
|
92
|
+
|
93
|
+
== Dynamic Parameters
|
94
|
+
There currently are no Dynamic Parameters, but they will be implemented soon enough.
|
95
|
+
They will allow the client to modify headings by name and row/columns by their indices.
|
96
|
+
|
97
|
+
== Tag Parameters
|
98
|
+
Tag Parameters provide a means to control the attributes of the table's tags, and in
|
99
|
+
the case of <th> and <td> the contents via callback subroutines (TODO!). Although
|
100
|
+
similar in form, they are differentiated from litertal parameters because they share
|
101
|
+
the names of the actual HTML table tags.
|
102
|
+
|
103
|
+
table
|
104
|
+
thead
|
105
|
+
tfoot
|
106
|
+
tbody
|
107
|
+
tr
|
108
|
+
Hash. Apply these attributes to the specified tag.
|
109
|
+
|
110
|
+
th
|
111
|
+
td
|
112
|
+
<th> and <td> will be the only Tag Parameters that accept callback methods, but this is still TODO.
|
113
|
+
In the meantime they behave the same as other Tag Parameters.
|
114
|
+
|
115
|
+
thead.tr
|
116
|
+
When tgroups is 1 or 2, this tag parameter is available to control the attributes of
|
117
|
+
the <tr> tag within the <thead> group.
|
118
|
+
|
119
|
+
tfoot.tr
|
120
|
+
When tgroups is 2, this tag parameter is available to control the attributes of
|
121
|
+
the <tr> tag within the <tfoot> group.
|
122
|
+
|
123
|
+
== License
|
124
|
+
MIT
|
125
|
+
|
126
|
+
== Copyright
|
127
|
+
(C) 2015 Jeff Anderson
|
128
|
+
All Rights Reserved
|
129
|
+
|
130
|
+
== Warranty
|
131
|
+
This package is provided "as is" and without any express or
|
132
|
+
implied warranties, including, without limitation, the implied
|
133
|
+
warranties of merchantability and fitness for a particular purpose.
|
134
|
+
|
135
|
+
== Author
|
136
|
+
Jeff Anderson
|
137
|
+
jeffa@cpan.org
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Spreadsheet-HTML
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jeffa
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- License.md
|
73
73
|
- Rakefile
|
74
74
|
- Spreadsheet-HTML.gemspec
|
75
|
+
- doc/HTML.rdoc
|
75
76
|
- lib/Spreadsheet/HTML.rb
|
76
77
|
- lib/Spreadsheet/HTML/version.rb
|
77
78
|
- readme.md
|