vedeu 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/examples/views/_interfaces.rb +127 -0
  3. data/examples/views/empty_template.rb +10 -0
  4. data/examples/views/expected/vedeu_full_screen.html +140 -0
  5. data/examples/views/expected/vedeu_full_screen.json +96050 -0
  6. data/examples/views/expected/vedeu_full_screen.out +1 -0
  7. data/examples/views/expected/vedeu_full_screen.txt +50 -0
  8. data/examples/views/expected/vedeu_line.html +140 -0
  9. data/examples/views/expected/vedeu_line.json +96050 -0
  10. data/examples/views/expected/vedeu_line.out +1 -0
  11. data/examples/views/expected/vedeu_line.txt +58 -0
  12. data/examples/views/expected/vedeu_lines.html +140 -0
  13. data/examples/views/expected/vedeu_lines.json +96050 -0
  14. data/examples/views/expected/{lines.out → vedeu_lines.out} +1 -1
  15. data/examples/views/expected/vedeu_lines_alignment.html +80 -0
  16. data/examples/views/expected/vedeu_lines_alignment.json +46370 -0
  17. data/examples/views/expected/vedeu_lines_alignment.out +1 -0
  18. data/examples/views/full_screen.rb +10 -0
  19. data/examples/views/line.rb +11 -106
  20. data/examples/views/lines.rb +8 -127
  21. data/examples/views/lines_alignment.rb +17 -125
  22. data/examples/views/runner.sh +65 -19
  23. data/lib/vedeu/borders/border.rb +6 -6
  24. data/lib/vedeu/borders/refresh.rb +4 -6
  25. data/lib/vedeu/buffers/buffer.rb +1 -1
  26. data/lib/vedeu/buffers/terminal.rb +4 -4
  27. data/lib/vedeu/buffers/view.rb +2 -2
  28. data/lib/vedeu/cells/all.rb +2 -2
  29. data/lib/vedeu/cells/border.rb +5 -0
  30. data/lib/vedeu/cells/borders/all.rb +2 -8
  31. data/lib/vedeu/cells/borders/edges/all.rb +6 -0
  32. data/lib/vedeu/cells/borders/{bottom_horizontal.rb → edges/bottom_horizontal.rb} +0 -0
  33. data/lib/vedeu/cells/borders/{left_vertical.rb → edges/left_vertical.rb} +0 -0
  34. data/lib/vedeu/cells/borders/{right_vertical.rb → edges/right_vertical.rb} +0 -0
  35. data/lib/vedeu/cells/borders/{top_horizontal.rb → edges/top_horizontal.rb} +0 -0
  36. data/lib/vedeu/cells/borders/horizontal.rb +5 -0
  37. data/lib/vedeu/cells/borders/vertical.rb +5 -0
  38. data/lib/vedeu/cells/borders/vertices/all.rb +6 -0
  39. data/lib/vedeu/cells/borders/{bottom_left.rb → vertices/bottom_left.rb} +5 -0
  40. data/lib/vedeu/cells/borders/{bottom_right.rb → vertices/bottom_right.rb} +5 -0
  41. data/lib/vedeu/cells/borders/{top_left.rb → vertices/top_left.rb} +5 -0
  42. data/lib/vedeu/cells/borders/{top_right.rb → vertices/top_right.rb} +5 -0
  43. data/lib/vedeu/cells/char.rb +16 -0
  44. data/lib/vedeu/cells/clear.rb +5 -0
  45. data/lib/vedeu/cells/cursor.rb +70 -0
  46. data/lib/vedeu/cells/empty.rb +24 -14
  47. data/lib/vedeu/cells/escape.rb +8 -7
  48. data/lib/vedeu/cells/support/all.rb +3 -0
  49. data/lib/vedeu/cells/support/html.rb +98 -0
  50. data/lib/vedeu/colours/background.rb +21 -1
  51. data/lib/vedeu/colours/colour.rb +10 -2
  52. data/lib/vedeu/colours/foreground.rb +21 -1
  53. data/lib/vedeu/colours/translator.rb +17 -24
  54. data/lib/vedeu/colours/validator.rb +9 -9
  55. data/lib/vedeu/configuration/api.rb +1 -1
  56. data/lib/vedeu/cursors/cursor.rb +5 -5
  57. data/lib/vedeu/dsl/elements.rb +22 -79
  58. data/lib/vedeu/dsl/string/text.rb +3 -3
  59. data/lib/vedeu/editor/cropper.rb +2 -2
  60. data/lib/vedeu/editor/cursor.rb +1 -1
  61. data/lib/vedeu/editor/document.rb +1 -1
  62. data/lib/vedeu/geometries/area/dimension.rb +1 -1
  63. data/lib/vedeu/geometries/position.rb +5 -2
  64. data/lib/vedeu/interfaces/clear.rb +5 -5
  65. data/lib/vedeu/models/row.rb +4 -3
  66. data/lib/vedeu/output/compressor.rb +7 -7
  67. data/lib/vedeu/output/output.rb +8 -13
  68. data/lib/vedeu/output/viewport.rb +1 -1
  69. data/lib/vedeu/presentation/background.rb +2 -2
  70. data/lib/vedeu/presentation/colour.rb +0 -4
  71. data/lib/vedeu/presentation/foreground.rb +2 -2
  72. data/lib/vedeu/presentation/style.rb +1 -1
  73. data/lib/vedeu/presentation/styles.rb +0 -3
  74. data/lib/vedeu/renderers/file.rb +10 -68
  75. data/lib/vedeu/renderers/html.rb +28 -96
  76. data/lib/vedeu/renderers/json.rb +15 -31
  77. data/lib/vedeu/renderers/options.rb +160 -14
  78. data/lib/vedeu/renderers/templates/html_renderer.vedeu +1 -0
  79. data/lib/vedeu/renderers/terminal.rb +16 -17
  80. data/lib/vedeu/renderers/text.rb +32 -41
  81. data/lib/vedeu/version.rb +1 -1
  82. data/lib/vedeu/views/all.rb +0 -2
  83. data/lib/vedeu/views/chars.rb +6 -3
  84. data/lib/vedeu/views/stream.rb +3 -2
  85. data/test/lib/vedeu/borders/caption_test.rb +17 -17
  86. data/test/lib/vedeu/borders/title_test.rb +12 -12
  87. data/test/lib/vedeu/cells/border_test.rb +6 -0
  88. data/test/lib/vedeu/cells/borders/{bottom_horizontal_test.rb → edges/bottom_horizontal_test.rb} +0 -0
  89. data/test/lib/vedeu/cells/borders/{left_vertical_test.rb → edges/left_vertical_test.rb} +0 -0
  90. data/test/lib/vedeu/cells/borders/{right_vertical_test.rb → edges/right_vertical_test.rb} +0 -0
  91. data/test/lib/vedeu/cells/borders/{top_horizontal_test.rb → edges/top_horizontal_test.rb} +0 -0
  92. data/test/lib/vedeu/cells/borders/horizontal_test.rb +6 -0
  93. data/test/lib/vedeu/cells/borders/vertical_test.rb +6 -0
  94. data/test/lib/vedeu/cells/borders/{bottom_left_test.rb → vertices/bottom_left_test.rb} +6 -0
  95. data/test/lib/vedeu/cells/borders/{bottom_right_test.rb → vertices/bottom_right_test.rb} +6 -0
  96. data/test/lib/vedeu/cells/borders/{top_left_test.rb → vertices/top_left_test.rb} +6 -0
  97. data/test/lib/vedeu/cells/borders/{top_right_test.rb → vertices/top_right_test.rb} +6 -0
  98. data/test/lib/vedeu/cells/char_test.rb +18 -0
  99. data/test/lib/vedeu/cells/clear_test.rb +6 -0
  100. data/test/lib/vedeu/cells/cursor_test.rb +113 -0
  101. data/test/lib/vedeu/cells/empty_test.rb +100 -7
  102. data/test/lib/vedeu/cells/escape_test.rb +29 -13
  103. data/test/lib/vedeu/cells/support/html_test.rb +100 -0
  104. data/test/lib/vedeu/colours/background_test.rb +35 -3
  105. data/test/lib/vedeu/colours/colour_test.rb +66 -0
  106. data/test/lib/vedeu/colours/foreground_test.rb +35 -3
  107. data/test/lib/vedeu/colours/translator_test.rb +0 -34
  108. data/test/lib/vedeu/colours/validator_test.rb +84 -6
  109. data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
  110. data/test/lib/vedeu/cursors/refresh_test.rb +4 -1
  111. data/test/lib/vedeu/dsl/string/text_test.rb +36 -36
  112. data/test/lib/vedeu/editor/cropper_test.rb +15 -15
  113. data/test/lib/vedeu/geometries/position_test.rb +14 -1
  114. data/test/lib/vedeu/models/page_test.rb +10 -10
  115. data/test/lib/vedeu/models/row_test.rb +7 -7
  116. data/test/lib/vedeu/output/compressor_test.rb +63 -50
  117. data/test/lib/vedeu/renderers/file_test.rb +64 -35
  118. data/test/lib/vedeu/renderers/html_test.rb +15 -12
  119. data/test/lib/vedeu/renderers/json_test.rb +79 -56
  120. data/test/lib/vedeu/renderers/options_test.rb +74 -26
  121. data/test/lib/vedeu/renderers/terminal_test.rb +34 -4
  122. data/test/lib/vedeu/renderers/text_test.rb +35 -3
  123. data/test/lib/vedeu/views/chars_test.rb +6 -0
  124. metadata +50 -41
  125. data/examples/views/expected/line.out +0 -1
  126. data/examples/views/expected/lines_alignment.out +0 -1
  127. data/lib/vedeu/cells/html.rb +0 -21
  128. data/lib/vedeu/cells/json.rb +0 -21
  129. data/lib/vedeu/views/char.rb +0 -180
  130. data/lib/vedeu/views/html_char.rb +0 -133
  131. data/test/lib/vedeu/cells/html_test.rb +0 -15
  132. data/test/lib/vedeu/cells/json_test.rb +0 -15
  133. data/test/lib/vedeu/views/char_test.rb +0 -283
  134. data/test/lib/vedeu/views/html_char_test.rb +0 -125
