livetext 0.8.40 → 0.8.41

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2b59edfa7e3a7f8234168f33682526d016d80722
4
- data.tar.gz: 14a0a67ee59bbcc55e59fd042f78f65bfad211a5
2
+ SHA256:
3
+ metadata.gz: ffe8c25b35e4833fc79866ea86456838dd5d2f036a5274a523562daf9de949d5
4
+ data.tar.gz: 43a358ca0195282039dd6dc952ca8cb73e3d044fe3d2771f22cdcb309258baeb
5
5
  SHA512:
6
- metadata.gz: be1e7f1b53e6dd291864ac3f51ccae36d8d57f1505fd8da5b955cd5cdf4534994f63b2f9f87672ba90f86f699ed535c8a4504a8d586bb7ddb88d2d11b2bdcf81
7
- data.tar.gz: 353193ecee4ab8c2748cdbeb556a0cc28066e1757c5e80c8cbf35f359993dcad1ce9d13bae237038f66ee89ecbdd489db77c470c325339a532b2a0ddd3998f07
6
+ metadata.gz: e368d77a3b35ae82555c46ff3fef124022f7bfd460ae9f37510d73213c49f4ed566982f88e220df331112bdee6dc3ba9ab54037359f6d0ac30a3f3560e412672
7
+ data.tar.gz: 1d85bd5b6a820294e895800f901373b1ce351bb264ff3ea76e96c7772025d0acc3d43419df19d25bfe70679702afee6b4346ebba78fc02fa20dcf1ae30ff61a6
data/README.lt3 CHANGED
@@ -1,6 +1,8 @@
1
1
  .mixin tutorial
2
2
  .mixin markdown
3
3
 
4
+ .copy basic.css
5
+
4
6
  .title Livetext: A smart processor for text
5
7
 
6
8
  *[This README is currently mangled. Fixes coming soon!]
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
+ <style>
2
+ pre {font-size: 14; bold }
3
+ tt {font-size: 14; bold }
4
+ </style>
1
5
  # Livetext: A smart processor for text
2
- <p>
3
-
4
6
  <b>This README is currently mangled. Fixes coming soon!</b>
5
7
  <p>
6
8
 
@@ -12,8 +14,6 @@ Why is this special? It's very flexible, very extensible, and it's extensible <i
12
14
  <p>
13
15
 
14
16
  ### Why Livetext?
15
- <p>
16
-
17
17
  Livetext grew out of several motivations. One was a desire for a markup language that would permit
18
18
  me to write articles (and even books) in my own way and on my own terms. I've done this more
19
19
  than once (and I know others who have, as well).
@@ -30,8 +30,6 @@ similar to the way we began several years ago to view HTML as a subset of XML.
30
30
  <p>
31
31
 
32
32
  ### What is Livetext really?
33
- <p>
34
-
35
33
  Here goes:
36
34
  * It's a text transformer
37
35
  * It's Ruby-based (later on, more language agnostic)
@@ -47,8 +45,6 @@ Here goes:
47
45
  * It's definitely not a softcover replacement
48
46
  * It could possibly augment markdown, softcover, others
49
47
  ### How does it work?
50
- <p>
51
-
52
48
  A Livetext file is simply a text file which may have commands interspersed. A command is
53
49
  simply a period followed by a name and optional parameters (at the beginning of a line).
54
50
  <p>
@@ -79,8 +75,6 @@ the repo to see these.
79
75
  <p>
80
76
 
81
77
  ### Syntax, comments, and more
82
- <p>
83
-
84
78
  At first, my idea was to provide predefined commands and allow user-defined commands (to be
85
79
  distinguished by a leading <tt>.</tt> or <tt>..</tt> marker). So the single and double dots were both legal.
86
80
  <p>
@@ -102,8 +96,6 @@ a <tt>.end</tt> tag).
102
96
  <p>
103
97
 
104
98
  ### Boldface and italics
105
- <p>
106
-
107
99
  Very commonly we want to format short words or phrases in italics, boldface, or a monospaced
108
100
  (fixed width) font. The Markdown spec provides ways to do this that are fairly intuitive; but I
109
101
  personally don't like them. My own notation works a different way.
@@ -146,14 +138,14 @@ Most of this is summarized in this example (taken from one of the testcases):
146
138
 
147
139
 
148
140
  <font size=+1><b>Test: </font><font size=+2><tt>basic_formatting</tt></font></b></h3><br>
149
- <center>
141
+ <font size=+1>
150
142
  <table width=80% cellpadding=4>
151
143
  <tr>
152
144
  <td width=50%><b>Input</b></td>
153
145
  <td width=50%><b>Output</b></td>
154
146
  </tr>
155
147
  <tr>
156
- <td width=50% bgcolor=#fec0fe valign=top>
148
+ <td width=50% bgcolor=#fee0fe valign=top>
157
149
  <pre> Here are examples of *boldface and \_italics and `code
158
150
  as well as *[more complex] examples of \_[italicized text]
159
151
  and `[code font].
