paintbrush 0.1.1 → 0.1.2

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
2
  SHA256:
3
- metadata.gz: cb568b4656208e4b1d5e134b9a6982a50be63f9da4a776aa7210a302f65a59ce
4
- data.tar.gz: cc92c16814e12eb90e089c5affaa6c4739ecbec1f9121093739c6e776e2aaf0f
3
+ metadata.gz: 178fc999ac3d70a2f9dc640d1c3a187aac191019a1762af80f922144ab18aeb5
4
+ data.tar.gz: e1f996291bc1748c19ee6389415c896e14f98665b4297cc2217e20fc1657603e
5
5
  SHA512:
6
- metadata.gz: dbc3a7c11aedf89c5191e1a538b902235c84e7a540b7d155ee008c1ad58e56a2eb4f139f151d681f06ba93fc7345221130ba0972d7d331ac6e793ef8b7752172
7
- data.tar.gz: c2bc6bb3a2e09ec5c9aa2d25c47f1b118cf01e2d10eef340e430806531c05421b11e7292d677d96f12112f1d252d64cb1c673a1f50bcf99d6ac8c0a493a98116
6
+ metadata.gz: 6a05f14e7eb6ce19b86e8301e01000f51651ea01d93470a9a80928e3060e473800434141e537e71343995676c1131dbf69a4c6ecc271f9a2b37f52124fda5cf7
7
+ data.tar.gz: 4f4a5c99d916f055706e366fb7e56bec5a29223d04c604eb04686bcfa6cb596a78a6fdfd685b2a8df3804cf23bb60ce358d9b078d1426fd164b9c5e638d7b954
data/Gemfile CHANGED
@@ -9,6 +9,7 @@ gem 'rake', '~> 13.0'
9
9
 
10
10
  gem 'devpack', '~> 0.4.1'
11
11
  gem 'rspec', '~> 3.0'
12
+ gem 'rspec-documentation', '~> 0.0.2'
12
13
  gem 'rubocop', '~> 1.51'
13
14
  gem 'rubocop-rake', '~> 0.6.0'
14
15
  gem 'rubocop-rspec', '~> 2.22'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paintbrush (0.1.1)