@@ -20,6 +20,12 @@ module Vedeu
20
20
  }
21
21
  }
22
22
 
23
+ it { described.superclass.must_equal(Vedeu::Repositories::Collection) }
24
+
25
+ describe '#initialize' do
26
+ it { instance.must_be_instance_of(described) }
27
+ end
28
+
23
29
  describe '.coerce' do
24
30
  subject { described.coerce(collection, parent, _name) }
25
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2016-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -469,10 +469,22 @@ files:
469
469
  - examples/dsl_horizontal_alignment.rb
470
470
  - examples/dsl_menus.rb
471
471
  - examples/dsl_vertical_alignment.rb
472
+ - examples/views/_interfaces.rb
472
473
  - examples/views/empty_template.rb
473
- - examples/views/expected/line.out
474
- - examples/views/expected/lines.out
475
- - examples/views/expected/lines_alignment.out
474
+ - examples/views/expected/vedeu_full_screen.html
475
+ - examples/views/expected/vedeu_full_screen.json
476
+ - examples/views/expected/vedeu_full_screen.out
477
+ - examples/views/expected/vedeu_full_screen.txt
478
+ - examples/views/expected/vedeu_line.html
479
+ - examples/views/expected/vedeu_line.json
480
+ - examples/views/expected/vedeu_line.out
481
+ - examples/views/expected/vedeu_line.txt
482
+ - examples/views/expected/vedeu_lines.html
483
+ - examples/views/expected/vedeu_lines.json
484
+ - examples/views/expected/vedeu_lines.out
485
+ - examples/views/expected/vedeu_lines_alignment.html
486
+ - examples/views/expected/vedeu_lines_alignment.json
487
+ - examples/views/expected/vedeu_lines_alignment.out
476
488
  - examples/views/full_screen.rb
