livetext 0.9.20 → 0.9.21

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -110,6 +110,10 @@ for "code font." The formatting ends when the first blank space is encountered,
110
110
  kind of suffixed character.
111
111
  <p>
112
112
 
113
+ <p>
114
+
115
+ <p>
116
+
113
117
  I also find it's common to want to terminate such a string with some kind of
114
118
  naturally-occurring punctuation mark. If we double the initial delimiter, it
115
119
  will be understood to terminate at the first period, comma, or right parenthesis.
@@ -136,15 +140,15 @@ Most of this is summarized in this example (taken from one of the testcases):
136
140
 
137
141
 
138
142
  <font size=+1><b>Test: </font><font size=+2><tt>basic_formatting</tt></font></b></h3><br>
139
- <font size=+1>
140
- <table width=80% cellpadding=4>
141
- <tr>
142
- <td width=50%><b>Input</b></td>
143
- <td width=50%><b>Output</b></td>
144
- </tr>
145
- <tr>
146
- <td width=50% bgcolor=#fee0fe valign=top>
147
- <pre> Here are examples of *boldface
143
+ <font size=+1>
144
+ <table width=80% cellpadding=4>
145
+ <tr>
146
+ <td width=50%><b>Input</b></td>
147
+ <td width=50%><b>Output</b></td>
148
+ </tr>
149
+ <tr>
150
+ <td width=50% bgcolor=#fee0fe valign=top>
151
+ <pre> Here are examples of *boldface
148
152
  and \_italics
149
153
  and `code
150
154
  as well as *[more complex] examples
@@ -156,9 +160,9 @@ Most of this is summarized in this example (taken from one of the testcases):
156
160
 
157
161
  No need to escape these: * \_ `
158
162
  </pre>
159
- </td>
160
- <td width=50% bgcolor=#eeeeee valign=top>
161
- <pre> Here are examples of <b>boldface</b>
163
+ </td>
164
+ <td width=50% bgcolor=#eeeeee valign=top>
165
+ <pre> Here are examples of <b>boldface</b>
162
166
  and <i>italics</i>
163
167
  and <font size=+1><tt>code</tt></font>
164
168
  as well as <b>more complex</b> examples
@@ -172,13 +176,11 @@ Most of this is summarized in this example (taken from one of the testcases):
172
176
 