@@ -164,7 +156,7 @@ Most of this is summarized in this example (taken from one of the testcases):
164
156
  No need to escape these: * \_ `
165
157
  </pre>
166
158
  </td>
167
- <td width=50% bgcolor=lightgray valign=top>
159
+ <td width=50% bgcolor=#eeeeee valign=top>
168
160
  <pre> Here are examples of <b>boldface</b> and <i>italics</i> and <tt>code</tt>
169
161
  as well as <b>more complex</b> examples of <i>italicized text</i>
170
162
  and <tt>code font</tt>.
@@ -179,13 +171,11 @@ Most of this is summarized in this example (taken from one of the testcases):
179
171
  </td>
180
172
  </tr>
181
173
  </table>
182
- </center>
174
+ </font>
183
175
  <br>
184
176
  <p>
185
177
 
186
178
  ### Standard methods
187
- <p>
188
-
189
179
  The module <tt>Livetext::Standard</tt> contains the set of standard or predefined methods. Their
190
180
  names are essentially the same as the names of the dot-commands, with occasional exceptions.
191
181
  (For example, it is impractical to use the name <tt>def</tt> as a method name, so the module has a
@@ -194,99 +184,97 @@ names are essentially the same as the names of the dot-commands, with occasional
194
184
 
195
185
  <table>
196
186
  <tr>
197
- <td width=3%><td width=10%> <tt>comment</tt> %% Start a comment block</td><td></td>
187
+ <td width=3%><td width=10%> <tt>comment</tt> </td><td> Start a comment block</td>
198
188
  </tr>
199
189
  <tr>
200
- <td width=3%><td width=10%> <tt>errout</tt> %% Write an error message to STDERR</td><td></td>
190
+ <td width=3%><td width=10%> <tt>errout</tt> </td><td> Write an error message to STDERR</td>
201
191
  </tr>
202
192
  <tr>
203
- <td width=3%><td width=10%> <tt>def</tt> %% Define a new method inline</td><td></td>
193
+ <td width=3%><td width=10%> <tt>def</tt> </td><td> Define a new method inline</td>
204
194
  </tr>
205
195
  <tr>
206
- <td width=3%><td width=10%> <tt>set</tt> %% Assign values to variables for later interpolation</td><td></td>
196
+ <td width=3%><td width=10%> <tt>set</tt> </td><td> Assign values to variables for later interpolation</td>
207
197
  </tr>
208
198
  <tr>
209
- <td width=3%><td width=10%> <tt>include</tt> %% Include an outside text file (to be interpreted as Livetext)</td><td></td>
199
+ <td width=3%><td width=10%> <tt>include</tt> </td><td> Include an outside text file (to be interpreted as Livetext)</td>
210
200
  </tr>
211
201
  <tr>
212
- <td width=3%><td width=10%> <tt>mixin</tt> %% Mix this file of Ruby methods into the standard namespace</td><td></td>
202
+ <td width=3%><td width=10%> <tt>mixin</tt> </td><td> Mix this file of Ruby methods into the standard namespace</td>
213
203
  </tr>
214
204
  <tr>
215
- <td width=3%><td width=10%> <tt>copy</tt> %% Copy this input file verbatim (no interpretation)</td><td></td>
205
+ <td width=3%><td width=10%> <tt>copy</tt> </td><td> Copy this input file verbatim (no interpretation)</td>
216
206
  </tr>
217
207
  <tr>
218
- <td width=3%><td width=10%> <tt>r</tt> %% Pass a single line through without processing</td><td></td>
208
+ <td width=3%><td width=10%> <tt>r</tt> </td><td> Pass a single line through without processing</td>
219
209
  </tr>
220
210
  <tr>
221
- <td width=3%><td width=10%> <tt>raw</tt> %% Pass this special text block (terminated with <tt>__EOF__</tt>) directly into output without processing </td><td></td>
211
+ <td width=3%><td width=10%> <tt>raw</tt> </td><td> Pass this special text block (terminated with <tt><i>EOF__</tt></i>) directly into output without processing </td>
222
212
  </tr>
223
213
  <tr>
224
- <td width=3%><td width=10%><tt>func</tt> %% Define a function to be invoked inline</td><td></td>
214
+ <td width=3%><td width=10%> <tt>func</tt> </td><td> Define a function to be invoked inline</td>
225
215
  </tr>
226
216
  <tr>
227
- <td width=3%><td width=10%><tt>say</tt> %% Print a message to the screen</td><td></td>
217
+ <td width=3%><td width=10%> <tt>say</tt> </td><td> Print a message to the screen</td>
228
218
  </tr>
229
219
  <tr>
230
- <td width=3%><td width=10%><tt>banner</tt> %% Print a "noticeable" message to the screen</td><td></td>
220
+ <td width=3%><td width=10%> <tt>banner</tt> </td><td> Print a "noticeable" message to the screen</td>
231
221
  </tr>
232
222
  <tr>
233
- <td width=3%><td width=10%><tt>quit</tt> %% End processing and exit</td><td></td>
223
+ <td width=3%><td width=10%> <tt>quit</tt> </td><td> End processing and exit</td>
234
224
  </tr>
235
225
  <tr>
236
- <td width=3%><td width=10%><tt>nopass</tt> %% Don't pass lines through (just honor commands)</td><td></td>
226
+ <td width=3%><td width=10%> <tt>nopass</tt> </td><td> Don't pass lines through (just honor commands)</td>
237
227
  </tr>
238
228
  <tr>
239
- <td width=3%><td width=10%><tt>include</tt> %% Read and process another file (typically a <tt>.lt3</tt> file)</td><td></td>
229
+ <td width=3%><td width=10%> <tt>include</tt> </td><td> Read and process another file (typically a <tt>.lt3</tt> file)</td>
240
230
  </tr>
241
231
  <tr>
242
- <td width=3%><td width=10%><tt>debug</tt> %% Turn on debugging</td><td></td>
232
+ <td width=3%><td width=10%> <tt>debug</tt> </td><td> Turn on debugging</td>
243
233
  </tr>
244
234
  <tr>
245
- <td width=3%><td width=10%><tt>nopara</tt> %% Turn off the "blank line implies new paragraph" switch</td><td></td>
235
+ <td width=3%><td width=10%> <tt>nopara</tt> </td><td> Turn off the "blank line implies new paragraph" switch</td>
246
236
  </tr>
247
237
  <tr>
248
- <td width=3%><td width=10%><tt>newpage</tt> %% Start a new output page</td><td></td>
238
+ <td width=3%><td width=10%> <tt>newpage</tt> </td><td> Start a new output page</td>
249
239
  </tr>
250
240
  </table>
251
241
  ### Examples from the tests
252
- <p>
253
-
254
242
  Here are some tests from the suite. The file name reflects the general purpose of the test.
255
243
  <p>
256
244
 
257
245
 
258
246
  <font size=+1><b>Test: </font><font size=+2><tt>hello_world</tt></font></b></h3><br>
259
- <center>
247
+ <font size=+1>
260
248
  <table width=80% cellpadding=4>
261
249
  <tr>
262
250
  <td width=50%><b>Input</b></td>
263
251
  <td width=50%><b>Output</b></td>
264
252
  </tr>
265
253
  <tr>
266
- <td width=50% bgcolor=#fec0fe valign=top>
254
+ <td width=50% bgcolor=#fee0fe valign=top>
267
255
  <pre> Hello,
268
256
  world!
269
257
  </pre>
270
258
  </td>
271
- <td width=50% bgcolor=lightgray valign=top>
259
+ <td width=50% bgcolor=#eeeeee valign=top>
272
260
  <pre> Hello,
273
261
  world!
274
262
  </pre>
275
263
  </td>
276
264
  </tr>
277
265
  </table>
278
- </center>
266
+ </font>
279
267
  <br>
280
268
 
281
269
  <font size=+1><b>Test: </font><font size=+2><tt>comments_ignored_1</tt></font></b></h3><br>
282
- <center>
270
+ <font size=+1>
283
271
  <table width=80% cellpadding=4>
284
272
  <tr>
285
273
  <td width=50%><b>Input</b></td>
286
274
  <td width=50%><b>Output</b></td>
287
275
  </tr>
288
276
  <tr>
289
- <td width=50% bgcolor=#fec0fe valign=top>
277
+ <td width=50% bgcolor=#fee0fe valign=top>
290
278
  <pre> . Comments are ignored
291
279
  abc 123
292
280
  this is a test
@@ -296,7 +284,7 @@ Here are some tests from the suite. The file name reflects the general purpose o
296
284
  . end of the file
297
285
  </pre>
298
286
  </td>
299
- <td width=50% bgcolor=lightgray valign=top>
287
+ <td width=50% bgcolor=#eeeeee valign=top>
300
288
  <pre> abc 123
301
289
  this is a test
302
290
  more stuff
@@ -305,18 +293,18 @@ Here are some tests from the suite. The file name reflects the general purpose o
305
293
  </td>
306
294
  </tr>
307
295
  </table>
308
- </center>
296
+ </font>
309
297
  <br>
310
298
 
311
299
  <font size=+1><b>Test: </font><font size=+2><tt>block_comment</tt></font></b></h3><br>
312
- <center>
300
+ <font size=+1>
313
301
  <table width=80% cellpadding=4>
314
302
  <tr>
315
303
  <td width=50%><b>Input</b></td>
316
304
  <td width=50%><b>Output</b></td>
317
305
  </tr>
318
306
  <tr>
319
- <td width=50% bgcolor=#fec0fe valign=top>
307
+ <td width=50% bgcolor=#fee0fe valign=top>
320
308
  <pre> .comment
321
309
  This is
322
310
  a comment
@@ -338,7 +326,7 @@ Here are some tests from the suite. The file name reflects the general purpose o
338
326
 
339
327
  </pre>
340
328
  </td>
341
- <td width=50% bgcolor=lightgray valign=top>
329
+ <td width=50% bgcolor=#eeeeee valign=top>
342
330
  <pre> abc 123
343
331
  xyz
344
332
  one
@@ -348,19 +336,20 @@ Here are some tests from the suite. The file name reflects the general purpose o
348
336
  </td>
349
337
  </tr>
350
338
  </table>
351
- </center>
339
+ </font>
352
340
  <br>
353
341
 
354
342
  <font size=+1><b>Test: </font><font size=+2><tt>def_method</tt></font></b></h3><br>
355
- <center>
343
+ <font size=+1>
356
344
  <table width=80% cellpadding=4>
357
345
  <tr>
358
346
  <td width=50%><b>Input</b></td>
359
347
  <td width=50%><b>Output</b></td>
360
348
  </tr>
361
349
  <tr>
362
- <td width=50% bgcolor=#fec0fe valign=top>
363
- <pre> abc
350
+ <td width=50% bgcolor=#fee0fe valign=top>
351
+ <pre> .backtrace
352
+ abc
364
353
  123
365
354
  .def foobar
366
355
  ::STDERR.puts "This is the"
@@ -372,7 +361,7 @@ Here are some tests from the suite. The file name reflects the general purpose o
372
361
  123
373
362
  </pre>
374
363
  </td>
375
- <td width=50% bgcolor=lightgray valign=top>
364
+ <td width=50% bgcolor=#eeeeee valign=top>
376
365
  <pre> abc
377
366
  123
378
367
  xyz
@@ -382,18 +371,18 @@ Here are some tests from the suite. The file name reflects the general purpose o
382
371
  </td>
383
372
  </tr>
384
373
  </table>
385
- </center>
374
+ </font>
386
375
  <br>
387
376
 
388
377
  <font size=+1><b>Test: </font><font size=+2><tt>simple_vars</tt></font></b></h3><br>
389
- <center>
378
+ <font size=+1>
390
379
  <table width=80% cellpadding=4>
391
380
  <tr>
392
381
  <td width=50%><b>Input</b></td>
393
382
  <td width=50%><b>Output</b></td>
394
383
  </tr>
395
384
  <tr>
396
- <td width=50% bgcolor=#fec0fe valign=top>
385
+ <td width=50% bgcolor=#fee0fe valign=top>
397
386
  <pre> Just
398
387
  some text.
399
388
  .set name=GulliverFoyle,nation=Terra
@@ -403,7 +392,7 @@ Here are some tests from the suite. The file name reflects the general purpose o
403
392
  That's all.
404
393
  </pre>
405
394
  </td>
406
- <td width=50% bgcolor=lightgray valign=top>
395
+ <td width=50% bgcolor=#eeeeee valign=top>
407
396
  <pre> Just
408
397
  some text.
409
398
  Hi, there.
@@ -414,18 +403,18 @@ Here are some tests from the suite. The file name reflects the general purpose o
414
403
  </td>
415
404
  </tr>
416
405
  </table>
417
- </center>
406
+ </font>
418
407
  <br>
419
408
 
420
409
  <font size=+1><b>Test: </font><font size=+2><tt>simple_include</tt></font></b></h3><br>
421
- <center>
410
+ <font size=+1>
422
411
  <table width=80% cellpadding=4>
423
412
  <tr>
424
413
  <td width=50%><b>Input</b></td>
425
414
  <td width=50%><b>Output</b></td>
426
415
  </tr>
427
416
  <tr>
428
- <td width=50% bgcolor=#fec0fe valign=top>
417
+ <td width=50% bgcolor=#fee0fe valign=top>
429
418
  <pre> Here I am
430
419
  .debug
431
420
  trying to
@@ -435,7 +424,7 @@ Here are some tests from the suite. The file name reflects the general purpose o
435
424
  worked.
436
425
  </pre>
437
426
  </td>
438
- <td width=50% bgcolor=lightgray valign=top>
427
+ <td width=50% bgcolor=#eeeeee valign=top>
439
428
  <pre> Here I am
440
429
  trying to
441
430
  include
@@ -447,18 +436,18 @@ Here are some tests from the suite. The file name reflects the general purpose o
447
436
  </td>
448
437
  </tr>
449
438
  </table>
450
- </center>
439
+ </font>
451
440
  <br>
452
441
 
453
442
  <font size=+1><b>Test: </font><font size=+2><tt>simple_mixin</tt></font></b></h3><br>
454
- <center>
443
+ <font size=+1>
455
444
  <table width=80% cellpadding=4>
456
445
  <tr>
457
446
  <td width=50%><b>Input</b></td>
458
447
  <td width=50%><b>Output</b></td>
459
448
  </tr>
460
449
  <tr>
461
- <td width=50% bgcolor=#fec0fe valign=top>
450
+ <td width=50% bgcolor=#fee0fe valign=top>
462
451
  <pre> Here I am
463
452
  testing a simple mixin
464
453
  .mixin simple\_mixin
@@ -467,7 +456,7 @@ Here are some tests from the suite. The file name reflects the general purpose o
467
456
  That's all.
468
457
  </pre>
469
458
  </td>
470
- <td width=50% bgcolor=lightgray valign=top>
459
+ <td width=50% bgcolor=#eeeeee valign=top>
471
460
  <pre> Here I am
472
461
  testing a simple mixin
473
462
  Now call it:
@@ -477,18 +466,18 @@ Here are some tests from the suite. The file name reflects the general purpose o
477
466
  </td>
478
467
  </tr>
479
468
  </table>
480
- </center>
469
+ </font>
481
470
  <br>
482
471
 
483
472
  <font size=+1><b>Test: </font><font size=+2><tt>simple_copy</tt></font></b></h3><br>
484
- <center>
473
+ <font size=+1>
485
474
  <table width=80% cellpadding=4>
486
475
  <tr>
487
476
  <td width=50%><b>Input</b></td>
488
477
  <td width=50%><b>Output</b></td>
489
478
  </tr>
490
479
  <tr>
491
- <td width=50% bgcolor=#fec0fe valign=top>
480
+ <td width=50% bgcolor=#fee0fe valign=top>
492
481
  <pre> The copy command
493
482
  copies any file
494
483
  without interpretation,
@@ -497,7 +486,7 @@ Here are some tests from the suite. The file name reflects the general purpose o
497
486
  That is all.
498
487
  </pre>
499
488
  </td>
500
- <td width=50% bgcolor=lightgray valign=top>
489
+ <td width=50% bgcolor=#eeeeee valign=top>
501
490
  <pre> The copy command
502
491
  copies any file
503
492
  without interpretation,
@@ -509,25 +498,25 @@ Here are some tests from the suite. The file name reflects the general purpose o
509
498
  </td>
510
499
  </tr>
511
500
  </table>
512
- </center>
501
+ </font>
513
502
  <br>
514
503
 
515
504
  <font size=+1><b>Test: </font><font size=+2><tt>copy_is_raw</tt></font></b></h3><br>
516
- <center>
505
+ <font size=+1>
517
506
  <table width=80% cellpadding=4>
518
507
  <tr>
519
508
  <td width=50%><b>Input</b></td>
520
509
  <td width=50%><b>Output</b></td>
521
510
  </tr>
522
511
  <tr>
523
- <td width=50% bgcolor=#fec0fe valign=top>
512
+ <td width=50% bgcolor=#fee0fe valign=top>
524
513
  <pre> A copy command
525
514
  does not interpret its input:
526
515
  .copy rawtext.inc
527
516
  That's all.
528
517
  </pre>
529
518
  </td>
530
- <td width=50% bgcolor=lightgray valign=top>
519
+ <td width=50% bgcolor=#eeeeee valign=top>
531
520
  <pre> A copy command
532
521
  does not interpret its input:
533
522
  This is not a comment:
@@ -539,18 +528,18 @@ Here are some tests from the suite. The file name reflects the general purpose o
539
528
  </td>
540
529
  </tr>
541
530
  </table>
542
- </center>
531
+ </font>
543
532
  <br>
544
533
 
545
534
  <font size=+1><b>Test: </font><font size=+2><tt>raw_text_block</tt></font></b></h3><br>
546
- <center>
535
+ <font size=+1>
547
536
  <table width=80% cellpadding=4>
548
537
  <tr>
549
538
  <td width=50%><b>Input</b></td>
550
539
  <td width=50%><b>Output</b></td>
551
540
  </tr>
552
541
  <tr>
553
- <td width=50% bgcolor=#fec0fe valign=top>
542
+ <td width=50% bgcolor=#fee0fe valign=top>
554
543
  <pre> This text block will be passed thru
555
544
  with no interpretation or processing:
556
545
  .raw
@@ -569,7 +558,7 @@ Here are some tests from the suite. The file name reflects the general purpose o
569
558
  I hope that worked.
570
559
  </pre>
571
560
  </td>
572
- <td width=50% bgcolor=lightgray valign=top>
561
+ <td width=50% bgcolor=#eeeeee valign=top>
573
562
  <pre> This text block will be passed thru
574
563
  with no interpretation or processing:
575
564
  .comment
@@ -588,13 +577,11 @@ Here are some tests from the suite. The file name reflects the general purpose o
588
577
  </td>
589
578
  </tr>
590
579
  </table>
591
- </center>
580
+ </font>
592
581
  <br>
593
582
  <p>
594
583
 
595
584
  ### Writing custom methods
596
- <p>
597
-
598
585
  Suppose you wanted to write a method called <tt>chapter</tt> that would simply
599
586
  output a chapter number and title with certain heading tags and a
600
587
  horizontal rule following. There is more than one way to do this.
@@ -612,16 +599,16 @@ the text. Here's an example.
612
599
 
613
600
  . This is also a comment, by the way.
614
601
  .def chapter
615
- params = _args
602
+ params = &lt;i&gt;args&lt;/i&gt;
616
603
  raise &quot;chapter: expecting at least two args&quot; unless params.size &gt; 1
617
- num, *title = params # Chapter number + title
604
+ num, &lt;b&gt;title&lt;/b&gt; = params # Chapter number + title
618
605
  title = title.join(&quot; &quot;) # Join all words into one string
619
606
  text = &lt;&lt;-HTML
620
607
  &lt;h3&gt;Chapter #{num}&lt;/h3&gt;
621
608
  &lt;h2&gt;#{title}&lt;/h2&gt;
622
609
  &lt;hr&gt;
623
610
  HTML
624
- _puts text
611
+ &lt;i&gt;puts&lt;/i&gt; text
625
612
  .end
626
613
  . Now let&#39;s invoke it...
627
614
  .chapter 1 Why I Went to the Woods
@@ -665,25 +652,25 @@ What are some other helper methods? Here's a list.
665
652
 
666
653
  <table>
667
654
  <tr>
668
- <td width=3%><td width=10%><tt>_args</tt> %% Returns an array of arguments for the method (or an enumerator for that array)</td><td></td>
655
+ <td width=3%><td width=10%><tt><i>args</tt></i></td><td>%%</td>
669
656
  </tr>
670
657
  <tr>
671
- <td width=3%><td width=10%><tt>_data</tt> %% A single "unsplit" string of all arguments in raw form</td><td></td>
658
+ <td width=3%><td width=10%><tt><i>data</tt></i></td><td>%%</td>
672
659
  </tr>
673
660
  <tr>
674
- <td width=3%><td width=10%><tt>_body</tt> %% Returns a string (or enumerator) giving access to the text block (preceding <tt></tt>.end)</td><td></td>
661
+ <td width=3%><td width=10%><tt><i>body</tt></i></td><td>%%</td>
675
662
  </tr>
676
663
  <tr>
677
- <td width=3%><td width=10%><tt>_puts</tt> %% Write a line to output (STDOUT or wherever)</td><td></td>
664
+ <td width=3%><td width=10%><tt><i>puts</tt></i></td><td>%%</td>
678
665
  </tr>
679
666
  <tr>
680
- <td width=3%><td width=10%><tt>_print</tt> %% Write a line to output (STDOUT or wherever) without a newline</td><td></td>
667
+ <td width=3%><td width=10%><tt><i>print</tt></i></td><td>%%</td>
681
668
  </tr>
682
669
  <tr>
683
- <td width=3%><td width=10%><tt>_formatting</tt> %% A function transforming boldface, italics, and monospace (Livetext conventions)</td><td></td>
670
+ <td width=3%><td width=10%><tt><i>formatting</tt></i></td><td>%%</td>
684
671
  </tr>
685
672
  <tr>
686
- <td width=3%><td width=10%><tt>_passthru</tt> %% Feed a line directly into output after transforming and substituting</td><td></td>
673
+ <td width=3%><td width=10%><tt><i>passthru</tt></i></td><td>%%</td>
687
674
  </tr>
688
675
  </table>
689
676
  Note that the last three methods are typically <i>not</i> called in your own code. They could be,
@@ -691,8 +678,6 @@ but it remains to be seen whether something that advanced is useful.
691
678
  <p>
692
679
 
693
680
  ### More examples
694
- <p>
695
-
696
681
  Suppose you wanted to take a list of words, more than one per line, and alphabetize them.
697
682
  Let's write a method called <tt>alpha</tt> for that. This exercise and the next one are implemented
698
683
  in the test suite.
@@ -700,17 +685,16 @@ in the test suite.
700
685
 
701
686
 
702
687
  <font size=+1><b>Test: </font><font size=+2><tt>example_alpha</tt></font></b></h3><br>
703
- <center>
688
+ <font size=+1>
704
689
  <table width=80% cellpadding=4>
705
690
  <tr>
706
691
  <td width=50%><b>Input</b></td>
707
692
  <td width=50%><b>Output</b></td>
708
693
  </tr>
709
694
  <tr>
710
- <td width=50% bgcolor=#fec0fe valign=top>
695
+ <td width=50% bgcolor=#fee0fe valign=top>
711
696
  <pre> .def alpha
712
- text = \_body.join
713
- text.gsub!(/\n/, " ")
697
+ text = \_body.to\_a.join(" ")
714
698
  words = text.split.sort
715
699
  words.each {|w| \_puts " #{w}" }
716
700
  .end
@@ -727,7 +711,7 @@ in the test suite.
727
711
  I hope that worked.
728
712
  </pre>
729
713
  </td>
730
- <td width=50% bgcolor=lightgray valign=top>
714
+ <td width=50% bgcolor=#eeeeee valign=top>
731
715
  <pre> Here is an alphabetized list:
732
716
  <p>
733
717
 
@@ -755,7 +739,7 @@ in the test suite.
755
739
  </td>
756
740
  </tr>
757
741
  </table>
758
- </center>
742
+ </font>
759
743
  <br>
760
744
  <p>
761
745
 
@@ -765,20 +749,20 @@ have the user specify a number of columns (from 1 to 5, defaulting to 1).
765
749
 
766
750
 
767
751
  <font size=+1><b>Test: </font><font size=+2><tt>example_alpha2</tt></font></b></h3><br>
768
- <center>
752
+ <font size=+1>
769
753
  <table width=80% cellpadding=4>
770
754
  <tr>
771
755
  <td width=50%><b>Input</b></td>
772
756
  <td width=50%><b>Output</b></td>
773
757
  </tr>
774
758
  <tr>
775
- <td width=50% bgcolor=#fec0fe valign=top>
759
+ <td width=50% bgcolor=#fee0fe valign=top>
776
760
  <pre> .def alpha
777
761
  cols = \_args.first
778
762
  cols = "1" if cols == ""
779
763
  cols = cols.to\_i
780
764
  raise "Columns must be 1-5" unless cols.between?(1,5)
781
- text = \_body.join
765
+ text = \_body\_text
782
766
  text.gsub!(/\n/, " ")
783
767
  words = text.split.sort
784
768
  words.each\_slice(cols) do |row|
@@ -799,7 +783,7 @@ have the user specify a number of columns (from 1 to 5, defaulting to 1).
799
783
  I hope that worked a second time.
800
784
  </pre>
801
785
  </td>
802
- <td width=50% bgcolor=lightgray valign=top>
786
+ <td width=50% bgcolor=#eeeeee valign=top>
803
787
  <pre> Here is an alphabetized list:
804
788
  <p>
805
789
 
@@ -816,7 +800,7 @@ have the user specify a number of columns (from 1 to 5, defaulting to 1).
816
800
  </td>
817
801
  </tr>
818
802
  </table>
819
- </center>
803
+ </font>
820
804
  <br>
821
805
  <p>
822
806
 
@@ -833,16 +817,16 @@ in here (and nothing else).
833
817
  # File: mylib.rb
834
818
 
835
819
  def alpha
836
- cols = _args.first
820
+ cols = &lt;i&gt;args.first&lt;/i&gt;
837
821
  cols = &quot;1&quot; if cols == &quot;&quot;
838
- cols = cols.to_i
822
+ cols = cols.to&lt;i&gt;i&lt;/i&gt;
839
823
  raise &quot;Columns must be 1-5&quot; unless cols.between?(1,5)
840
- text = _body.join
824
+ text = &lt;i&gt;body.join&lt;/i&gt;
841
825
  text.gsub!(/\n/, &quot; &quot;)
842
826
  words = text.split.sort
843
- words.each_slice(cols) do |row|
844
- row.each {|w| _print &#39;%-15s&#39; % w }
845
- _puts
827
+ words.each&lt;i&gt;slice(cols)&lt;/i&gt; do |row|
828
+ row.each {|w| &lt;i&gt;print&lt;/i&gt; &#39;%-15s&#39; % w }
829
+ &lt;i&gt;puts&lt;/i&gt;
846
830
  end
847
831
  end
848
832
  </pre>
@@ -876,8 +860,6 @@ on that new custom object. I plan to implement this later.
876
860
  <p>
877
861
 
878
862
  ### Issues, open questions, and to-do items
879
- <p>
880
-
881
863
  This list is not prioritized yet.
882
864
  <p>
883
865
 
@@ -892,13 +874,13 @@ This list is not prioritized yet.
892
874
  9. Worry about nesting of elements (probably mostly disallow)
893
875
  10. Think about UTF-8
894
876
  11. Document API fully
895
- 12. Add <tt>_raw_args</tt> and let <tt>_args</tt> honor quotes
877
+ 12. Add <tt><i>raw_args</tt></i> and let <tt><i>args</tt></i> honor quotes
896
878
  13. Support quotes in <tt>.set</tt> values
897
879
  14. Support "namespaced" variables (<tt>.set code.font="whatever"</tt>)
898
- 15. <strike>Support functions (``$$func) </strike>
880
+ 15. <strike>Support functions (<tt>$$func</tt>) </strike>
899
881
  16. Support function namespacing
900
- 17. Create predefined variables (e.g., <tt>$_source_file</tt>, <tt>$[_line])</tt>
901
- 18. Create predefined functions (e.g., <tt>$$_date</tt>)
882
+ 17. Create predefined variables (e.g., <tt>$<i>source_file</tt>,</i> <tt>$[<i>line])</tt></i>
883
+ 18. Create predefined functions (e.g., <tt>$$<i>date</tt>)</i>
902
884
  19. More support for markdown
903
885
  20. Allow turning on/off: formatting, variable interpolation, function interpolation?
904
886
  21. <tt>.require</tt> with file and sigil parameters
@@ -911,7 +893,7 @@ This list is not prioritized yet.
911
893
  28. Warn when overriding existing names?
912
894
  29. Think about passing data in (erb replacement)
913
895
  30. <strike>]Allow</strike> custom ending tag on <tt>raw</tt> method
914
- 31. <strike>Ignore first blank line after `[.end</strike>? (and after raw-tag?)
896
+ 31. <strike>Ignore first blank line after <tt>.end</strike>? (and after raw-tag?)</tt>
915
897
  32. Allow/encourage custom <tt>passthru</tt> method?
916
898
  33. Must have sane support for CSS
917
899
  34. Support for Pygments and/or other code processors
@@ -11,6 +11,9 @@ def credit
11
11
  # really just a place marker in source
12
12
  end
13
13
 
14
+ def h1; _puts "<h1>#{@_data}</h1>"; end
15
+ def h3; _puts "<h3>#{@_data}</h3>"; end
16
+
14
17
  def list
15
18
  _puts "<ul>"
16
19
  _body {|line| _puts "<li>#{line}</li>" }
@@ -108,11 +108,11 @@ def pubdate
108
108
  @meta.pubdate = "%04d-%02d-%02d" % [y, m, d]
109
109
  end
110
110
 
111
- def categories # now: tags
112
- _debug "args = #{_args}"
113
- @meta.categories = _args # phase out
114
- @meta.tags = _args
115
- end
111
+ # def categories # now: tags
112
+ # _debug "args = #{_args}"
113
+ # @meta.categories = _args # phase out
114
+ # @meta.tags = _args
115
+ # end
116
116
 
117
117
  def tags
118
118
  _debug "args = #{_args}"
@@ -124,9 +124,15 @@ def views
124
124
  @meta.views = _args.dup # + ["main"]
125
125
  end
126
126
 
127
- def liveblog_version
127
+ def pin
128
+ _debug "data = #{_args}"
129
+ # verify only already-specified views?
130
+ @meta.pinned = _args.dup
128
131
  end
129
132
 
133
+ # def liveblog_version
134
+ # end
135
+
130
136
  def list
131
137
  @body << "<ul>"
132
138
  _body {|line| @body << "<li>#{line}</li>" }
@@ -27,22 +27,20 @@ def inout
27
27
  t2 = t2.map {|x| " " + x.sub(/ +$/,"").gsub(/_/, "\\_") }.join
28
28
 
29
29
  puts <<-HTML
30
- <center>
31
30
  <table width=80% cellpadding=4>
32
31
  <tr>
33
32
  <td width=50%><b>Input</b></td>
34
33
  <td width=50%><b>Output</b></td>
35
34
  </tr>
36
35
  <tr>
37
- <td width=50% bgcolor=#fec0fe valign=top>
36
+ <td width=50% bgcolor=#fee0fe valign=top>
38
37
  <pre>#{t1}</pre>
39
38
  </td>
40
- <td width=50% bgcolor=lightgray valign=top>
39
+ <td width=50% bgcolor=#eeeeee valign=top>
41
40
  <pre>#{t2}</pre>
42
41
  </td>
43
42
  </tr>
44
43
  </table>
45
- </center>
46
44
  HTML
47
45
  end
48
46
 
@@ -53,29 +51,29 @@ def put_table(src, exp)
53
51
  t2 = t2.map {|x| " " + x.sub(/ +$/,"").gsub(/_/, "\\_") }.join
54
52
 
55
53
  puts <<-HTML
56
- <center>
54
+ <font size=+1>
57
55
  <table width=80% cellpadding=4>
58
56
  <tr>
59
57
  <td width=50%><b>Input</b></td>
60
58
  <td width=50%><b>Output</b></td>
61
59
  </tr>
62
60
  <tr>
63
- <td width=50% bgcolor=#fec0fe valign=top>
61
+ <td width=50% bgcolor=#fee0fe valign=top>
64
62
  <pre>#{t1}</pre>
65
63
  </td>
66
- <td width=50% bgcolor=lightgray valign=top>
64
+ <td width=50% bgcolor=#eeeeee valign=top>
67
65
  <pre>#{t2}</pre>
68
66
  </td>
69
67
  </tr>
70
68
  </table>
71
- </center>
69
+ </font>
72
70
  HTML
73
71
  end
74
72
 
75
73
  def testcase
76
74
  name = _args.first
77
75
  _puts "\n<font size=+1><b>Test: </font><font size=+2><tt>#{name}</tt></font></b></h3><br>"
78
- src, exp = "#{Data}/#{name}/source.lt3", "{Data}/#{name}/expected-output.txt"
76
+ src, exp = "test/data/#{name}/source.lt3", "test/data/#{name}/expected-output.txt"
79
77
  @_args = [src, exp] # Better way to do this??
80
78
  put_table(src, exp)
81
79
  _puts "<br>"
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.40"
2
+ VERSION = "0.8.41"
3
3
  end
4
4
 
5
5
  $Livetext = Livetext
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livetext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.40
4
+ version: 0.8.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2018-12-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 2.2.2
159
+ rubygems_version: 2.7.7
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: A smart processor for text