477
489
  - examples/views/line.rb
478
490
  - examples/views/lines.rb
@@ -511,23 +523,26 @@ files:
511
523
  - lib/vedeu/cells/all.rb
512
524
  - lib/vedeu/cells/border.rb
513
525
  - lib/vedeu/cells/borders/all.rb
514
- - lib/vedeu/cells/borders/bottom_horizontal.rb
515
- - lib/vedeu/cells/borders/bottom_left.rb
516
- - lib/vedeu/cells/borders/bottom_right.rb
517
526
  - lib/vedeu/cells/borders/corner.rb
527
+ - lib/vedeu/cells/borders/edges/all.rb
528
+ - lib/vedeu/cells/borders/edges/bottom_horizontal.rb
529
+ - lib/vedeu/cells/borders/edges/left_vertical.rb
530
+ - lib/vedeu/cells/borders/edges/right_vertical.rb
531
+ - lib/vedeu/cells/borders/edges/top_horizontal.rb
518
532
  - lib/vedeu/cells/borders/horizontal.rb
519
- - lib/vedeu/cells/borders/left_vertical.rb
520
- - lib/vedeu/cells/borders/right_vertical.rb
521
- - lib/vedeu/cells/borders/top_horizontal.rb
522
- - lib/vedeu/cells/borders/top_left.rb
523
- - lib/vedeu/cells/borders/top_right.rb
524
533
  - lib/vedeu/cells/borders/vertical.rb