4
+ paintbrush (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -10,23 +10,38 @@ GEM
10
10
  concurrent-ruby (1.2.2)
11
11
  devpack (0.4.1)
12
12
  diff-lcs (1.5.0)
13
+ htmlbeautifier (1.4.2)
13
14
  i18n (1.13.0)
14
15
  concurrent-ruby (~> 1.0)
15
16
  json (2.6.3)
17
+ kramdown (2.4.0)
18
+ rexml
19
+ kramdown-parser-gfm (1.1.0)
20
+ kramdown (~> 2.0)
16
21
  paint (2.3.0)
17
22
  parallel (1.23.0)
18
23
  parser (3.2.2.1)
19
24
  ast (~> 2.4.1)
20
25
  rainbow (3.1.1)
21
26
  rake (13.0.6)
27
+ redcarpet (3.6.0)
22
28
  regexp_parser (2.8.0)
23
29
  rexml (3.2.5)
30
+ rouge (4.1.1)
24
31
  rspec (3.12.0)
25
32
  rspec-core (~> 3.12.0)
26
33
  rspec-expectations (~> 3.12.0)
27
34
  rspec-mocks (~> 3.12.0)
28
35
  rspec-core (3.12.2)
29
36
  rspec-support (~> 3.12.0)
37
+ rspec-documentation (0.0.2)
38
+ htmlbeautifier (~> 1.4)
39
+ kramdown (~> 2.4)
40
+ kramdown-parser-gfm (~> 1.1)
41
+ paintbrush (~> 0.1.1)
42
+ redcarpet (~> 3.6)
43
+ rouge (~> 4.1)
44
+ rspec (~> 3.12)
30
45
  rspec-expectations (3.12.3)
31
46
  diff-lcs (>= 1.2.0, < 2.0)
32
47
  rspec-support (~> 3.12.0)
@@ -70,6 +85,7 @@ DEPENDENCIES
70
85
  paintbrush!
71
86
  rake (~> 13.0)
72
87
  rspec (~> 3.0)
88
+ rspec-documentation (~> 0.0.2)
73
89
  rubocop (~> 1.51)
74
90
  rubocop-rake (~> 0.6.0)
75
91
  rubocop-rspec (~> 2.22)
@@ -5,7 +5,8 @@ module Paintbrush
5
5
  # sequences to store references to start and end of each coloring method to allow nested
6
6
  # colorizing with string interpolation within each individual call to `paintbrush`.
7
7
  class ColorizedString
8
- def initialize(&block)
8
+ def initialize(colorize:, &block)
9
+ @colorize = colorize
9
10
  @block = block
10
11
  @stack = []
11
12
  end
@@ -14,7 +15,9 @@ module Paintbrush
14
15
  # method in the provided block, rebuilds the string and returns the value with regular ANSI
15
16
  # color codes ready to be output to a console.
16
17
  def colorized
17
- colorized_string
18
+ Configuration.with_configuration(colorize: @colorize) do
19
+ colorized_string
20
+ end
18
21
  end
19
22
 
20
23
  private
@@ -20,7 +20,11 @@ module Paintbrush
20
20
 
21
21
  COLOR_CODES.each do |name, code|
22
22
  define_method name do |string|
23
- ColorElement.new(stack: @__stack, code: code, string: string).to_s
23
+ if Configuration.colorize?
24
+ ColorElement.new(stack: @__stack, code: code, string: string).to_s
25
+ else
26
+ string
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Paintbrush
4
+ # Provides a configuration interface for Paintbrush features, allows disabling colorization.
5
+ #
6
+ # Usage:
7
+ #
8
+ # ```ruby
9
+ # Paintbrush::Configuration.colorize = false
10
+ # ```
11
+ module Configuration
12
+ @defaults = {
13
+ colorize: true
14
+ }
15
+
16
+ @configuration = {}
17
+
18
+ class << self
19
+ attr_reader :configuration, :defaults
20
+
21
+ def colorize=(val)
22
+ configuration[:colorize] = val
23
+ end
24
+
25
+ def colorize?
26
+ configuration.fetch(:colorize, defaults[:colorize])
27
+ end
28
+
29
+ def reset
30
+ @configuration = {}
31
+ end
32
+
33
+ def with_configuration(**options, &block)
34
+ previous = configuration.dup
35
+ options.compact.each { |key, value| configuration[key] = value unless configuration.key?(key) }
36
+ block.call.tap { @configuration = previous }
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paintbrush
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
data/lib/paintbrush.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'paintbrush/version'
4
+ require_relative 'paintbrush/configuration'
4
5
  require_relative 'paintbrush/escapes'
5
6
  require_relative 'paintbrush/colors'
6
7
  require_relative 'paintbrush/colorized_string'
@@ -20,11 +21,11 @@ require_relative 'paintbrush/element_tree'
20
21
  # end
21
22
  # ```
22
23
  module Paintbrush
23
- def self.paintbrush(&block)
24
- ColorizedString.new(&block).colorized
24
+ def self.paintbrush(colorize: nil, &block)
25
+ ColorizedString.new(colorize: colorize, &block).colorized
25
26
  end
26
27
 
27
- def paintbrush(&block)
28
- Paintbrush.paintbrush(&block)
28
+ def paintbrush(colorize: nil, &block)
29
+ Paintbrush.paintbrush(colorize: colorize, &block)
29
30
  end
30
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paintbrush
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-26 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides a set of encapsulated methods for nested colorization of strings.
14
14
  email:
@@ -32,11 +32,11 @@ files:
32
32
  - lib/paintbrush/color_element.rb
33
33
  - lib/paintbrush/colorized_string.rb
34
34
  - lib/paintbrush/colors.rb
35
+ - lib/paintbrush/configuration.rb
35
36
  - lib/paintbrush/element_tree.rb
36
37
  - lib/paintbrush/escapes.rb
37
38
  - lib/paintbrush/version.rb
38
39
  - paintbrush.gemspec
39
- - rspec-documentation/bundle/introduction.html
40
40
  - rspec-documentation/pages/Introduction.md
41
41
  - sig/paintbrush.rbs
42
42
  homepage: https://github.com/bobf/paintbrush
@@ -1,312 +0,0 @@
1
- <html>
2
- <head>
3
- <link rel="stylesheet"
4
- href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css"
5
- integrity="sha512-SbiR/eusphKoMVVXysTKG/7VseWii+Y3FdHrt0EpKgpToZeemhqHeZeLWLhJutz/2ut2Vw1uQEj2MbRF+TVBUA=="
6
- crossorigin="anonymous"
7
- referrerpolicy="no-referrer" />
8
- <style>
9
-
10
- .code {
11
- font-family: monospace;
12
- max-height: 30rem;
13
- overflow-y: auto;
14
- }
15
-
16
- h1.title {
17
- display: inline;
18
- }
19
-
20
- .header .separator {
21
- display: inline-block;
22
- height: 2.5rem;
23
- }
24
-
25
- .version {
26
- color: #bbb;
27
- font-size: 2rem;
28
- }
29
-
30
- .ansi-html {
31
- display: inline-block;
32
- background-color: #2e2e2e;
33
- border: 5px solid #2e2e2e;
34
- border-radius: 10px;
35
- }
36
-
37
- .ansi-html .ansi-color-0 { color: #555555; }
38
- .ansi-html .ansi-color-1 { color: #ff0000; }
39
- .ansi-html .ansi-color-2 { color: #47ff47; }
40
- .ansi-html .ansi-color-3 { color: #e9e947; }
41
- .ansi-html .ansi-color-4 { color: #49a0dd; }
42
- .ansi-html .ansi-color-5 { color: #8d7eeb; }
43
- .ansi-html .ansi-color-6 { color: #2eecff; }
44
- .ansi-html .ansi-color-7 { color: #ffffff; }
45
- .ansi-html .ansi-color-9 { color: #606060; }
46
- .ansi-html .ansi-color-reset { color: #dddddd; }
47
-
48
- .highlight table td { padding: 5px; }
49
- .highlight table pre { margin: 0; }
50
- .highlight, .highlight .w {
51
- color: #24292f;
52
- background-color: #f6f8fa;
53
- }
54
- .highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .kv {
55
- color: #cf222e;
56
- }
57
- .highlight .gr {
58
- color: #f6f8fa;
59
- }
60
- .highlight .gd {
61
- color: #82071e;
62
- background-color: #ffebe9;
63
- }
64
- .highlight .nb {
65
- color: #953800;
66
- }
67
- .highlight .nc {
68
- color: #953800;
69
- }
70
- .highlight .no {
71
- color: #953800;
72
- }
73
- .highlight .nn {
74
- color: #953800;
75
- }
76
- .highlight .sr {
77
- color: #116329;
78
- }
79
- .highlight .na {
80
- color: #116329;
81
- }
82
- .highlight .nt {
83
- color: #116329;
84
- }
85
- .highlight .gi {
86
- color: #116329;
87
- background-color: #dafbe1;
88
- }
89
- .highlight .kc {
90
- color: #0550ae;
91
- }
92
- .highlight .l, .highlight .ld, .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx {
93
- color: #0550ae;
94
- }
95
- .highlight .sb {
96
- color: #0550ae;
97
- }
98
- .highlight .bp {
99
- color: #0550ae;
100
- }
101
- .highlight .ne {
102
- color: #0550ae;
103
- }
104
- .highlight .nl {
105
- color: #0550ae;
106
- }
107
- .highlight .py {
108
- color: #0550ae;
109
- }
110
- .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm {
111
- color: #0550ae;
112
- }
113
- .highlight .o, .highlight .ow {
114
- color: #0550ae;
115
- }
116
- .highlight .gh {
117
- color: #0550ae;
118
- font-weight: bold;
119
- }
120
- .highlight .gu {
121
- color: #0550ae;
122
- font-weight: bold;
123
- }
124
- .highlight .s, .highlight .sa, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .sx, .highlight .s1, .highlight .ss {
125
- color: #0a3069;
126
- }
127
- .highlight .nd {
128
- color: #8250df;
129
- }
130
- .highlight .nf, .highlight .fm {
131
- color: #8250df;
132
- }
133
- .highlight .err {
134
- color: #f6f8fa;
135
- background-color: #82071e;
136
- }
137
- .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cp, .highlight .cpf, .highlight .c1, .highlight .cs {
138
- color: #6e7781;
139
- }
140
- .highlight .gl {
141
- color: #6e7781;
142
- }
143
- .highlight .gt {
144
- color: #6e7781;
145
- }
146
- .highlight .ni {
147
- color: #24292f;
148
- }
149
- .highlight .si {
150
- color: #24292f;
151
- }
152
- .highlight .ge {
153
- color: #24292f;
154
- font-style: italic;
155
- }
156
- .highlight .gs {
157
- color: #24292f;
158
- font-weight: bold;
159
- }
160
-
161
- </style>
162
- </head>
163
-
164
- <body>
165
- <div class="container m-3 p-3">
166
- <div class="header p-3 m-3 w-90 text-end">
167
- <h1 class="title">paintbrush</h1>
168
- <span class="separator border-end pb-2 ms-2 me-2"></span>
169
- <span class="version">0.1.0</span>
170
- </div>
171
-
172
- <hr/>
173
-
174
-
175
- <div class="row">
176
- <div class="col-auto page-tree fs-6 mt-1 ms-3 me-3">
177
-
178
- <li>
179
-
180
- <a href='/home/bob/dev/paintbrush/rspec-documentation/bundle/introduction.html'>Introduction</a>
181
-
182
- </li>
183
-
184
- <ul>
185
-
186
- </ul>
187
-
188
- </div>
189
-
190
- <div class="col">
191
- <h1 id="paintbrush">Paintbrush</h1>
192
-
193
- <p>Simple and concise string colorization for <em>Ruby</em> without overloading <code>String</code> methods or requiring verbose class/method invocation.</p>
194
-
195
- <p><em>Paintbrush</em> has zero dependencies and does not pollute any namespaces or objects outside of the <code>#paintbrush</code> method wherever you include the <code>Paintbrush</code> module.</p>
196
-
197
- <p>Nesting is supported, allowing you to use multiple colors within the same string. The previous color is automatically restored.</p>
198
-
199
- <div location="9"><button type="button" class="btn btn-primary float-end" data-bs-toggle="modal" data-bs-target="#modal-15cae418-087d-45aa-b936-ea2c34033c01-side-by-side"> View Side-by-side </button> <div class="modal fade" id="modal-15cae418-087d-45aa-b936-ea2c34033c01-side-by-side" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
200
- <div class="modal-dialog modal-xl">
201
- <div class="modal-content">
202
- <div class="modal-header">
203
- <h5 class="modal-title" id="modal-15cae418-087d-45aa-b936-ea2c34033c01-side-by-side-label">Side-by-side view</h5>
204
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
205
- </div>
206
- <div class="modal-body">
207
- <div class="container p-3">
208
- <div class="row border">
209
- <div class="col border">
210
- <div class="p-3 mb-5 code highlight">
211
- <span class="nb">require</span> <span class="s1">'paintbrush'</span><br /><br /><span class="kp">extend</span> <span class="no">Paintbrush</span><br /><br /><span class="n">output</span> <span class="o">=</span> <span class="n">paintbrush</span> <span class="p">{</span> <span class="n">purple</span> <span class="s2">"You used </span><span class="si">#{</span><span class="n">green</span> <span class="s1">'four'</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">blue</span> <span class="s2">"(</span><span class="si">#{</span><span class="n">cyan</span> <span class="s1">'4'</span><span class="si">}</span><span class="s2">)"</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">yellow</span> <span class="s1">'colors'</span><span class="si">}</span><span class="s2"> today!"</span> <span class="p">}</span><br /><span class="n">it_documents</span> <span class="n">output</span> <span class="k">do</span><br />  <span class="n">expect</span><span class="p">(</span><span class="n">output</span><span class="p">).</span><span class="nf">to</span> <span class="n">eql</span> <span class="s2">"</span><span class="se">\e</span><span class="s2">[35mYou used </span><span class="se">\e</span><span class="s2">[32mfour</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[35m "</span> <span class="p">\</span><br />                        <span class="s2">"</span><span class="se">\e</span><span class="s2">[34m(</span><span class="se">\e</span><span class="s2">[36m4</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[34m)</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[35m "</span> <span class="p">\</span><br />                        <span class="s2">"</span><span class="se">\e</span><span class="s2">[33mcolors</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[35m today!</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[0m"</span><br /><span class="k">end</span><br />
212
- </div>
213
- </div>
214
- <div class="col border">
215
- <div class="p-3 mb-5 code highlight">
216
- <div class="ansi-html border m-1 p-4">
217
- <span></span><span class="ansi-color-5">You used </span><span class="ansi-color-2">four</span><span class="ansi-color-reset"></span><span class="ansi-color-5"> </span><span class="ansi-color-4">(</span><span class="ansi-color-6">4</span><span class="ansi-color-reset"></span><span class="ansi-color-4">)</span><span class="ansi-color-reset"></span><span class="ansi-color-5"> </span><span class="ansi-color-3">colors</span><span class="ansi-color-reset"></span><span class="ansi-color-5"> today!</span><span class="ansi-color-reset"></span><span class="ansi-color-reset"></span>
218
- </div>
219
- </div>
220
- </div>
221
- </div>
222
- </div>
223
- </div>
224
- <div class="modal-footer">
225
- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
226
- </div>
227
- </div>
228
- </div>
229
- </div>
230
- <ul class="nav nav-tabs" id="html-tabs-15cae418-087d-45aa-b936-ea2c34033c01" role="tablist">
231
- <li class="nav-item" role="presentation"><button class="nav-link active" id="code-source-15cae418-087d-45aa-b936-ea2c34033c01-tab" data-bs-toggle="tab" data-bs-target="#code-source-15cae418-087d-45aa-b936-ea2c34033c01" type="button" role="tab" aria-controls="code-source" aria-selected="true">Code</button></li>
232
- <li class="nav-item" role="presentation"><button class="nav-link" id="rendered-15cae418-087d-45aa-b936-ea2c34033c01-tab" data-bs-toggle="tab" data-bs-target="#rendered-15cae418-087d-45aa-b936-ea2c34033c01" type="button" role="tab" aria-controls="rendered" aria-selected="false">Output</button></li>
233
- </ul>
234
- <div class="tab-content" id="html-tab-content-15cae418-087d-45aa-b936-ea2c34033c01">
235
- <div class="tab-pane fade show active" id="code-source-15cae418-087d-45aa-b936-ea2c34033c01" role="tabpanel" aria-labelledby="code-source-15cae418-087d-45aa-b936-ea2c34033c01-tab">
236
- <div class="p-3 mb-5 code highlight">
237
- <span class="nb">require</span> <span class="s1">'paintbrush'</span><br /><br /><span class="kp">extend</span> <span class="no">Paintbrush</span><br /><br /><span class="n">output</span> <span class="o">=</span> <span class="n">paintbrush</span> <span class="p">{</span> <span class="n">purple</span> <span class="s2">"You used </span><span class="si">#{</span><span class="n">green</span> <span class="s1">'four'</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">blue</span> <span class="s2">"(</span><span class="si">#{</span><span class="n">cyan</span> <span class="s1">'4'</span><span class="si">}</span><span class="s2">)"</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">yellow</span> <span class="s1">'colors'</span><span class="si">}</span><span class="s2"> today!"</span> <span class="p">}</span><br /><span class="n">it_documents</span> <span class="n">output</span> <span class="k">do</span><br />  <span class="n">expect</span><span class="p">(</span><span class="n">output</span><span class="p">).</span><span class="nf">to</span> <span class="n">eql</span> <span class="s2">"</span><span class="se">\e</span><span class="s2">[35mYou used </span><span class="se">\e</span><span class="s2">[32mfour</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[35m "</span> <span class="p">\</span><br />                        <span class="s2">"</span><span class="se">\e</span><span class="s2">[34m(</span><span class="se">\e</span><span class="s2">[36m4</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[34m)</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[35m "</span> <span class="p">\</span><br />                        <span class="s2">"</span><span class="se">\e</span><span class="s2">[33mcolors</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[35m today!</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[0m"</span><br /><span class="k">end</span><br />
238
- </div>
239
- </div>
240
- <div class="tab-pane fade" id="rendered-15cae418-087d-45aa-b936-ea2c34033c01" role="tabpanel" aria-labelledby="rendered-15cae418-087d-45aa-b936-ea2c34033c01-tab">
241
- <div class="p-3 mb-5 code highlight">
242
- <div class="ansi-html border m-1 p-4">
243
- <span></span><span class="ansi-color-5">You used </span><span class="ansi-color-2">four</span><span class="ansi-color-reset"></span><span class="ansi-color-5"> </span><span class="ansi-color-4">(</span><span class="ansi-color-6">4</span><span class="ansi-color-reset"></span><span class="ansi-color-4">)</span><span class="ansi-color-reset"></span><span class="ansi-color-5"> </span><span class="ansi-color-3">colors</span><span class="ansi-color-reset"></span><span class="ansi-color-5"> today!</span><span class="ansi-color-reset"></span><span class="ansi-color-reset"></span>
244
- </div>
245
- </div>
246
- </div>
247
- </div>
248
- </div>
249
-
250
- <div location="22"><button type="button" class="btn btn-primary float-end" data-bs-toggle="modal" data-bs-target="#modal-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0-side-by-side"> View Side-by-side </button> <div class="modal fade" id="modal-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0-side-by-side" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
251
- <div class="modal-dialog modal-xl">
252
- <div class="modal-content">
253
- <div class="modal-header">
254
- <h5 class="modal-title" id="modal-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0-side-by-side-label">Side-by-side view</h5>
255
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
256
- </div>
257
- <div class="modal-body">
258
- <div class="container p-3">
259
- <div class="row border">
260
- <div class="col border">
261
- <div class="p-3 mb-5 code highlight">
262
- <span class="nb">require</span> <span class="s1">'paintbrush'</span><br /><br /><span class="kp">extend</span> <span class="no">Paintbrush</span><br /><br /><span class="n">output</span> <span class="o">=</span> <span class="n">paintbrush</span> <span class="k">do</span><br />  <span class="s2">"</span><span class="si">#{</span><span class="n">blue</span> <span class="s1">'foo'</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">green</span> <span class="s2">"bar </span><span class="si">#{</span><span class="n">cyan</span> <span class="sx">%w[foo bar baz]</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="s1">', '</span><span class="p">)</span><span class="si">}</span><span class="s2"> with </span><span class="si">#{</span><span class="n">cyan</span> <span class="s1">'qux'</span><span class="si">}</span><span class="s2"> and quux"</span><span class="si">}</span><span class="s2"> and corge"</span><br /><span class="k">end</span><br /><br /><span class="n">it_documents</span> <span class="n">output</span> <span class="k">do</span><br />  <span class="n">expect</span><span class="p">(</span><span class="n">output</span><span class="p">).</span><span class="nf">to</span> <span class="n">eql</span> <span class="s2">"</span><span class="se">\e</span><span class="s2">[34mfoo</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[0m </span><span class="se">\e</span><span class="s2">[32mbar </span><span class="se">\e</span><span class="s2">[36mfoo, bar, baz"</span> <span class="p">\</span><br />                        <span class="s2">"</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[32m with </span><span class="se">\e</span><span class="s2">[36mqux</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[32m "</span><span class="p">\</span><br />                        <span class="s2">"and quux</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[0m and corge"</span><br /><span class="k">end</span><br />
263
- </div>
264
- </div>
265
- <div class="col border">
266
- <div class="p-3 mb-5 code highlight">
267
- <div class="ansi-html border m-1 p-4">
268
- <span></span><span class="ansi-color-4">foo</span><span class="ansi-color-reset"></span><span class="ansi-color-reset"> </span><span class="ansi-color-2">bar </span><span class="ansi-color-6">foo, bar, baz</span><span class="ansi-color-reset"></span><span class="ansi-color-2"> with </span><span class="ansi-color-6">qux</span><span class="ansi-color-reset"></span><span class="ansi-color-2"> and quux</span><span class="ansi-color-reset"></span><span class="ansi-color-reset"> and corge</span>
269
- </div>
270
- </div>
271
- </div>
272
- </div>
273
- </div>
274
- </div>
275
- <div class="modal-footer">
276
- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
277
- </div>
278
- </div>
279
- </div>
280
- </div>
281
- <ul class="nav nav-tabs" id="html-tabs-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0" role="tablist">
282
- <li class="nav-item" role="presentation"><button class="nav-link active" id="code-source-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0-tab" data-bs-toggle="tab" data-bs-target="#code-source-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0" type="button" role="tab" aria-controls="code-source" aria-selected="true">Code</button></li>
283
- <li class="nav-item" role="presentation"><button class="nav-link" id="rendered-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0-tab" data-bs-toggle="tab" data-bs-target="#rendered-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0" type="button" role="tab" aria-controls="rendered" aria-selected="false">Output</button></li>
284
- </ul>
285
- <div class="tab-content" id="html-tab-content-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0">
286
- <div class="tab-pane fade show active" id="code-source-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0" role="tabpanel" aria-labelledby="code-source-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0-tab">
287
- <div class="p-3 mb-5 code highlight">
288
- <span class="nb">require</span> <span class="s1">'paintbrush'</span><br /><br /><span class="kp">extend</span> <span class="no">Paintbrush</span><br /><br /><span class="n">output</span> <span class="o">=</span> <span class="n">paintbrush</span> <span class="k">do</span><br />  <span class="s2">"</span><span class="si">#{</span><span class="n">blue</span> <span class="s1">'foo'</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">green</span> <span class="s2">"bar </span><span class="si">#{</span><span class="n">cyan</span> <span class="sx">%w[foo bar baz]</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="s1">', '</span><span class="p">)</span><span class="si">}</span><span class="s2"> with </span><span class="si">#{</span><span class="n">cyan</span> <span class="s1">'qux'</span><span class="si">}</span><span class="s2"> and quux"</span><span class="si">}</span><span class="s2"> and corge"</span><br /><span class="k">end</span><br /><br /><span class="n">it_documents</span> <span class="n">output</span> <span class="k">do</span><br />  <span class="n">expect</span><span class="p">(</span><span class="n">output</span><span class="p">).</span><span class="nf">to</span> <span class="n">eql</span> <span class="s2">"</span><span class="se">\e</span><span class="s2">[34mfoo</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[0m </span><span class="se">\e</span><span class="s2">[32mbar </span><span class="se">\e</span><span class="s2">[36mfoo, bar, baz"</span> <span class="p">\</span><br />                        <span class="s2">"</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[32m with </span><span class="se">\e</span><span class="s2">[36mqux</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[32m "</span><span class="p">\</span><br />                        <span class="s2">"and quux</span><span class="se">\e</span><span class="s2">[0m</span><span class="se">\e</span><span class="s2">[0m and corge"</span><br /><span class="k">end</span><br />
289
- </div>
290
- </div>
291
- <div class="tab-pane fade" id="rendered-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0" role="tabpanel" aria-labelledby="rendered-c3e2bbb8-9a13-4400-93a1-0e6c9847cba0-tab">
292
- <div class="p-3 mb-5 code highlight">
293
- <div class="ansi-html border m-1 p-4">
294
- <span></span><span class="ansi-color-4">foo</span><span class="ansi-color-reset"></span><span class="ansi-color-reset"> </span><span class="ansi-color-2">bar </span><span class="ansi-color-6">foo, bar, baz</span><span class="ansi-color-reset"></span><span class="ansi-color-2"> with </span><span class="ansi-color-6">qux</span><span class="ansi-color-reset"></span><span class="ansi-color-2"> and quux</span><span class="ansi-color-reset"></span><span class="ansi-color-reset"> and corge</span>
295
- </div>
296
- </div>
297
- </div>
298
- </div>
299
- </div>
300
-
301
- </div>
302
- </div>
303
- <hr/>
304
-
305
- </div>
306
-
307
- <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.bundle.min.js"
308
- integrity="sha512-i9cEfJwUwViEPFKdC1enz4ZRGBj8YQo6QByFTF92YXHi7waCqyexvRD75S5NVTsSiTv7rKWqG9Y5eFxmRsOn0A=="
309
- crossorigin="anonymous"
310
- referrerpolicy="no-referrer"></script>
311
- </body>
312
- </html>