repolho 0.1.4 → 0.1.5
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
- checksums.yaml.gz.sig +0 -0
- data/README.md +1 -1
- data/lib/repolho/main.rb +32 -0
- data/lib/repolho/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +1 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 60d2951254acb9e8431cbda5c6710c74959759ddbeadff1b2d2f1e60fe4d9da6
|
|
4
|
+
data.tar.gz: 8b98f398503e47af413bfc9d4d5dc5a32c287946920b9be75cfd8db7f8f1cef2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5b1f71c5f938aac694b6788d025e6965acea778c06f83c99f0159b093c562a2c10977f3987236b39f8c93918d780fe5500f04e34d5b88da484eccda7f931fe5
|
|
7
|
+
data.tar.gz: 76d0fabef7c98d14940ae9e9c0cbd1e9a5d5cbe396cc12412ed12d5748a2944c81b2c52db26df8801f653ab3ae7e761bb48f0596a85a0befa721dced04b0f17e
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.md
CHANGED
|
@@ -58,7 +58,7 @@ sections). Everything inside the custom elements is processed as ERB.
|
|
|
58
58
|
|
|
59
59
|
| Element | Purpose | Attributes |
|
|
60
60
|
|---------|---------|------------|
|
|
61
|
-
| `<report>` | Root container of the report | `pagination` (optional, `"true"`): enables client-side page navigation. Also accepts `pagination-first`, `pagination-prev`, `pagination-next`, `pagination-last` for custom labels. |
|
|
61
|
+
| `<report>` | Root container of the report | `pagination` (optional, `"true"`): enables client-side page navigation. Also accepts `pagination-first`, `pagination-prev`, `pagination-next`, `pagination-last` for custom labels.<br>`orientation` (optional, `"portrait"` or `"landscape"`): page orientation for print.<br>`paper` (optional, e.g. `"A4"`, `"Letter"`): paper size for print. If either is present, a `@media print` style is injected at the end of `<body>`. |
|
|
62
62
|
| `<report-page>` | Defines a page (required, only one) | `rows` (required): max data rows per page |
|
|
63
63
|
| `<report-group>` | Nested grouping | `id` (required), `attr` (required), `reprint-header-on-page-break` (optional, `"true"`) |
|
|
64
64
|
| `<report-header>` | Header of the current container | — |
|
data/lib/repolho/main.rb
CHANGED
|
@@ -77,6 +77,8 @@ module Repolho
|
|
|
77
77
|
@after = ""
|
|
78
78
|
@body = ""
|
|
79
79
|
@pagination = false
|
|
80
|
+
@orientation = nil
|
|
81
|
+
@paper = nil
|
|
80
82
|
@pagination_labels = {
|
|
81
83
|
first: "First",
|
|
82
84
|
prev: "<",
|
|
@@ -124,6 +126,15 @@ module Repolho
|
|
|
124
126
|
end
|
|
125
127
|
end
|
|
126
128
|
|
|
129
|
+
css = print_css
|
|
130
|
+
if css
|
|
131
|
+
if after_content =~ /<\/body>/i
|
|
132
|
+
after_content = after_content.sub(/<\/body>/i, "#{css}</body>")
|
|
133
|
+
else
|
|
134
|
+
after_content += css
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
127
138
|
@page.append_raw(after_content)
|
|
128
139
|
end
|
|
129
140
|
|
|
@@ -136,6 +147,25 @@ module Repolho
|
|
|
136
147
|
@page.instance_variable_set(:@pagination_last, @pagination_labels[:last])
|
|
137
148
|
end
|
|
138
149
|
|
|
150
|
+
def print_css
|
|
151
|
+
return nil unless @orientation || @paper
|
|
152
|
+
|
|
153
|
+
size_parts = []
|
|
154
|
+
size_parts << @paper if @paper
|
|
155
|
+
size_parts << @orientation if @orientation
|
|
156
|
+
size = size_parts.join(" ")
|
|
157
|
+
|
|
158
|
+
<<~HTML
|
|
159
|
+
<style>
|
|
160
|
+
@media print {
|
|
161
|
+
@page {
|
|
162
|
+
size: #{size};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
</style>
|
|
166
|
+
HTML
|
|
167
|
+
end
|
|
168
|
+
|
|
139
169
|
def make_columns
|
|
140
170
|
return [] if @data.empty?
|
|
141
171
|
|
|
@@ -199,6 +229,8 @@ module Repolho
|
|
|
199
229
|
|
|
200
230
|
report_node = report.first
|
|
201
231
|
@pagination = report_node["pagination"] == "true"
|
|
232
|
+
@orientation = report_node["orientation"]&.downcase
|
|
233
|
+
@paper = report_node["paper"]
|
|
202
234
|
|
|
203
235
|
if @pagination
|
|
204
236
|
@pagination_labels[:first] = report_node["pagination-first"] if report_node["pagination-first"]
|
data/lib/repolho/version.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
f����i��Ĕ�6;h�K���1Y'����
|
|
3
|
-
��8s<NB|��
|
|
4
|
-
�X�0��q|���c�.0P8����
|
|
5
|
-
�/
|
|
1
|
+
�i��tٗ.U�ג���Έ+{��Ws�����N���pX��U�s\̴ڈa�@s|.����%���LT$|�\��J�[+3�\A����MV��(�����y��۫�uv����-�2��(�:��KdKRZf��hʹ���8[�ό���'����q6��� �Wt#'!5���E��,I.Zo_7����vO�A��B�h��e���u�.ȟ��*%�zɳ��O I�#^��Ӥ(~Fӗ�.�:[F�L���:�`��Ld�!θ���y��\hø�(�[}G�?���p��eST�2��?���E�t�T�^�2v?����������G`M ������/�}Ce�a��fz���<>]��_�����{���je�����/AH�7*
|