534
+ - lib/vedeu/cells/borders/vertices/all.rb
535
+ - lib/vedeu/cells/borders/vertices/bottom_left.rb
536
+ - lib/vedeu/cells/borders/vertices/bottom_right.rb
537
+ - lib/vedeu/cells/borders/vertices/top_left.rb
538
+ - lib/vedeu/cells/borders/vertices/top_right.rb
525
539
  - lib/vedeu/cells/char.rb
526
540
  - lib/vedeu/cells/clear.rb
541
+ - lib/vedeu/cells/cursor.rb
527
542
  - lib/vedeu/cells/empty.rb
528
543
  - lib/vedeu/cells/escape.rb
529
- - lib/vedeu/cells/html.rb
530
- - lib/vedeu/cells/json.rb
544
+ - lib/vedeu/cells/support/all.rb
545
+ - lib/vedeu/cells/support/html.rb
531
546
  - lib/vedeu/coercers/alignment.rb
532
547
  - lib/vedeu/coercers/all.rb
533
548
  - lib/vedeu/coercers/colour.rb
@@ -725,11 +740,9 @@ files:
725
740
  - lib/vedeu/terminal/terminal.rb
726
741
  - lib/vedeu/version.rb
727
742
  - lib/vedeu/views/all.rb
728
- - lib/vedeu/views/char.rb
729
743
  - lib/vedeu/views/chars.rb
730
744
  - lib/vedeu/views/composition.rb
731
745
  - lib/vedeu/views/default_attributes.rb
732
- - lib/vedeu/views/html_char.rb
733
746
  - lib/vedeu/views/line.rb
734
747
  - lib/vedeu/views/lines.rb
735
748
  - lib/vedeu/views/stream.rb
@@ -758,23 +771,23 @@ files:
758
771
  - test/lib/vedeu/buffers/terminal_test.rb
759
772
  - test/lib/vedeu/buffers/view_test.rb
760
773
  - test/lib/vedeu/cells/border_test.rb
761
- - test/lib/vedeu/cells/borders/bottom_horizontal_test.rb
762
- - test/lib/vedeu/cells/borders/bottom_left_test.rb
763
- - test/lib/vedeu/cells/borders/bottom_right_test.rb
764
774
  - test/lib/vedeu/cells/borders/corner_test.rb
775
+ - test/lib/vedeu/cells/borders/edges/bottom_horizontal_test.rb
776
+ - test/lib/vedeu/cells/borders/edges/left_vertical_test.rb
777
+ - test/lib/vedeu/cells/borders/edges/right_vertical_test.rb
778
+ - test/lib/vedeu/cells/borders/edges/top_horizontal_test.rb
765
779
  - test/lib/vedeu/cells/borders/horizontal_test.rb
766
- - test/lib/vedeu/cells/borders/left_vertical_test.rb
767
- - test/lib/vedeu/cells/borders/right_vertical_test.rb
768
- - test/lib/vedeu/cells/borders/top_horizontal_test.rb
769
- - test/lib/vedeu/cells/borders/top_left_test.rb
770
- - test/lib/vedeu/cells/borders/top_right_test.rb
771
780
  - test/lib/vedeu/cells/borders/vertical_test.rb
781
+ - test/lib/vedeu/cells/borders/vertices/bottom_left_test.rb
782
+ - test/lib/vedeu/cells/borders/vertices/bottom_right_test.rb
783
+ - test/lib/vedeu/cells/borders/vertices/top_left_test.rb
784
+ - test/lib/vedeu/cells/borders/vertices/top_right_test.rb
772
785
  - test/lib/vedeu/cells/char_test.rb
773
786
  - test/lib/vedeu/cells/clear_test.rb
