hemingway 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/lib/hemingway/block/block.rb +222 -121
- data/lib/hemingway/block/block.treetop +6 -3
- data/lib/hemingway/block/center/center.rb +134 -0
- data/lib/hemingway/block/center/center.treetop +17 -0
- data/lib/hemingway/block/center/center_nodes.rb +17 -0
- data/lib/hemingway/block/list/list.rb +30 -25
- data/lib/hemingway/block/list/list.treetop +1 -1
- data/lib/hemingway/build.rb +104 -6
- data/lib/hemingway/latex.rb +82 -15
- data/lib/hemingway/latex.treetop +4 -4
- data/lib/hemingway/latex_nodes.rb +16 -0
- data/lib/hemingway/math/math.rb +88 -4
- data/lib/hemingway/math/math.treetop +5 -1
- data/lib/hemingway/math/math_nodes.rb +14 -1
- data/lib/hemingway/special/special.rb +13 -2
- data/lib/hemingway/special/special.treetop +1 -1
- data/lib/hemingway/special/special_nodes.rb +9 -5
- data/lib/hemingway/symbol/symbol.rb +14 -2
- data/lib/hemingway/symbol/symbol.treetop +2 -1
- data/lib/hemingway/tag/tag.rb +162 -2
- data/lib/hemingway/tag/tag.treetop +6 -0
- data/lib/hemingway/tag/tag_nodes.rb +6 -0
- data/lib/hemingway/version.rb +1 -1
- data/spec/build_spec.rb +17 -0
- data/spec/nodes/block/center_spec.rb +27 -0
- data/spec/nodes/block/list_spec.rb +5 -0
- data/spec/nodes/block_spec.rb +5 -1
- data/spec/nodes/math_spec.rb +10 -0
- data/spec/nodes/special_spec.rb +6 -0
- data/spec/nodes/tag_spec.rb +9 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a574830a78bd7ac89da2dcd37f90b1515c265bd
|
4
|
+
data.tar.gz: c27b6b9773bc3768aac752831fa25190d5b2895e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8815d0ebdd41a282ed8f1003a05e0748a8fa4112d8ccd59f0b8c0da040d04e374f09f5ae26002501520aa8eeb3548eb18f50b753e170960725c8f0b9c5255fd9
|
7
|
+
data.tar.gz: 3305dd31396f382c5304d407d6b43bfac01224bb5f05f4bf55e4d5bcd7d2fc5e027fa1bdb7f71c06fd4824030c52ddbab21426631c9f29a30f8ab95bb1d46c7a
|
data/README.md
CHANGED
@@ -135,6 +135,11 @@ $\\psi$" : ψ
|
|
135
135
|
$\\omega$" : ω
|
136
136
|
```
|
137
137
|
|
138
|
+
One can also exponentiate something by using math mode:
|
139
|
+
|
140
|
+
```html
|
141
|
+
December 7$^{th}$ : <div class='entry'><p>December 7<sup>th</sup></p></div>
|
142
|
+
```
|
138
143
|
|
139
144
|
###### Special Characters
|
140
145
|
|
@@ -269,6 +274,12 @@ maps to
|
|
269
274
|
</blockquote>
|
270
275
|
```
|
271
276
|
|
277
|
+
###### Centering Text
|
278
|
+
|
279
|
+
```html
|
280
|
+
\\begin{center} Dromiceiomimus \\end{center} : <div class="center">Dromiceiomimus</div>
|
281
|
+
```
|
282
|
+
|
272
283
|
###### Inline Right Justification
|
273
284
|
|
274
285
|
```html
|
@@ -287,6 +298,12 @@ The love, <span class="pull-right">Will</span>
|
|
287
298
|
\\neatline : <hr class='neatline'>
|
288
299
|
```
|
289
300
|
|
301
|
+
###### Accents
|
302
|
+
|
303
|
+
```html
|
304
|
+
Charm\'{e}e de vous voir. Je suis tr\`{e} contente de vous voir. : Charmée de vous voir. Je suis trè contente de vous voir.
|
305
|
+
```
|
306
|
+
|
290
307
|
## Contributing
|
291
308
|
|
292
309
|
1. Fork it
|
@@ -5,6 +5,7 @@ require "hemingway/block/block_nodes"
|
|
5
5
|
require "hemingway/block/list/list"
|
6
6
|
require "hemingway/block/verbatim/verbatim"
|
7
7
|
require "hemingway/block/quote/quote"
|
8
|
+
require "hemingway/block/center/center"
|
8
9
|
|
9
10
|
module Hemingway
|
10
11
|
module Block
|
@@ -20,6 +21,8 @@ module Hemingway
|
|
20
21
|
|
21
22
|
include Quote
|
22
23
|
|
24
|
+
include Center
|
25
|
+
|
23
26
|
module Block0
|
24
27
|
def block_start
|
25
28
|
elements[0]
|
@@ -29,18 +32,10 @@ module Hemingway
|
|
29
32
|
elements[1]
|
30
33
|
end
|
31
34
|
|
32
|
-
def whitespace1
|
33
|
-
elements[3]
|
34
|
-
end
|
35
|
-
|
36
35
|
def content
|
37
36
|
elements[4]
|
38
37
|
end
|
39
38
|
|
40
|
-
def whitespace2
|
41
|
-
elements[5]
|
42
|
-
end
|
43
|
-
|
44
39
|
def block_end
|
45
40
|
elements[6]
|
46
41
|
end
|
@@ -60,18 +55,10 @@ module Hemingway
|
|
60
55
|
elements[1]
|
61
56
|
end
|
62
57
|
|
63
|
-
def whitespace1
|
64
|
-
elements[3]
|
65
|
-
end
|
66
|
-
|
67
58
|
def content
|
68
59
|
elements[4]
|
69
60
|
end
|
70
61
|
|
71
|
-
def whitespace2
|
72
|
-
elements[5]
|
73
|
-
end
|
74
|
-
|
75
62
|
def block_end
|
76
63
|
elements[6]
|
77
64
|
end
|
@@ -91,23 +78,38 @@ module Hemingway
|
|
91
78
|
elements[1]
|
92
79
|
end
|
93
80
|
|
94
|
-
def whitespace1
|
95
|
-
elements[3]
|
96
|
-
end
|
97
|
-
|
98
81
|
def content
|
99
82
|
elements[4]
|
100
83
|
end
|
101
84
|
|
102
|
-
def
|
103
|
-
elements[
|
85
|
+
def block_end
|
86
|
+
elements[6]
|
87
|
+
end
|
88
|
+
|
89
|
+
def quote_type
|
90
|
+
elements[7]
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
module Block3
|
96
|
+
def block_start
|
97
|
+
elements[0]
|
98
|
+
end
|
99
|
+
|
100
|
+
def type
|
101
|
+
elements[1]
|
102
|
+
end
|
103
|
+
|
104
|
+
def content
|
105
|
+
elements[4]
|
104
106
|
end
|
105
107
|
|
106
108
|
def block_end
|
107
109
|
elements[6]
|
108
110
|
end
|
109
111
|
|
110
|
-
def
|
112
|
+
def center_type
|
111
113
|
elements[7]
|
112
114
|
end
|
113
115
|
|
@@ -141,39 +143,49 @@ module Hemingway
|
|
141
143
|
end
|
142
144
|
s1 << r4
|
143
145
|
if r4
|
144
|
-
|
146
|
+
r6 = _nt_whitespace
|
147
|
+
if r6
|
148
|
+
r5 = r6
|
149
|
+
else
|
150
|
+
r5 = instantiate_node(SyntaxNode,input, index...index)
|
151
|
+
end
|
145
152
|
s1 << r5
|
146
153
|
if r5
|
147
|
-
|
148
|
-
s1 <<
|
149
|
-
if
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
154
|
+
r7 = _nt_list
|
155
|
+
s1 << r7
|
156
|
+
if r7
|
157
|
+
r9 = _nt_whitespace
|
158
|
+
if r9
|
159
|
+
r8 = r9
|
160
|
+
else
|
161
|
+
r8 = instantiate_node(SyntaxNode,input, index...index)
|
162
|
+
end
|
163
|
+
s1 << r8
|
164
|
+
if r8
|
165
|
+
r10 = _nt_block_end
|
166
|
+
s1 << r10
|
167
|
+
if r10
|
168
|
+
r11 = _nt_list_type
|
169
|
+
s1 << r11
|
170
|
+
if r11
|
159
171
|
if has_terminal?("}", false, index)
|
160
|
-
|
172
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
161
173
|
@index += 1
|
162
174
|
else
|
163
175
|
terminal_parse_failure("}")
|
164
|
-
|
176
|
+
r12 = nil
|
165
177
|
end
|
166
|
-
s1 <<
|
167
|
-
if
|
168
|
-
|
169
|
-
|
170
|
-
if
|
171
|
-
@index =
|
172
|
-
|
178
|
+
s1 << r12
|
179
|
+
if r12
|
180
|
+
i13 = index
|
181
|
+
r14 = lambda { |seq| seq[1].text_value == seq[7].text_value }.call(s1)
|
182
|
+
if r14
|
183
|
+
@index = i13
|
184
|
+
r13 = instantiate_node(SyntaxNode,input, index...index)
|
173
185
|
else
|
174
|
-
|
186
|
+
r13 = nil
|
175
187
|
end
|
176
|
-
s1 <<
|
188
|
+
s1 << r13
|
177
189
|
end
|
178
190
|
end
|
179
191
|
end
|
@@ -194,45 +206,55 @@ module Hemingway
|
|
194
206
|
r0 = r1
|
195
207
|
r0.extend(BlockNode)
|
196
208
|
else
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
if
|
201
|
-
|
202
|
-
|
203
|
-
if
|
209
|
+
i15, s15 = index, []
|
210
|
+
r16 = _nt_block_start
|
211
|
+
s15 << r16
|
212
|
+
if r16
|
213
|
+
r17 = _nt_verbatim_type
|
214
|
+
s15 << r17
|
215
|
+
if r17
|
204
216
|
if has_terminal?("}", false, index)
|
205
|
-
|
217
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
206
218
|
@index += 1
|
207
219
|
else
|
208
220
|
terminal_parse_failure("}")
|
209
|
-
|
221
|
+
r18 = nil
|
210
222
|
end
|
211
|
-
|
212
|
-
if
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
223
|
+
s15 << r18
|
224
|
+
if r18
|
225
|
+
r20 = _nt_whitespace
|
226
|
+
if r20
|
227
|
+
r19 = r20
|
228
|
+
else
|
229
|
+
r19 = instantiate_node(SyntaxNode,input, index...index)
|
230
|
+
end
|
231
|
+
s15 << r19
|
232
|
+
if r19
|
233
|
+
r21 = _nt_verbatim
|
234
|
+
s15 << r21
|
235
|
+
if r21
|
236
|
+
r23 = _nt_whitespace
|
237
|
+
if r23
|
238
|
+
r22 = r23
|
239
|
+
else
|
240
|
+
r22 = instantiate_node(SyntaxNode,input, index...index)
|
241
|
+
end
|
242
|
+
s15 << r22
|
243
|
+
if r22
|
244
|
+
r24 = _nt_block_end
|
245
|
+
s15 << r24
|
246
|
+
if r24
|
247
|
+
r25 = _nt_verbatim_type
|
248
|
+
s15 << r25
|
249
|
+
if r25
|
228
250
|
if has_terminal?("}", false, index)
|
229
|
-
|
251
|
+
r26 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
230
252
|
@index += 1
|
231
253
|
else
|
232
254
|
terminal_parse_failure("}")
|
233
|
-
|
255
|
+
r26 = nil
|
234
256
|
end
|
235
|
-
|
257
|
+
s15 << r26
|
236
258
|
end
|
237
259
|
end
|
238
260
|
end
|
@@ -241,56 +263,66 @@ module Hemingway
|
|
241
263
|
end
|
242
264
|
end
|
243
265
|
end
|
244
|
-
if
|
245
|
-
|
246
|
-
|
266
|
+
if s15.last
|
267
|
+
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
268
|
+
r15.extend(Block1)
|
247
269
|
else
|
248
|
-
@index =
|
249
|
-
|
270
|
+
@index = i15
|
271
|
+
r15 = nil
|
250
272
|
end
|
251
|
-
if
|
252
|
-
r0 =
|
273
|
+
if r15
|
274
|
+
r0 = r15
|
253
275
|
r0.extend(BlockNode)
|
254
276
|
else
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
if
|
259
|
-
|
260
|
-
|
261
|
-
if
|
277
|
+
i27, s27 = index, []
|
278
|
+
r28 = _nt_block_start
|
279
|
+
s27 << r28
|
280
|
+
if r28
|
281
|
+
r29 = _nt_quote_type
|
282
|
+
s27 << r29
|
283
|
+
if r29
|
262
284
|
if has_terminal?("}", false, index)
|
263
|
-
|
285
|
+
r30 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
264
286
|
@index += 1
|
265
287
|
else
|
266
288
|
terminal_parse_failure("}")
|
267
|
-
|
289
|
+
r30 = nil
|
268
290
|
end
|
269
|
-
|
270
|
-
if
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
291
|
+
s27 << r30
|
292
|
+
if r30
|
293
|
+
r32 = _nt_whitespace
|
294
|
+
if r32
|
295
|
+
r31 = r32
|
296
|
+
else
|
297
|
+
r31 = instantiate_node(SyntaxNode,input, index...index)
|
298
|
+
end
|
299
|
+
s27 << r31
|
300
|
+
if r31
|
301
|
+
r33 = _nt_quote_entry
|
302
|
+
s27 << r33
|
303
|
+
if r33
|
304
|
+
r35 = _nt_whitespace
|
305
|
+
if r35
|
306
|
+
r34 = r35
|
307
|
+
else
|
308
|
+
r34 = instantiate_node(SyntaxNode,input, index...index)
|
309
|
+
end
|
310
|
+
s27 << r34
|
311
|
+
if r34
|
312
|
+
r36 = _nt_block_end
|
313
|
+
s27 << r36
|
314
|
+
if r36
|
315
|
+
r37 = _nt_quote_type
|
316
|
+
s27 << r37
|
317
|
+
if r37
|
286
318
|
if has_terminal?("}", false, index)
|
287
|
-
|
319
|
+
r38 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
288
320
|
@index += 1
|
289
321
|
else
|
290
322
|
terminal_parse_failure("}")
|
291
|
-
|
323
|
+
r38 = nil
|
292
324
|
end
|
293
|
-
|
325
|
+
s27 << r38
|
294
326
|
end
|
295
327
|
end
|
296
328
|
end
|
@@ -299,19 +331,88 @@ module Hemingway
|
|
299
331
|
end
|
300
332
|
end
|
301
333
|
end
|
302
|
-
if
|
303
|
-
|
304
|
-
|
334
|
+
if s27.last
|
335
|
+
r27 = instantiate_node(SyntaxNode,input, i27...index, s27)
|
336
|
+
r27.extend(Block2)
|
305
337
|
else
|
306
|
-
@index =
|
307
|
-
|
338
|
+
@index = i27
|
339
|
+
r27 = nil
|
308
340
|
end
|
309
|
-
if
|
310
|
-
r0 =
|
341
|
+
if r27
|
342
|
+
r0 = r27
|
311
343
|
r0.extend(BlockNode)
|
312
344
|
else
|
313
|
-
|
314
|
-
|
345
|
+
i39, s39 = index, []
|
346
|
+
r40 = _nt_block_start
|
347
|
+
s39 << r40
|
348
|
+
if r40
|
349
|
+
r41 = _nt_center_type
|
350
|
+
s39 << r41
|
351
|
+
if r41
|
352
|
+
if has_terminal?("}", false, index)
|
353
|
+
r42 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
354
|
+
@index += 1
|
355
|
+
else
|
356
|
+
terminal_parse_failure("}")
|
357
|
+
r42 = nil
|
358
|
+
end
|
359
|
+
s39 << r42
|
360
|
+
if r42
|
361
|
+
r44 = _nt_whitespace
|
362
|
+
if r44
|
363
|
+
r43 = r44
|
364
|
+
else
|
365
|
+
r43 = instantiate_node(SyntaxNode,input, index...index)
|
366
|
+
end
|
367
|
+
s39 << r43
|
368
|
+
if r43
|
369
|
+
r45 = _nt_center
|
370
|
+
s39 << r45
|
371
|
+
if r45
|
372
|
+
r47 = _nt_whitespace
|
373
|
+
if r47
|
374
|
+
r46 = r47
|
375
|
+
else
|
376
|
+
r46 = instantiate_node(SyntaxNode,input, index...index)
|
377
|
+
end
|
378
|
+
s39 << r46
|
379
|
+
if r46
|
380
|
+
r48 = _nt_block_end
|
381
|
+
s39 << r48
|
382
|
+
if r48
|
383
|
+
r49 = _nt_center_type
|
384
|
+
s39 << r49
|
385
|
+
if r49
|
386
|
+
if has_terminal?("}", false, index)
|
387
|
+
r50 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
388
|
+
@index += 1
|
389
|
+
else
|
390
|
+
terminal_parse_failure("}")
|
391
|
+
r50 = nil
|
392
|
+
end
|
393
|
+
s39 << r50
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
end
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|
402
|
+
if s39.last
|
403
|
+
r39 = instantiate_node(SyntaxNode,input, i39...index, s39)
|
404
|
+
r39.extend(Block3)
|
405
|
+
else
|
406
|
+
@index = i39
|
407
|
+
r39 = nil
|
408
|
+
end
|
409
|
+
if r39
|
410
|
+
r0 = r39
|
411
|
+
r0.extend(BlockNode)
|
412
|
+
else
|
413
|
+
@index = i0
|
414
|
+
r0 = nil
|
415
|
+
end
|
315
416
|
end
|
316
417
|
end
|
317
418
|
end
|