teepee 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/teepee/command-parser.rb +105 -1
- data/lib/teepee/commander.rb +96 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73ea8501f5483c1d6d076cda89359512734c380d
|
4
|
+
data.tar.gz: a7c354cba7562a7195a53a07d787a5e5842659a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7106f91a0bc17646ed1edd8548dbffaa77f51608203046856625abac731c09c64da694f5d2dfc1ca6b6776ccb25a8ddb83466d861452da798ba0436e47785132
|
7
|
+
data.tar.gz: 2391aa26ec4ba061cee4187650ac6489f4db34401b02e527506ea0966deeed723a22c527587077c59660576be101aa023804a97323619fa63dd15fcb67c5e68e
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# -*- mode: Ruby -*-
|
3
3
|
|
4
|
-
# Copyright © 2013-
|
4
|
+
# Copyright © 2013-2016, Christopher Mark Gore,
|
5
5
|
# Soli Deo Gloria,
|
6
6
|
# All rights reserved.
|
7
7
|
#
|
@@ -118,6 +118,110 @@ module Teepee
|
|
118
118
|
when "superscript",
|
119
119
|
"sup"
|
120
120
|
@@commander.sup expressions
|
121
|
+
when "h1"
|
122
|
+
@@commander.h1 expressions
|
123
|
+
when "h2"
|
124
|
+
@@commander.h2 expressions
|
125
|
+
when "h3"
|
126
|
+
@@commander.h3 expressions
|
127
|
+
when "h4"
|
128
|
+
@@commander.h4 expressions
|
129
|
+
when "h5"
|
130
|
+
@@commander.h5 expressions
|
131
|
+
when "h6"
|
132
|
+
@@commander.h6 expressions
|
133
|
+
when "itemize",
|
134
|
+
"ul"
|
135
|
+
@@commander.itemize expressions
|
136
|
+
when "itemize-disc",
|
137
|
+
"ul-disc",
|
138
|
+
"itemize_disc",
|
139
|
+
"ul_disc",
|
140
|
+
"itemize-disk",
|
141
|
+
"ul-disk",
|
142
|
+
"itemize_disk",
|
143
|
+
"ul_disk"
|
144
|
+
@@commander.itemize_disc expressions
|
145
|
+
when "itemize-circle",
|
146
|
+
"ul-circle",
|
147
|
+
"itemize_circle",
|
148
|
+
"ul_circle"
|
149
|
+
@@commander.itemize_circle expressions
|
150
|
+
when "itemize-square",
|
151
|
+
"ul-square",
|
152
|
+
"itemize_square",
|
153
|
+
"ul_square"
|
154
|
+
@@commander.itemize_square expressions
|
155
|
+
when "itemize-none",
|
156
|
+
"ul-none",
|
157
|
+
"itemize_none",
|
158
|
+
"ul_none"
|
159
|
+
@@commander.itemize_none expressions
|
160
|
+
when "enumerate",
|
161
|
+
"ol"
|
162
|
+
@@commander.enumerate expressions
|
163
|
+
when "enumerate-numeric",
|
164
|
+
"enumerate_numeric",
|
165
|
+
"enumerate-1",
|
166
|
+
"ol-1",
|
167
|
+
"enumerate_1",
|
168
|
+
"ol_1"
|
169
|
+
@@commander.enumerate_numeric expressions
|
170
|
+
when "enumerate-uppercase",
|
171
|
+
"enumerate_uppercase",
|
172
|
+
"enumerate-upcase",
|
173
|
+
"enumerate_upcase",
|
174
|
+
"enumerate-A",
|
175
|
+
"ol-A",
|
176
|
+
"enumerate_A",
|
177
|
+
"ol_A"
|
178
|
+
@@commander.enumerate_uppercase expressions
|
179
|
+
when "enumerate-lowercase",
|
180
|
+
"enumerate_lowercase",
|
181
|
+
"enumerate-downcase",
|
182
|
+
"enumerate_downcase",
|
183
|
+
"enumerate-a",
|
184
|
+
"ol-a",
|
185
|
+
"enumerate_a",
|
186
|
+
"ol_a"
|
187
|
+
@@commander.enumerate_lowercase expressions
|
188
|
+
when "enumerate-roman-uppercase",
|
189
|
+
"enumerate_roman_uppercase",
|
190
|
+
"enumerate-roman-upcase",
|
191
|
+
"enumerate_roman_upcase",
|
192
|
+
"enumerate-I",
|
193
|
+
"ol-I",
|
194
|
+
"enumerate_I",
|
195
|
+
"ol_I"
|
196
|
+
@@commander.enumerate_roman_uppercase expressions
|
197
|
+
when "enumerate-roman-lowercase",
|
198
|
+
"enumerate_roman_lowercase",
|
199
|
+
"enumerate-roman-downcase",
|
200
|
+
"enumerate_roman_downcase",
|
201
|
+
"enumerate-i",
|
202
|
+
"ol-i",
|
203
|
+
"enumerate_i",
|
204
|
+
"ol_i"
|
205
|
+
@@commander.enumerate_roman_lowercase expressions
|
206
|
+
when "item",
|
207
|
+
"li"
|
208
|
+
@@commander.item expressions
|
209
|
+
when "table"
|
210
|
+
@@commander.table expressions
|
211
|
+
when "tr",
|
212
|
+
"table-row",
|
213
|
+
"table_row"
|
214
|
+
@@commander.table_row expressions
|
215
|
+
when "th",
|
216
|
+
"table-header",
|
217
|
+
"table_header"
|
218
|
+
@@commander.table_header expressions
|
219
|
+
when "td",
|
220
|
+
"table-data",
|
221
|
+
"table_data",
|
222
|
+
"table-cell",
|
223
|
+
"table_cell"
|
224
|
+
@@commander.table_data expressions
|
121
225
|
when "user",
|
122
226
|
"user-id",
|
123
227
|
"user_id"
|
data/lib/teepee/commander.rb
CHANGED
@@ -63,8 +63,14 @@ module Teepee
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def html_tag tag, expressions
|
67
|
-
|
66
|
+
def html_tag tag, expressions, attribs=nil
|
67
|
+
opening_tag = if attribs
|
68
|
+
attribs_string = attribs.map {|k,v| %{"#{k}"="#{v}"}}.join " "
|
69
|
+
"<#{tag} #{attribs_string}>"
|
70
|
+
else
|
71
|
+
"<#{tag}>"
|
72
|
+
end
|
73
|
+
opening_tag + expressions.map(&:to_html).join + "</#{tag}>"
|
68
74
|
end
|
69
75
|
|
70
76
|
def tb_href target, string
|
@@ -184,6 +190,30 @@ module Teepee
|
|
184
190
|
Math::E
|
185
191
|
end
|
186
192
|
|
193
|
+
def enumerate expressions
|
194
|
+
html_tag :ol, expressions
|
195
|
+
end
|
196
|
+
|
197
|
+
def enumerate_numeric expressions
|
198
|
+
html_tag :ol, expressions, {type: "1"}
|
199
|
+
end
|
200
|
+
|
201
|
+
def enumerate_uppercase expressions
|
202
|
+
html_tag :ol, expressions, {type: "A"}
|
203
|
+
end
|
204
|
+
|
205
|
+
def enumerate_lowercase expressions
|
206
|
+
html_tag :ol, expressions, {type: "a"}
|
207
|
+
end
|
208
|
+
|
209
|
+
def enumerate_roman_uppercase expressions
|
210
|
+
html_tag :ol, expressions, {type: "I"}
|
211
|
+
end
|
212
|
+
|
213
|
+
def enumerate_roman_lowercase expressions
|
214
|
+
html_tag :ol, expressions, {type: "i"}
|
215
|
+
end
|
216
|
+
|
187
217
|
def erf number
|
188
218
|
ensure_numeric Math.erf number
|
189
219
|
end
|
@@ -204,6 +234,30 @@ module Teepee
|
|
204
234
|
ensure_numeric Math.gamma number
|
205
235
|
end
|
206
236
|
|
237
|
+
def h1 expressions
|
238
|
+
html_tag :h1, expressions
|
239
|
+
end
|
240
|
+
|
241
|
+
def h2 expressions
|
242
|
+
html_tag :h2gg, expressions
|
243
|
+
end
|
244
|
+
|
245
|
+
def h3 expressions
|
246
|
+
html_tag :h3, expressions
|
247
|
+
end
|
248
|
+
|
249
|
+
def h4 expressions
|
250
|
+
html_tag :h4, expressions
|
251
|
+
end
|
252
|
+
|
253
|
+
def h5 expressions
|
254
|
+
html_tag :h5, expressions
|
255
|
+
end
|
256
|
+
|
257
|
+
def h6 expressions
|
258
|
+
html_tag :h6, expressions
|
259
|
+
end
|
260
|
+
|
207
261
|
def i
|
208
262
|
command_error "Complex numbers are not yet supported."
|
209
263
|
end
|
@@ -212,6 +266,30 @@ module Teepee
|
|
212
266
|
html_tag :i, expressions
|
213
267
|
end
|
214
268
|
|
269
|
+
def item expressions
|
270
|
+
html_tag :li, expressions
|
271
|
+
end
|
272
|
+
|
273
|
+
def itemize expressions
|
274
|
+
html_tag :ul, expressions
|
275
|
+
end
|
276
|
+
|
277
|
+
def itemize_disc expressions
|
278
|
+
html_tag :ul, expressions, {style: "list-style-type:disc"}
|
279
|
+
end
|
280
|
+
|
281
|
+
def itemize_circle expressions
|
282
|
+
html_tag :ul, expressions, {style: "list-style-type:circle"}
|
283
|
+
end
|
284
|
+
|
285
|
+
def itemize_square expressions
|
286
|
+
html_tag :ul, expressions, {style: "list-style-type:square"}
|
287
|
+
end
|
288
|
+
|
289
|
+
def itemize_none expressions
|
290
|
+
html_tag :ul, expressions, {style: "list-style-type:none"}
|
291
|
+
end
|
292
|
+
|
215
293
|
def hypot numbers
|
216
294
|
ensure_numeric Math.sqrt numbers.map {|n| n**2}
|
217
295
|
end
|
@@ -293,6 +371,22 @@ module Teepee
|
|
293
371
|
html_tag :sup, expressions
|
294
372
|
end
|
295
373
|
|
374
|
+
def table expressions
|
375
|
+
html_tag :table, expressions
|
376
|
+
end
|
377
|
+
|
378
|
+
def table_data expressions
|
379
|
+
html_tag :td, expressions
|
380
|
+
end
|
381
|
+
|
382
|
+
def table_header expressions
|
383
|
+
html_tag :th, expressions
|
384
|
+
end
|
385
|
+
|
386
|
+
def table_row expressions
|
387
|
+
html_tag :tr, expressions
|
388
|
+
end
|
389
|
+
|
296
390
|
def tag_id id
|
297
391
|
id_command_handler id, :Tag
|
298
392
|
end
|