173
177
  No need to escape these: * \_ `
174
178
  </pre>
175
- </td>
176
- </tr>
177
- </table>
178
- </font>
179
+ </td>
180
+ </tr>
181
+ </table>
182
+ </font>
179
183
  <br>
180
- <p>
181
-
182
184
  ### Standard methods
183
185
  The module <font size=+1><tt>Livetext::Standard</tt></font> contains the set of standard or predefined methods. Their
184
186
  names are essentially the same as the names of the dot-commands, with occasional exceptions.
@@ -268,38 +270,38 @@ Here are some tests from the suite. The file name reflects the general purpose o
268
270
 
269
271
 
270
272
  <font size=+1><b>Test: </font><font size=+2><tt>hello_world</tt></font></b></h3><br>
271
- <font size=+1>
272
- <table width=80% cellpadding=4>
273
- <tr>
274
- <td width=50%><b>Input</b></td>
275
- <td width=50%><b>Output</b></td>
276
- </tr>
277
- <tr>
278
- <td width=50% bgcolor=#fee0fe valign=top>
279
- <pre> Hello,
273
+ <font size=+1>
274
+ <table width=80% cellpadding=4>
275
+ <tr>
276
+ <td width=50%><b>Input</b></td>
277
+ <td width=50%><b>Output</b></td>
278
+ </tr>
279
+ <tr>
280
+ <td width=50% bgcolor=#fee0fe valign=top>
281
+ <pre> Hello,
280
282
  world!
281
283
  </pre>
282
- </td>
283
- <td width=50% bgcolor=#eeeeee valign=top>
284
- <pre> Hello,
284
+ </td>
285
+ <td width=50% bgcolor=#eeeeee valign=top>
286
+ <pre> Hello,
285
287
  world!
286
288
  </pre>
287
- </td>
288
- </tr>
289
- </table>
290
- </font>
289
+ </td>
290
+ </tr>
291
+ </table>
292
+ </font>
291
293
  <br>
292
294
 
293
295
  <font size=+1><b>Test: </font><font size=+2><tt>comments_ignored_1</tt></font></b></h3><br>
294
- <font size=+1>
295
- <table width=80% cellpadding=4>
296
- <tr>
297
- <td width=50%><b>Input</b></td>
298
- <td width=50%><b>Output</b></td>
299
- </tr>
300
- <tr>
301
- <td width=50% bgcolor=#fee0fe valign=top>
302
- <pre> . Comments are ignored
296
+ <font size=+1>
297
+ <table width=80% cellpadding=4>
298
+ <tr>
299
+ <td width=50%><b>Input</b></td>
300
+ <td width=50%><b>Output</b></td>
301
+ </tr>
302
+ <tr>
303
+ <td width=50% bgcolor=#fee0fe valign=top>
304
+ <pre> . Comments are ignored
303
305
  abc 123
304
306
  this is a test
305
307
  . whether at beginning, middle, or
@@ -307,29 +309,29 @@ Here are some tests from the suite. The file name reflects the general purpose o
307
309
  still more stuff
308
310
  . end of the file
309
311
  </pre>
310
- </td>
311
- <td width=50% bgcolor=#eeeeee valign=top>
312
- <pre> abc 123
312
+ </td>
313
+ <td width=50% bgcolor=#eeeeee valign=top>
314
+ <pre> abc 123
313
315
  this is a test
314
316
  more stuff
315
317
  still more stuff
316
318
  </pre>
317
- </td>
318
- </tr>
319
- </table>
320
- </font>
319
+ </td>
320
+ </tr>
321
+ </table>
322
+ </font>
321
323
  <br>
322
324
 
323
325
  <font size=+1><b>Test: </font><font size=+2><tt>block_comment</tt></font></b></h3><br>
324
- <font size=+1>
325
- <table width=80% cellpadding=4>
326
- <tr>
327
- <td width=50%><b>Input</b></td>
328
- <td width=50%><b>Output</b></td>
329
- </tr>
330
- <tr>
331
- <td width=50% bgcolor=#fee0fe valign=top>
332
- <pre> .comment
326
+ <font size=+1>
327
+ <table width=80% cellpadding=4>
328
+ <tr>
329
+ <td width=50%><b>Input</b></td>
330
+ <td width=50%><b>Output</b></td>
331
+ </tr>
332
+ <tr>
333
+ <td width=50% bgcolor=#fee0fe valign=top>
334
+ <pre> .comment
333
335
  This is
334
336
  a comment
335
337
  .end
@@ -349,107 +351,106 @@ Here are some tests from the suite. The file name reflects the general purpose o
349
351
  .end
350
352
 
351
353
  </pre>
352
- </td>
353
- <td width=50% bgcolor=#eeeeee valign=top>
354
- <pre> abc 123
354
+ </td>
355
+ <td width=50% bgcolor=#eeeeee valign=top>
356
+ <pre> abc 123
355
357
  xyz
356
358
  one
357
359
  more
358
360
  time
359
361
  </pre>
360
- </td>
361
- </tr>
362
- </table>
363
- </font>
362
+ </td>
363
+ </tr>
364
+ </table>
365
+ </font>
364
366
  <br>
365
367
 
366
368
  <font size=+1><b>Test: </font><font size=+2><tt>def_method</tt></font></b></h3><br>
367
- <font size=+1>
368
- <table width=80% cellpadding=4>
369
- <tr>
370
- <td width=50%><b>Input</b></td>
371
- <td width=50%><b>Output</b></td>
372
- </tr>
373
- <tr>
374
- <td width=50% bgcolor=#fee0fe valign=top>
375
- <pre> .backtrace
369
+ <font size=+1>
370
+ <table width=80% cellpadding=4>
371
+ <tr>
372
+ <td width=50%><b>Input</b></td>
373
+ <td width=50%><b>Output</b></td>
374
+ </tr>
375
+ <tr>
376
+ <td width=50% bgcolor=#fee0fe valign=top>
377
+ <pre> .backtrace
376
378
  abc
377
379
  123
378
- .def foobar
380
+ .def foobar # yet another experimental comment
379
381
  ::STDERR.puts "This is the"
380
382
  ::STDERR.puts "foobar method"
381
383
  .end
382
384
  xyz
383
- .foobar
385
+ .foobar # and still another
384
386
  xyzzy
385
387
  123
386
388
  </pre>
387
- </td>
388
- <td width=50% bgcolor=#eeeeee valign=top>
389
- <pre> abc
389
+ </td>
390
+ <td width=50% bgcolor=#eeeeee valign=top>
391
+ <pre> abc
390
392
  123
391
393
  xyz
392
394
  xyzzy
393
395
  123
394
396
  </pre>
395
- </td>
396
- </tr>
397
- </table>
398
- </font>
397
+ </td>
398
+ </tr>
399
+ </table>
400
+ </font>
399
401
  <br>
400
402
 
401
403
  <font size=+1><b>Test: </font><font size=+2><tt>simple_vars</tt></font></b></h3><br>
402
- <font size=+1>
403
- <table width=80% cellpadding=4>
404
- <tr>
405
- <td width=50%><b>Input</b></td>
406
- <td width=50%><b>Output</b></td>
407
- </tr>
408
- <tr>
409
- <td width=50% bgcolor=#fee0fe valign=top>
410
- <pre> Just
404
+ <font size=+1>
405
+ <table width=80% cellpadding=4>
406
+ <tr>
407
+ <td width=50%><b>Input</b></td>
408
+ <td width=50%><b>Output</b></td>
409
+ </tr>
410
+ <tr>
411
+ <td width=50% bgcolor=#fee0fe valign=top>
412
+ <pre> Just
411
413
  some text.
412
414
  .set name=GulliverFoyle, nation=Terra
413
415
  Hi, there.
414
416
  $name is my name, and $nation is my nation.
415
- I'm $name, from $nation.
417
+ I'm $name, from $nation\.
416
418
  That's all.
417
419
  </pre>
418
- </td>
419
- <td width=50% bgcolor=#eeeeee valign=top>
420
- <pre> Just
420
+ </td>
421
+ <td width=50% bgcolor=#eeeeee valign=top>
422
+ <pre> Just
421
423
  some text.
422
424
  Hi, there.
423
425
  GulliverFoyle is my name, and Terra is my nation.
424
426
  I'm GulliverFoyle, from Terra.
425
427
  That's all.
426
428
  </pre>
427
- </td>
428
- </tr>
429
- </table>
430
- </font>
429
+ </td>
430
+ </tr>
431
+ </table>
432
+ </font>
431
433
  <br>
432
434
 
433
435
  <font size=+1><b>Test: </font><font size=+2><tt>simple_include</tt></font></b></h3><br>
434
- <font size=+1>
435
- <table width=80% cellpadding=4>
436
- <tr>
437
- <td width=50%><b>Input</b></td>
438
- <td width=50%><b>Output</b></td>
439
- </tr>
440
- <tr>
441
- <td width=50% bgcolor=#fee0fe valign=top>
442
- <pre> Here I am
443
- .debug
436
+ <font size=+1>
437
+ <table width=80% cellpadding=4>
438
+ <tr>
439
+ <td width=50%><b>Input</b></td>
440
+ <td width=50%><b>Output</b></td>
441
+ </tr>
442
+ <tr>
443
+ <td width=50% bgcolor=#fee0fe valign=top>
444
+ <pre> Here I am
444
445
  trying to
445
446
  include
446
447
  .include simplefile.inc
447
448
  I hope that
448
449
  worked.
449
450
  </pre>
450
- </td>
451
- <td width=50% bgcolor=#eeeeee valign=top>
452
- <pre> Here I am
451
+ </td>
452
+ <td width=50% bgcolor=#eeeeee valign=top>
453
+ <pre> Here I am
453
454
  trying to
454
455
  include
455
456
  a simple
@@ -457,61 +458,61 @@ Here are some tests from the suite. The file name reflects the general purpose o
457
458
  I hope that
458
459
  worked.
459
460
  </pre>
460
- </td>
461
- </tr>
462
- </table>
463
- </font>
461
+ </td>
462
+ </tr>
463
+ </table>
464
+ </font>
464
465
  <br>
465
466
 
466
467
  <font size=+1><b>Test: </font><font size=+2><tt>simple_mixin</tt></font></b></h3><br>
467
- <font size=+1>
468
- <table width=80% cellpadding=4>
469
- <tr>
470
- <td width=50%><b>Input</b></td>
471
- <td width=50%><b>Output</b></td>
472
- </tr>
473
- <tr>
474
- <td width=50% bgcolor=#fee0fe valign=top>
475
- <pre> Here I am
468
+ <font size=+1>
469
+ <table width=80% cellpadding=4>
470
+ <tr>
471
+ <td width=50%><b>Input</b></td>
472
+ <td width=50%><b>Output</b></td>
473
+ </tr>
474
+ <tr>
475
+ <td width=50% bgcolor=#fee0fe valign=top>
476
+ <pre> Here I am
476
477
  testing a simple mixin
477
478
  .mixin simple\_mixin
478
- Now call it:
479
+ Now call a method:
479
480
  .hello\_world
480
481
  That's all.
481
482
  </pre>
482
- </td>
483
- <td width=50% bgcolor=#eeeeee valign=top>
484
- <pre> Here I am
483
+ </td>
484
+ <td width=50% bgcolor=#eeeeee valign=top>
485
+ <pre> Here I am
485
486
  testing a simple mixin
486
- Now call it:
487
+ Now call a method:
487
488
  Hello, world.
488
489
  That's all.
489
490
  </pre>
490
- </td>
491
- </tr>
492
- </table>
493
- </font>
491
+ </td>
492
+ </tr>
493
+ </table>
494
+ </font>
494
495
  <br>
495
496
 
496
497
  <font size=+1><b>Test: </font><font size=+2><tt>simple_copy</tt></font></b></h3><br>
497
- <font size=+1>
498
- <table width=80% cellpadding=4>
499
- <tr>
500
- <td width=50%><b>Input</b></td>
501
- <td width=50%><b>Output</b></td>
502
- </tr>
503
- <tr>
504
- <td width=50% bgcolor=#fee0fe valign=top>
505
- <pre> The copy command
498
+ <font size=+1>
499
+ <table width=80% cellpadding=4>
500
+ <tr>
501
+ <td width=50%><b>Input</b></td>
502
+ <td width=50%><b>Output</b></td>
503
+ </tr>
504
+ <tr>
505
+ <td width=50% bgcolor=#fee0fe valign=top>
506
+ <pre> The copy command
506
507
  copies any file
507
508
  without interpretation,
508
509
  such as:
509
510
  .copy simplefile.inc
510
511
  That is all.
511
512
  </pre>
512
- </td>
513
- <td width=50% bgcolor=#eeeeee valign=top>
514
- <pre> The copy command
513
+ </td>
514
+ <td width=50% bgcolor=#eeeeee valign=top>
515
+ <pre> The copy command
515
516
  copies any file
516
517
  without interpretation,
517
518
  such as:
@@ -519,29 +520,29 @@ Here are some tests from the suite. The file name reflects the general purpose o
519
520
  include file.
520
521
  That is all.
521
522
  </pre>
522
- </td>
523
- </tr>
524
- </table>
525
- </font>
523
+ </td>
524
+ </tr>
525
+ </table>
526
+ </font>
526
527
  <br>
527
528
 
528
529
  <font size=+1><b>Test: </font><font size=+2><tt>copy_is_raw</tt></font></b></h3><br>
529
- <font size=+1>
530
- <table width=80% cellpadding=4>
531
- <tr>
532
- <td width=50%><b>Input</b></td>
533
- <td width=50%><b>Output</b></td>
534
- </tr>
535
- <tr>
536
- <td width=50% bgcolor=#fee0fe valign=top>
537
- <pre> A copy command
530
+ <font size=+1>
531
+ <table width=80% cellpadding=4>
532
+ <tr>
533
+ <td width=50%><b>Input</b></td>
534
+ <td width=50%><b>Output</b></td>
535
+ </tr>
536
+ <tr>
537
+ <td width=50% bgcolor=#fee0fe valign=top>
538
+ <pre> A copy command
538
539
  does not interpret its input:
539
- .copy rawtext.inc
540
+ .copy rawtext.inc # another useless comment
540
541
  That's all.
541
542
  </pre>
542
- </td>
543
- <td width=50% bgcolor=#eeeeee valign=top>
544
- <pre> A copy command
543
+ </td>
544
+ <td width=50% bgcolor=#eeeeee valign=top>
545
+ <pre> A copy command
545
546
  does not interpret its input:
546
547
  This is not a comment:
547
548
  .comment woohoo!
@@ -549,22 +550,23 @@ Here are some tests from the suite. The file name reflects the general purpose o
549
550
  .no\_such\_method
550
551
  That's all.
551
552
  </pre>
552
- </td>
553
- </tr>
554
- </table>
555
- </font>
553
+ </td>
554
+ </tr>
555
+ </table>
556
+ </font>
556
557
  <br>
557
558
 
558
559
  <font size=+1><b>Test: </font><font size=+2><tt>raw_text_block</tt></font></b></h3><br>
559
- <font size=+1>
560
- <table width=80% cellpadding=4>
561
- <tr>
562
- <td width=50%><b>Input</b></td>
563
- <td width=50%><b>Output</b></td>
564
- </tr>
565
- <tr>
566
- <td width=50% bgcolor=#fee0fe valign=top>
567
- <pre> This text block will be passed thru
560
+ <font size=+1>
561
+ <table width=80% cellpadding=4>
562
+ <tr>
563
+ <td width=50%><b>Input</b></td>
564
+ <td width=50%><b>Output</b></td>
565
+ </tr>
566
+ <tr>
567
+ <td width=50% bgcolor=#fee0fe valign=top>
568
+ <pre> .backtrace
569
+ This text block will be passed thru
568
570
  with no interpretation or processing:
569
571
  .raw
570
572
  .comment
@@ -583,9 +585,9 @@ Here are some tests from the suite. The file name reflects the general purpose o
583
585
  *(gamma rays)
584
586
  \_\_EOF\_\_
585
587
  </pre>
586
- </td>
587
- <td width=50% bgcolor=#eeeeee valign=top>
588
- <pre> This text block will be passed thru
588
+ </td>
589
+ <td width=50% bgcolor=#eeeeee valign=top>
590
+ <pre> This text block will be passed thru
589
591
  with no interpretation or processing:
590
592
  .comment
591
593
  This isn't a
@@ -602,13 +604,11 @@ Here are some tests from the suite. The file name reflects the general purpose o
602
604
  \_(beta max)
603
605
  *(gamma rays)
604
606
  </pre>
605
- </td>
606
- </tr>
607
- </table>
608
- </font>
607
+ </td>
608
+ </tr>
609
+ </table>
610
+ </font>
609
611
  <br>
610
- <p>
611
-
612
612
  ### Writing custom methods
613
613
  Suppose you wanted to write a method called <font size=+1><tt>chapter</tt></font> that would simply
614
614
  output a chapter number and title with certain heading tags and a
@@ -687,7 +687,7 @@ What are some other helper methods? Here's a list.
687
687
  </tr>
688
688
  <tr>
689
689
  <td valign=top><font size=+1><tt>_body</tt></font> </td>
690
- <td valign=top> Returns a string (or enumerator) giving access to the text block (preceding <font size=+1><tt></tt></font>.end)</td>
690
+ <td valign=top> Returns a string (or enumerator) giving access to the text block (preceding .end)</td>
691
691
  </tr>
692
692
  <tr>
693
693
  <td valign=top><font size=+1><tt>_puts</tt></font> </td>
@@ -718,18 +718,18 @@ in the test suite.
718
718
 
719
719
 
720
720
  <font size=+1><b>Test: </font><font size=+2><tt>example_alpha</tt></font></b></h3><br>
721
- <font size=+1>
722
- <table width=80% cellpadding=4>
723
- <tr>
724
- <td width=50%><b>Input</b></td>
725
- <td width=50%><b>Output</b></td>
726
- </tr>
727
- <tr>
728
- <td width=50% bgcolor=#fee0fe valign=top>
729
- <pre> .def alpha
721
+ <font size=+1>
722
+ <table width=80% cellpadding=4>
723
+ <tr>
724
+ <td width=50%><b>Input</b></td>
725
+ <td width=50%><b>Output</b></td>
726
+ </tr>
727
+ <tr>
728
+ <td width=50% bgcolor=#fee0fe valign=top>
729
+ <pre> .def alpha
730
730
  text = \_body.to\_a.join(" ")
731
731
  words = text.split.sort
732
- words.each {|w| \_puts " #{w}" }
732
+ words.each {|w| \_out " #{w}" }
733
733
  .end
734
734
  Here is an alphabetized list:
735
735
 
@@ -743,9 +743,9 @@ in the test suite.
743
743
 
744
744
  That's all.
745
745
  </pre>
746
- </td>
747
- <td width=50% bgcolor=#eeeeee valign=top>
748
- <pre> Here is an alphabetized list:
746
+ </td>
747
+ <td width=50% bgcolor=#eeeeee valign=top>
748
+ <pre> Here is an alphabetized list:
749
749
  <p>
750
750
 
751
751
  aardvark
@@ -769,38 +769,36 @@ in the test suite.
769
769
 
770
770
  That's all.
771
771
  </pre>
772
- </td>
773
- </tr>
774
- </table>
775
- </font>
772
+ </td>
773
+ </tr>
774
+ </table>
775
+ </font>
776
776
  <br>
777
- <p>
778
-
779
777
  I'll let that code stand on its own. Now suppose you wanted to allow columnar output. Let's
780
778
  have the user specify a number of columns (from 1 to 5, defaulting to 1).
781
779
  <p>
782
780
 
783
781
 
784
782
  <font size=+1><b>Test: </font><font size=+2><tt>example_alpha2</tt></font></b></h3><br>
785
- <font size=+1>
786
- <table width=80% cellpadding=4>
787
- <tr>
788
- <td width=50%><b>Input</b></td>
789
- <td width=50%><b>Output</b></td>
790
- </tr>
791
- <tr>
792
- <td width=50% bgcolor=#fee0fe valign=top>
793
- <pre> .def alpha
783
+ <font size=+1>
784
+ <table width=80% cellpadding=4>
785
+ <tr>
786
+ <td width=50%><b>Input</b></td>
787
+ <td width=50%><b>Output</b></td>
788
+ </tr>
789
+ <tr>
790
+ <td width=50% bgcolor=#fee0fe valign=top>
791
+ <pre> .def alpha
794
792
  cols = \_args.first
795
793
  cols = "1" if cols == ""
796
794
  cols = cols.to\_i
797
795
  raise "Columns must be 1-5" unless cols.between?(1,5)
798
- text = \_body\_text
796
+ text = \_body.join("\n")
799
797
  text.gsub!(/\n/, " ")
800
798
  words = text.split.sort
801
799
  words.each\_slice(cols) do |row|
802
- row.each {|w| \_print '%-15s' % w }
803
- \_puts
800
+ row.each {|w| \_out! '%-15s' % w }
801
+ \_out
804
802
  end
805
803
  .end
806
804
  Here is an alphabetized list:
@@ -815,9 +813,9 @@ have the user specify a number of columns (from 1 to 5, defaulting to 1).
815
813
 
816
814
  And that is all.
817
815
  </pre>
818
- </td>
819
- <td width=50% bgcolor=#eeeeee valign=top>
820
- <pre> Here is an alphabetized list:
816
+ </td>
817
+ <td width=50% bgcolor=#eeeeee valign=top>
818
+ <pre> Here is an alphabetized list:
821
819
  <p>
822
820
 
823
821
  aardvark anamorphic anarchist
@@ -830,13 +828,11 @@ have the user specify a number of columns (from 1 to 5, defaulting to 1).
830
828
 
831
829
  And that is all.
832
830
  </pre>
833
- </td>
834
- </tr>
835
- </table>
836
- </font>
831
+ </td>
832
+ </tr>
833
+ </table>
834
+ </font>
837
835
  <br>
838
- <p>
839
-
840
836
  What if we wanted to store the code outside the text file? There is more than one way to
841
837
  do this.
842
838
  <p>
@@ -851,12 +847,12 @@ in here (and nothing else).
851
847
  def alpha
852
848
  cols = &lt;i&gt;args.first&lt;/i&gt;
853
849
  cols = &quot;1&quot; if cols == &quot;&quot;
854
- cols = cols.to&lt;i&gt;i&lt;/i&gt;
850
+ cols = cols.to_i
855
851
  raise &quot;Columns must be 1-5&quot; unless cols.between?(1,5)
856
852
  text = &lt;i&gt;body.join&lt;/i&gt;
857
- text.gsub!(/\n/, &quot; &quot;)
853
+ text.gsub!(/n/, &quot; &quot;)
858
854
  words = text.split.sort
859
- words.each&lt;i&gt;slice(cols)&lt;/i&gt; do |row|
855
+ words.each_slice(cols) do |row|
860
856
  row.each {|w| &lt;i&gt;print&lt;/i&gt; &#39;%-15s&#39; % w }
861
857
  &lt;i&gt;puts&lt;/i&gt;
862
858
  end
@@ -881,77 +877,73 @@ The output, of course, is the same.
881
877
  <p>
882
878
 
883
879
  You can define variables in Livetext, defined with <font size=+1><tt>.set</tt></font> and
884
- referenced with a <font size=+1><tt>$</tt></font>. Later there will be a few predefined
880
+ referenced with a <font size=+1><tt>$$</tt></font>. Later there will be a few predefined
885
881
  variables. Variables are just string values.
886
882
  <p>
887
883
 
888
884
 
889
885
  <font size=+1><b>Test: </font><font size=+2><tt>simple_vars</tt></font></b></h3><br>
890
- <font size=+1>
891
- <table width=80% cellpadding=4>
892
- <tr>
893
- <td width=50%><b>Input</b></td>
894
- <td width=50%><b>Output</b></td>
895
- </tr>
896
- <tr>
897
- <td width=50% bgcolor=#fee0fe valign=top>
898
- <pre> Just
886
+ <font size=+1>
887
+ <table width=80% cellpadding=4>
888
+ <tr>
889
+ <td width=50%><b>Input</b></td>
890
+ <td width=50%><b>Output</b></td>
891
+ </tr>
892
+ <tr>
893
+ <td width=50% bgcolor=#fee0fe valign=top>
894
+ <pre> Just
899
895
  some text.
900
896
  .set name=GulliverFoyle, nation=Terra
901
897
  Hi, there.
902
898
  $name is my name, and $nation is my nation.
903
- I'm $name, from $nation.
899
+ I'm $name, from $nation\.
904
900
  That's all.
905
901
  </pre>
906
- </td>
907
- <td width=50% bgcolor=#eeeeee valign=top>
908
- <pre> Just
902
+ </td>
903
+ <td width=50% bgcolor=#eeeeee valign=top>
904
+ <pre> Just
909
905
  some text.
910
906
  Hi, there.
911
907
  GulliverFoyle is my name, and Terra is my nation.
912
908
  I'm GulliverFoyle, from Terra.
913
909
  That's all.
914
910
  </pre>
915
- </td>
916
- </tr>
917
- </table>
918
- </font>
911
+ </td>
912
+ </tr>
913
+ </table>
914
+ </font>
919
915
  <br>
920
- <p>
921
-
922
916
  If a variable needs to contain spaces, you can double-quote it.
923
917
  <p>
924
918
 
925
919
 
926
920
  <font size=+1><b>Test: </font><font size=+2><tt>more_complex_vars</tt></font></b></h3><br>
927
- <font size=+1>
928
- <table width=80% cellpadding=4>
929
- <tr>
930
- <td width=50%><b>Input</b></td>
931
- <td width=50%><b>Output</b></td>
932
- </tr>
933
- <tr>
934
- <td width=50% bgcolor=#fee0fe valign=top>
935
- <pre> Just some more text.
921
+ <font size=+1>
922
+ <table width=80% cellpadding=4>
923
+ <tr>
924
+ <td width=50%><b>Input</b></td>
925
+ <td width=50%><b>Output</b></td>
926
+ </tr>
927
+ <tr>
928
+ <td width=50% bgcolor=#fee0fe valign=top>
929
+ <pre> Just some more text.
936
930
  .set bday="May 31", date="5/31"
937
931
  My birthday is $bday, so they tell me.
938
932
  That's $date if you're American.
939
933
  That's all.
940
934
  </pre>
941
- </td>
942
- <td width=50% bgcolor=#eeeeee valign=top>
943
- <pre> Just some more text.
935
+ </td>
936
+ <td width=50% bgcolor=#eeeeee valign=top>
937
+ <pre> Just some more text.
944
938
  My birthday is May 31, so they tell me.
945
939
  That's 5/31 if you're American.
946
940
  That's all.
947
941
  </pre>
948
- </td>
949
- </tr>
950
- </table>
951
- </font>
942
+ </td>
943
+ </tr>
944
+ </table>
945
+ </font>
952
946
  <br>
953
- <p>
954
-
955
947
  Livetext permits user-defined functions (as well as defining a few
956
948
  predefined ones). Call a function with <font size=+1><tt>$$</tt></font> and (if applicable) pass
957
949
  a single string parameter between brackets.
@@ -959,20 +951,20 @@ a single string parameter between brackets.
959
951
 
960
952
 
961
953
  <font size=+1><b>Test: </font><font size=+2><tt>functions</tt></font></b></h3><br>
962
- <font size=+1>
963
- <table width=80% cellpadding=4>
964
- <tr>
965
- <td width=50%><b>Input</b></td>
966
- <td width=50%><b>Output</b></td>
967
- </tr>
968
- <tr>
969
- <td width=50% bgcolor=#fee0fe valign=top>
970
- <pre> Testing out
954
+ <font size=+1>
955
+ <table width=80% cellpadding=4>
956
+ <tr>
957
+ <td width=50%><b>Input</b></td>
958
+ <td width=50%><b>Output</b></td>
959
+ </tr>
960
+ <tr>
961
+ <td width=50% bgcolor=#fee0fe valign=top>
962
+ <pre> Testing out
971
963
  some functions
972
964
  here...
973
965
 
974
966
  .func myfunc
975
- "Eureka!"
967
+ "Eureka!"
976
968
  .end
977
969
 
978
970
  I am calling $$myfunc here...
@@ -983,8 +975,7 @@ a single string parameter between brackets.
983
975
  (which it can parse itself as needed):
984
976
 
985
977
  .func mean
986
- list = self.class.param
987
- list = list.split(",").map(&:to\_f)
978
+ list = param.split(",").map(&:to\_f)
988
979
  sum = list.inject(0, :+)
989
980
  avg = sum / list.size.to\_f
990
981
  avg.to\_s
@@ -995,9 +986,9 @@ a single string parameter between brackets.
995
986
  Some functions like date and time are predefined.
996
987
 
997
988
  </pre>
998
- </td>
999
- <td width=50% bgcolor=#eeeeee valign=top>
1000
- <pre> Testing out
989
+ </td>
990
+ <td width=50% bgcolor=#eeeeee valign=top>
991
+ <pre> Testing out
1001
992
  some functions
1002
993
  here...
1003
994
  <p>
@@ -1018,13 +1009,11 @@ a single string parameter between brackets.
1018
1009
  <p>
1019
1010
 
1020
1011
  </pre>
1021
- </td>
1022
- </tr>
1023
- </table>
1024
- </font>
1012
+ </td>
1013
+ </tr>
1014
+ </table>
1015
+ </font>
1025
1016
  <br>
1026
- <p>
1027
-
1028
1017
  There is an important feature that has not yet been implemented (the
1029
1018
  <font size=+1><tt>require</tt></font> method). Like Ruby's <font size=+1><tt>require</tt></font>, it will grab Ruby code and
1030
1019
  load it; however, unlike <font size=+1><tt>mixin</tt></font>, it will load it into a customized
@@ -1039,52 +1028,54 @@ on that new custom object. I plan to implement this later.
1039
1028
  This list is not prioritized yet.
1040
1029
  <p>
1041
1030
 
1042
- 1. <strike>Add versioning information </strike>
1043
- 2. <strike>Clean up code structure</strike>
1044
- 3. Add RDoc
1045
- 4. <strike>Think about command line executable</strike>
1046
- 5. <strike>Write as pure library in addition to executable</strike>
1047
- 6. <strike>Package as gem</strike>
1048
- 7. Document: <font size=+1><tt>require</tt></font> <font size=+1><tt>include</tt></font> <font size=+1><tt>copy</tt></font> <font size=+1><tt>mixin</tt></font> <font size=+1><tt>errout</tt></font> and others
1049
- 8. Need <strike>much</strike> better error checking and corresponding tests
1050
- 9. Worry about nesting of elements (probably mostly disallow)
1051
- 10. Think about UTF-8
1052
- 11. Document API fully
1053
- 12. Add <font size=+1><tt><i>raw_args</tt></font></i> and let <font size=+1><tt><i>args</tt></font></i> honor quotes
1054
- 13. Support quotes in <font size=+1><tt>.set</tt></font> values
1055
- 14. Support "namespaced" variables (<font size=+1><tt>.set code.font="whatever"</tt></font>)
1056
- 15. <strike>Support functions (<font size=+1><tt>$$func</tt></font>) </strike>
1057
- 16. Support function namespacing
1058
- 17. Create predefined variables (e.g., <font size=+1><tt>$<i>source_file</tt></font>,</i> <font size=+1><tt>$[<i>line])</tt></font></i>
1059
- 18. Create predefined functions (e.g., <font size=+1><tt>$$<i>date</tt></font>)</i>
1060
- 19. More support for markdown
1061
- 20. Allow turning on/off: formatting, variable interpolation, function interpolation?
1062
- 21. <font size=+1><tt>.require</tt></font> with file and sigil parameters
1063
- 22. Investigate "common intermediate format" - output renderers all read it
1064
- 23. Comments passed through (e.g. as HTML comments)
1065
- 24. <font size=+1><tt>.run</tt></font> to execute arbitrary Ruby code inline?
1066
- 25. Concept of <font size=+1><tt>.proc</tt></font> (guaranteed to return no value, produce no output)?
1067
- 26. Exceptions??
1068
- 27. Ruby <font size=+1><tt>$SAFE</tt></font> levels?
1069
- 28. Warn when overriding existing names?
1070
- 29. Think about passing data in (erb replacement)
1071
- 30. <strike>]Allow</strike> custom ending tag on <font size=+1><tt>raw</tt></font> method
1072
- 31. <strike>Ignore first blank line after <font size=+1><tt>.end</strike>? (and after raw-tag?)</tt></font>
1073
- 32. Allow/encourage custom <font size=+1><tt>passthru</tt></font> method?
1074
- 33. Must have sane support for CSS
1075
- 34. Support for Pygments and/or other code processors
1076
- 35. Support for gists? arbitrary links? other remote resouces?
1077
- 36. Small libraries for special purposes (books? special Softcover support? blogs? PDF? RMagick?)
1078
- 37. Experiment with idea of special libraries having pluggable output formats (via Ruby mixin?)
1079
- 38. Imagining a lib that can run/test code fragments as part of document generation
1080
- 39. Create vim (emacs?) syntax files
1081
- 40. Someday: Support other languages (Elixir, Python, ...)
1082
- 41. <font size=+1><tt>.pry</tt></font> method?
1083
- 42. <font size=+1><tt>.irb</tt></font> method?
1084
- 43. Other debugging features
1085
- 44. Feature to "break" to EOF?
1086
- 45. <font size=+1><tt>.meth?</tt></font> method ending in <font size=+1><tt>?</tt></font> takes a block that may be processed or thrown away (<font size=+1><tt>.else</tt></font> perhaps?)
1087
- 46. <font size=+1><tt>.dump</tt></font> to dump all variables and their values
1088
- 47. <font size=+1><tt>.if</tt></font> and <font size=+1><tt>.else</tt></font>?
1089
- 48. Make any/all delimiters configurable
1090
- 49. HTML helper? (in their own library?)
1031
+ * <strike>Add versioning information </strike>
1032
+ * <strike>Clean up code structure</strike>
1033
+ * Add RDoc
1034
+ * <strike>Think about command line executable</strike>
1035
+ * <strike>Write as pure library in addition to executable</strike>
1036
+ * <strike>Package as gem</strike>
1037
+ * Document: <font size=+1><tt>require</tt></font> <font size=+1><tt>include</tt></font> <font size=+1><tt>copy</tt></font> <font size=+1><tt>mixin</tt></font> <font size=+1><tt>errout</tt></font> and others
1038
+ * Need <strike>much</strike> better error checking and corresponding tests
1039
+ * Worry about nesting of elements (probably mostly disallow)
1040
+ * Think about UTF-8
1041
+ * Document API fully
1042
+ * Add <font size=+1><tt>_raw_args</tt></font> and let <font size=+1><tt>_args</tt></font> honor quotes
1043
+ * Support quotes in <font size=+1><tt>.set</tt></font> values
1044
+ * Support "namespaced" variables (`[.set code.font="whatever"])
1045
+ * <strike>Support functions (``[func is undefined]$c)</strike>
1046
+ * Support function namespacing
1047
+ * Create predefined variables (e.g., <font size=+1><tt>[source_file is undefined]$</tt></font>, <font size=+1><tt>$_line])</tt></font>
1048
+ * Create predefined functions (e.g., <font size=+1><tt>$_date</tt></font>)
1049
+ * More support for markdown
1050
+ * Allow turning on/off: formatting, variable interpolation, function interpolation?
1051
+ * <font size=+1><tt>.require</tt></font> with file and sigil parameters
1052
+ * Investigate "common intermediate format" - output renderers all read it
1053
+ * Comments passed through (e.g. as HTML comments)
1054
+ * <font size=+1><tt>.run</tt></font> to execute arbitrary Ruby code inline?
1055
+ * Concept of <font size=+1><tt>.proc</tt></font> (guaranteed to return no value, produce no output)?
1056
+ * Exceptions??
1057
+ * Ruby <font size=+1><tt>[AFE is undefined]$</tt></font> levels?
1058
+ * Warn when overriding existing names?
1059
+ * Think about passing data in (erb replacement)
1060
+ * <strike>]Allow</strike> custom ending tag on <font size=+1><tt>raw</tt></font> method
1061
+ * <strike>Ignore first blank line after `[.end</strike>? (and after raw-tag?)
1062
+ * Allow/encourage custom <font size=+1><tt>passthru</tt></font> method?
1063
+ * Must have sane support for CSS
1064
+ * Support for Pygments and/or other code processors
1065
+ * Support for gists? arbitrary links? other remote resouces?
1066
+ * Small libraries for special purposes (books? special Softcover support? blogs? PDF? RMagick?)
1067
+ * Experiment with idea of special libraries having pluggable output formats (via Ruby mixin?)
1068
+ * Imagining a lib that can run/test code fragments as part of document generation
1069
+ * Create vim (emacs?) syntax files
1070
+ * Someday: Support other languages (Elixir, Python, ...)
1071
+ * <font size=+1><tt>.pry</tt></font> method?
1072
+ * <font size=+1><tt>.irb</tt></font> method?
1073
+ * Other debugging features
1074
+ * Feature to "break" to EOF?
1075
+ * <font size=+1><tt>.meth?</tt></font> method ending in <font size=+1><tt>?</tt></font> takes a block that may be processed or thrown away (`.else perhaps?)
1076
+ * <font size=+1><tt>.dump</tt></font> to dump all variables and their values
1077
+ * <font size=+1><tt>.if</tt></font> and <font size=+1><tt>.else</tt></font>?
1078
+ * Make any/all delimiters configurable
1079
+ * HTML helper? (in their own library?)
1080
+ <p>
1081
+