src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/ui/styledown/styledown_test.elvts (about) 1 ~> render-styledown ' 2 foobar 3 ***### 4 lorem 5 _____ 6 '[1..] 7 ▶ [^styled (styled-segment foo &bold) (styled-segment bar &inverse) "\n" (styled-segment lorem &underlined) "\n"] 8 9 10 /////////////////////////// 11 # double-width characters # 12 /////////////////////////// 13 14 ~> render-styledown ' 15 好 foo 16 ** ### 17 '[1..] 18 ▶ [^styled (styled-segment 好 &bold) ' ' (styled-segment foo &inverse) "\n"] 19 ~> render-styledown ' 20 好 foo 21 *# ### 22 '[1..] 23 Exception: line 2: inconsistent style "*#" for multi-width character "好" 24 [tty]:1:1-4:6: 25 render-styledown ' 26 好 foo 27 *# ### 28 '[1..] 29 30 //////////////////////// 31 # configuration stanza # 32 //////////////////////// 33 34 ~> render-styledown ' 35 foo bar 36 rrr ggg 37 38 r fg-red 39 g bg-green 40 '[1..] 41 ▶ [^styled (styled-segment foo &fg-color=red) ' ' (styled-segment bar &bg-color=green) "\n"] 42 ~> render-styledown ' 43 foo 44 *** 45 46 no-eol'[1..] 47 ▶ [^styled (styled-segment foo &bold)] 48 49 //////////////////////////////// 50 # Trailing newline is optional # 51 //////////////////////////////// 52 53 ~> render-styledown ' 54 foobar 55 ***###'[1..] 56 ▶ [^styled (styled-segment foo &bold) (styled-segment bar &inverse) "\n"] 57 ~> render-styledown ' 58 foobar 59 ***### 60 61 no-eol'[1..] 62 ▶ [^styled (styled-segment foo &bold) (styled-segment bar &inverse)] 63 64 ////////// 65 # errors # 66 ////////// 67 68 // Unknown style 69 ~> render-styledown ' 70 foo 71 xxx 72 '[1..] 73 Exception: line 2: unknown style "x" 74 [tty]:1:1-4:6: 75 render-styledown ' 76 foo 77 xxx 78 '[1..] 79 // Empty line between stanzas is required 80 ~> render-styledown ' 81 foo 82 *** 83 no-eol 84 '[1..] 85 Exception: line 3: content and configuration stanzas must be separated by a newline 86 [tty]:1:1-5:6: 87 render-styledown ' 88 foo 89 *** 90 no-eol 91 '[1..] 92 // Unknown option 93 ~> render-styledown ' 94 foo 95 *** 96 97 unknown-option 98 '[1..] 99 Exception: line 4: invalid configuration line 100 [tty]:1:1-6:6: 101 render-styledown ' 102 foo 103 *** 104 105 unknown-option 106 '[1..] 107 // Style character is not a single character 108 ~> render-styledown ' 109 foo 110 *** 111 112 xx fg-red 113 '[1..] 114 Exception: line 4: style character "xx" not a single character 115 [tty]:1:1-6:6: 116 render-styledown ' 117 foo 118 *** 119 120 xx fg-red 121 '[1..] 122 // Style character is not single-width 123 ~> render-styledown ' 124 foo 125 *** 126 127 好 fg-red 128 '[1..] 129 Exception: line 4: style character "好" not single-width 130 [tty]:1:1-6:6: 131 render-styledown ' 132 foo 133 *** 134 135 好 fg-red 136 '[1..] 137 // Bad styling string 138 ~> render-styledown ' 139 foo 140 *** 141 142 x bad 143 '[1..] 144 Exception: line 4: invalid styling string "bad" 145 [tty]:1:1-6:6: 146 render-styledown ' 147 foo 148 *** 149 150 x bad 151 '[1..]