787
+ - test/lib/vedeu/cells/cursor_test.rb
774
788
  - test/lib/vedeu/cells/empty_test.rb
775
789
  - test/lib/vedeu/cells/escape_test.rb
776
- - test/lib/vedeu/cells/html_test.rb
777
- - test/lib/vedeu/cells/json_test.rb
790
+ - test/lib/vedeu/cells/support/html_test.rb
778
791
  - test/lib/vedeu/coercers/alignment_test.rb
779
792
  - test/lib/vedeu/coercers/colour_attributes_test.rb
780
793
  - test/lib/vedeu/coercers/colour_test.rb
@@ -932,11 +945,9 @@ files:
932
945
  - test/lib/vedeu/templating/view_template_test.rb
933
946
  - test/lib/vedeu/terminal/mode_test.rb
934
947
  - test/lib/vedeu/terminal/terminal_test.rb
935
- - test/lib/vedeu/views/char_test.rb
936
948
  - test/lib/vedeu/views/chars_test.rb
937
949
  - test/lib/vedeu/views/composition_test.rb
938
950
  - test/lib/vedeu/views/default_attributes_test.rb
939
- - test/lib/vedeu/views/html_char_test.rb
940
951
  - test/lib/vedeu/views/line_test.rb
941
952
  - test/lib/vedeu/views/lines_test.rb
942
953
  - test/lib/vedeu/views/stream_test.rb
@@ -1010,23 +1021,23 @@ test_files:
1010
1021
  - test/lib/vedeu/buffers/terminal_test.rb
1011
1022
  - test/lib/vedeu/buffers/view_test.rb
1012
1023
  - test/lib/vedeu/cells/border_test.rb
1013
- - test/lib/vedeu/cells/borders/bottom_horizontal_test.rb
1014
- - test/lib/vedeu/cells/borders/bottom_left_test.rb
1015
- - test/lib/vedeu/cells/borders/bottom_right_test.rb
1016
1024
  - test/lib/vedeu/cells/borders/corner_test.rb
1025
+ - test/lib/vedeu/cells/borders/edges/bottom_horizontal_test.rb
1026
+ - test/lib/vedeu/cells/borders/edges/left_vertical_test.rb
1027
+ - test/lib/vedeu/cells/borders/edges/right_vertical_test.rb
1028
+ - test/lib/vedeu/cells/borders/edges/top_horizontal_test.rb
1017
1029
  - test/lib/vedeu/cells/borders/horizontal_test.rb
1018
- - test/lib/vedeu/cells/borders/left_vertical_test.rb
1019
- - test/lib/vedeu/cells/borders/right_vertical_test.rb
1020
- - test/lib/vedeu/cells/borders/top_horizontal_test.rb
1021
- - test/lib/vedeu/cells/borders/top_left_test.rb
1022
- - test/lib/vedeu/cells/borders/top_right_test.rb
1023
1030
  - test/lib/vedeu/cells/borders/vertical_test.rb
1031
+ - test/lib/vedeu/cells/borders/vertices/bottom_left_test.rb
1032
+ - test/lib/vedeu/cells/borders/vertices/bottom_right_test.rb
1033
+ - test/lib/vedeu/cells/borders/vertices/top_left_test.rb
1034
+ - test/lib/vedeu/cells/borders/vertices/top_right_test.rb
1024
1035
  - test/lib/vedeu/cells/char_test.rb
1025
1036
  - test/lib/vedeu/cells/clear_test.rb
1037
+ - test/lib/vedeu/cells/cursor_test.rb
1026
1038
  - test/lib/vedeu/cells/empty_test.rb
1027
1039
  - test/lib/vedeu/cells/escape_test.rb
1028
- - test/lib/vedeu/cells/html_test.rb
1029
- - test/lib/vedeu/cells/json_test.rb
1040
+ - test/lib/vedeu/cells/support/html_test.rb
1030
1041
  - test/lib/vedeu/coercers/alignment_test.rb
1031
1042
  - test/lib/vedeu/coercers/colour_attributes_test.rb
1032
1043
  - test/lib/vedeu/coercers/colour_test.rb
@@ -1184,11 +1195,9 @@ test_files:
1184
1195
  - test/lib/vedeu/templating/view_template_test.rb
1185
1196
  - test/lib/vedeu/terminal/mode_test.rb
1186
1197
  - test/lib/vedeu/terminal/terminal_test.rb
1187
- - test/lib/vedeu/views/char_test.rb
1188
1198
  - test/lib/vedeu/views/chars_test.rb
1189
1199
  - test/lib/vedeu/views/composition_test.rb
1190
1200
  - test/lib/vedeu/views/default_attributes_test.rb
1191
- - test/lib/vedeu/views/html_char_test.rb
1192
1201
  - test/lib/vedeu/views/line_test.rb
1193
1202
  - test/lib/vedeu/views/lines_test.rb
1194
1203
  - test/lib/vedeu/views/stream_test.rb
@@ -1 +0,0 @@
1
- (0l(B(0q(B Test 1 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0l(B(0q(B Test 2 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(Bview->line                   (0x(B(0x(Bview->line 1                 (0x(B(0x(B                             (0x(B(0x(Bview->line 2                 (0x(B(0x(B                             (0x(B(0x(B                             (0x(B(0x(B                             (0x(B(0x(B                             (0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(BA single line within a view.   Multiple lines within a view.                                 (No block)                                                                                   (0l(B(0q(B Test 3 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0l(B(0q(B Test 4 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(Bview->text 1                 (0x(B(0x(Bview->line 1->text           (0x(B(0x(Bview->text 2                 (0x(B(0x(Bview->line 2->text 1view->lin(0x(B(0x(B                             (0x(B(0x(B                             (0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(BMultiple `text` keywords withinLine `block` syntax.           a view are treated as separate A single `text` is just a      lines.                         stream within a line, whilst                                  multiple `text`s are treated                                  as separate streams.           (0l(B(0q(B Test 5 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(Bview->lines->line 1          (0x(B(0x(Bview->lines->line 2          (0x(B(0x(Bview->lines->line 3          (0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(BMultiple `line` keywords withina `lines` block view are       treated as separate lines.                                                                   
@@ -1 +0,0 @@
1
- (0l(B(0q(B Test 1 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0l(B(0q(B Test 2 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(Bview->line (align: :left)     (0x(B(0x(Bview->left                    (0x(B(0x(B view->line (align: :center)  (0x(B(0x(B         view->center         (0x(B(0x(B view->line (align: :centre)  (0x(B(0x(B         view->centre         (0x(B(0x(B    view->line (align: :right)(0x(B(0x(B                   view->right(0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B`:align` option on the `line`                                   DSL method. (no width or name                                   set)                                                                                                                                                                                            (0l(B(0q(B Test 3 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0l(B(0q(B Test 4 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(Bview->lines->left 1           (0x(B(0x(B          view->lines->right 1(0x(B(0x(Bview->lines->left 2           (0x(B(0x(B          view->lines->right 2(0x(B(0x(B                              (0x(B(0x(B                              (0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B                                                                                                                                                                                                                                                                                                                                (0l(B(0q(B Test 5 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0l(B(0q(B Test 6 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(B    view->lines->centre 1     (0x(B(0x(Bv->l->left         v->l->right(0x(B(0x(B    view->lines->centre 2     (0x(B(0x(B         v->l->centre         (0x(B(0x(B                              (0x(B(0x(B                              (0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B                                                                                                                                                                                                                                                                                                                                
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vedeu
4
-
5
- module Cells
6
-
7
- # Provides the character/escape sequence to draw one cell of a
8
- # with a custom value, colour and style.
9
- #
10
- # The Vedeu::Cells::HTML object represents a cell as a snippet
11
- # of HTML. A table cell perhaps: `<td>a</td>`.
12
- #
13
- # @api private
14
- #
15
- class HTML < Vedeu::Cells::Empty
16
-
17
- end # HTML
18
-
19
- end # Cells
20
-
21
- end # Vedeu
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vedeu
4
-
5
- module Cells
6
-
7
- # Provides the character/escape sequence to draw one cell of a
8
- # with a custom value, colour and style.
9
- #
10
- # The Vedeu::Cells::JSON object represents a cell as a snippet of
11
- # JSON.
12
- #
13
- # @api private
14
- #
15
- class JSON < Vedeu::Cells::Empty
16
-
17
- end # JSON
18
-
19
- end # Cells
20
-
21
- end # Vedeu
@@ -1,180 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'vedeu/geometries/positionable'
4
-
5
- module Vedeu
6
-
7
- module Views
8
-
9
- # A Char represents a single character of the terminal. It is a
10
- # container for the a single character in a
11
- # {Vedeu::Views::Stream}.
12
- #
13
- # Though a multi-character String can be passed as a value, only
14
- # the first character is returned in the escape sequence.
15
- #
16
- class Char
17
-
18
- include Comparable
19
- include Vedeu::Repositories::Parent
20
- include Vedeu::Presentation
21
-
22
- # @!attribute [rw] border
23
- # @return [NilClass|Symbol]
24
- attr_accessor :border
25
-
26
- # @!attribute [rw] name
27
- # @return [String|Symbol]
28
- attr_accessor :name
29
-
30
- # @!attribute [rw] parent
31
- # @return [Vedeu::Views::Line]
32
- attr_accessor :parent
33
-
34
- # @!attribute [w] value
35
- # @return [String]
36
- attr_writer :value
37
-
38
- # Returns a new instance of Vedeu::Views::Char.
39
- #
40
- # @param attributes [Hash]
41
- # @option attributes border [NilClass|Symbol]
42
- # A symbol representing the border 'piece' this
43
- # {Vedeu::Views::Char} represents.
44
- # @option attributes colour [Vedeu::Colours::Colour]
45
- # @option attributes name [String|Symbol]
46
- # @option attributes parent [Vedeu::Views::Line]
47
- # @option attributes position [Vedeu::Geometries::Position]
48
- # @option attributes style [Vedeu::Presentation::Style]
49
- # @option attributes value [String]
50
- # @return [Vedeu::Views::Char]
51
- def initialize(attributes = {})
52
- defaults.merge!(attributes).each do |key, value|
53
- instance_variable_set("@#{key}", value)
54
- end
55
- end
56
-
57
- # @return [Hash<Symbol => void>]
58
- def attributes
59
- {
60
- border: @border,
61
- colour: colour,
62
- name: @name,
63
- parent: @parent,
64
- position: position,
65
- style: @style,
66
- value: value,
67
- }
68
- end
69
-
70
- # @return [Boolean]
71
- def cell?
72
- false
73
- end
74
-
75
- # When {Vedeu::Output::Viewport#show} has less lines that
76
- # required to fill the visible area of the interface, it creates
77
- # a line that contains a single {Vedeu::Views::Char} containing
78
- # a space (0x20); later, attempts to call `#chars` on an
79
- # expected {Vedeu::Views::Line} and fail; this method fixes that.
80
- #
81
- # @return [Array]
82
- def chars
83
- []
84
- end
85
-
86
- # An object is equal when its values are the same.
87
- #
88
- # @param other [Vedeu::Views::Char]
89
- # @return [Boolean]
90
- def eql?(other)
91
- self.class == other.class && value == other.value &&
92
- position == other.position
93
- end
94
- alias_method :==, :eql?
95
-
96
- # @return [Vedeu::Interfaces::Interface]
97
- def interface
98
- @interface ||= Vedeu.interfaces.by_name(name)
99
- end
100
-
101
- # @return [String]
102
- def value
103
- return @value unless border
104
-
105
- Vedeu.esc.border { @value }
106
- end
107
-
108
- # @return [String]
109
- def text
110
- return ' ' if border
111
-
112
- @value
113
- end
114
-
115
- # Returns a Hash of all the values before coercion.
116
- #
117
- # @note
118
- # From this hash we should be able to construct a new instance
119
- # of {Vedeu::Views::Char}, however, at the moment, `:parent`
120
- # cannot be coerced.
121
- #
122
- # @return [Hash<Symbol => Hash, String>]
123
- def to_hash
124
- {
125
- border: border.to_s,
126
- colour: colour_to_hash,
127
- name: name.to_s,
128
- parent: parent_to_hash,
129
- position: position.to_h,
130
- style: style.to_s,
131
- value: value,
132
- }
133
- end
134
-
135
- # @param options [Hash<Symbol => String>]
136
- # See {Vedeu::Views::HTMLChar#initialize}
137
- # @return [String]
138
- def to_html(options = {})
139
- @to_html ||= Vedeu::Views::HTMLChar.render(self, options)
140
- end
141
-
142
- private
143
-
144
- # @return [Hash<Symbol => String>]
145
- def colour_to_hash
146
- {
147
- background: background.to_s,
148
- foreground: foreground.to_s,
149
- }
150
- end
151
-
152
- # @return [Hash<Symbol => void>]
153
- def defaults
154
- {
155
- border: nil,
156
- colour: nil,
157
- name: nil,
158
- parent: nil,
159
- position: nil,
160
- style: nil,
161
- value: '',
162
- }
163
- end
164
-
165
- # @return [Hash<Symbol => String>]
166
- def parent_to_hash
167
- return {} unless parent
168
-
169
- {
170
- background: parent.background.to_s,
171
- foreground: parent.foreground.to_s,
172
- style: parent.style.to_s,
173
- }
174
- end
175
-
176
- end # Char
177
-
178
- end # Views
179
-
180
- end # Vedeu
@@ -1,133 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vedeu
4
-
5
- module Views
6
-
7
- # Represents a {Vedeu::Views::Char} as a HTML tag with value. By
8
- # default, a table cell is used.
9
- #
10
- class HTMLChar
11
-
12
- include Vedeu::Common
13
-
14
- # @param (see #initialize)
15
- # @return (see #render)
16
- def self.render(char, options = {})
17
- new(char, options).render
18
- end
19
-
20
- # Returns a new instance of Vedeu::Views::HTMLChar.
21
- #
22
- # @param char [Vedeu::Views::Char]
23
- # @param options [Hash<Symbol => String>]
24
- # @option options start_tag [String]
25
- # @option options end_tag [String]
26
- # @return [Vedeu::Views::HTMLChar]
27
- def initialize(char, options = {})
28
- @char = char
29
- @options = options
30
- end
31
-
32
- # @return [String]
33
- def render
34
- "#{start_tag}#{tag_style}>#{tag_value}#{end_tag}"
35
- end
36
-
37
- protected
38
-
39
- # @!attribute [r] char
40
- # @return [Vedeu::Views::Char]
41
- attr_reader :char
42
-
43
- private
44
-
45
- # @return [String]
46
- def tag_style
47
- return '' unless border || present?(value)
48
-
49
- " style='#{tag_style_background}#{tag_style_foreground}'"
50
- end
51
-
52
- # @return [String]
53
- def tag_style_background
54
- return '' if char.background.empty?
55
-
56
- "border:1px #{char.background.to_html} solid;" \
57
- "background:#{char.background.to_html};"
58
- end
59
-
60
- # @return [String]
61
- def tag_style_foreground
62
- return '' if char.foreground.empty?
63
-
64
- "color:#{char.foreground.to_html};#{border_style}"
65
- end
66
-
67
- # @return [String]
68
- def tag_value
69
- return '&nbsp;' if border || !present?(value)
70
-
71
- value
72
- end
73
-
74
- # @return [String]
75
- def border_style
76
- case border
77
- when :top_horizontal then css(:top)
78
- when :left_vertical then css(:left)
79
- when :right_vertical then css(:right)
80
- when :bottom_horizontal then css(:bottom)
81
- when :top_left then "#{css(:top)}#{css(:left)}"
82
- when :top_right then "#{css(:top)}#{css(:right)}"
83
- when :bottom_left then "#{css(:bottom)}#{css(:left)}"
84
- when :bottom_right then "#{css(:bottom)}#{css(:right)}"
85
- else
86
- ''
87
- end
88
- end
89
-
90
- # @param direction [Symbol]
91
- # @return [String]
92
- def css(direction)
93
- "border-#{direction}:1px #{char.foreground.to_html} solid;"
94
- end
95
-
96
- # @return [Symbol|NilClass]
97
- def border
98
- char.border
99
- end
100
-
101
- # @return [String]
102
- def value
103
- char.value
104
- end
105
-
106
- # @return [String]
107
- def start_tag
108
- options[:start_tag]
109
- end
110
-
111
- # @return [String]
112
- def end_tag
113
- options[:end_tag]
114
- end
115
-
116
- # @return [Hash<Symbol => String>]
117
- def options
118
- defaults.merge!(@options)
119
- end
120
-
121
- # @return [Hash<Symbol => String>]
122
- def defaults
123
- {
124
- start_tag: '<td',
125
- end_tag: '</td>',
126
- }
127
- end
128
-
129
- end # HTMLChar
130
-
131
- end # Views
132
-
133
- end # Vedeu