markdown_exec 1.8.2 → 1.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.pryrc +1 -0
- data/CHANGELOG.md +18 -0
- data/Gemfile +2 -3
- data/Gemfile.lock +17 -6
- data/bin/bmde +1 -103
- data/bin/tab_completion.sh +23 -3
- data/examples/linked.md +33 -0
- data/examples/linked1.md +2 -2
- data/examples/linked2.md +5 -1
- data/examples/opts.md +1 -1
- data/lib/ansi_formatter.rb +0 -41
- data/lib/constants.rb +1 -1
- data/lib/directory_searcher.rb +42 -1
- data/lib/filter.rb +2 -21
- data/lib/hash_delegator.rb +302 -463
- data/lib/link_history.rb +134 -0
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +18 -34
- data/lib/mdoc.rb +40 -30
- data/lib/menu.src.yml +21 -2
- data/lib/menu.yml +20 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e802d2af4a779aad7091b20ab189a4c324f15f53643880758b7aac76549ba49
|
4
|
+
data.tar.gz: 2d6f910706bd10232f8bb87313364f671d3871e06382d57dd6248f07c4e497f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0e4b6ff95bccd281e078eb934d3660c52c28530ae12694c81030b3254de468b24d1d93e2e4d68b4d1163be68de029750930f3de0c3034154b05afde6ac9b42a
|
7
|
+
data.tar.gz: 85e260930e3d097e7028ae16cfeb7905fa702accd1fe2bb5b27fdb817d301be10259069be7c7e99f4af5258efbc7be5867d82834cee68bdc8d4e6485592f821e
|
data/.pryrc
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.8.5] - 2023-12-22
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- "eval" key for link block type to compute lines to append to the inherited state.
|
8
|
+
- Options for dumping data associated with the menu or state.
|
9
|
+
- Debug and irb gems.
|
10
|
+
|
11
|
+
## [1.8.4] - 2023-12-15
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- Options to dump blocks when processed.
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Refactor code generation for and after Link blocks
|
20
|
+
|
3
21
|
## [1.8.2] - 2023-12-12
|
4
22
|
|
5
23
|
### Changed
|
data/Gemfile
CHANGED
@@ -7,7 +7,9 @@ source 'https://rubygems.org'
|
|
7
7
|
|
8
8
|
gemspec
|
9
9
|
gem 'clipboard'
|
10
|
+
gem 'debug'
|
10
11
|
gem 'erb'
|
12
|
+
gem 'irb', '>= 1.8.0'
|
11
13
|
gem 'mocha', require: false
|
12
14
|
gem 'minitest', require: false
|
13
15
|
gem 'pry-nav'
|
@@ -22,7 +24,4 @@ gem 'rubocop-rake', require: false
|
|
22
24
|
gem 'rubocop-rspec', require: false
|
23
25
|
gem 'shellwords'
|
24
26
|
gem 'uri'
|
25
|
-
|
26
|
-
gem 'visual_call_graph'
|
27
|
-
|
28
27
|
gem 'yaml', '~> 0.2.1'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
markdown_exec (1.8.
|
4
|
+
markdown_exec (1.8.5)
|
5
5
|
clipboard (~> 1.3.6)
|
6
6
|
open3 (~> 0.1.1)
|
7
7
|
optparse (~> 0.1.1)
|
@@ -39,6 +39,9 @@ GEM
|
|
39
39
|
coderay (1.1.3)
|
40
40
|
concurrent-ruby (1.2.2)
|
41
41
|
crass (1.0.6)
|
42
|
+
debug (1.9.0)
|
43
|
+
irb (~> 1.10)
|
44
|
+
reline (>= 0.3.8)
|
42
45
|
debug_inspector (1.1.0)
|
43
46
|
diff-lcs (1.5.0)
|
44
47
|
erb (4.0.3)
|
@@ -46,6 +49,10 @@ GEM
|
|
46
49
|
erubi (1.12.0)
|
47
50
|
i18n (1.14.1)
|
48
51
|
concurrent-ruby (~> 1.0)
|
52
|
+
io-console (0.7.1)
|
53
|
+
irb (1.10.1)
|
54
|
+
rdoc
|
55
|
+
reline (>= 0.3.8)
|
49
56
|
json (2.6.3)
|
50
57
|
kwalify (0.7.2)
|
51
58
|
language_server-protocol (3.17.0.3)
|
@@ -74,6 +81,8 @@ GEM
|
|
74
81
|
pry-stack_explorer (0.6.1)
|
75
82
|
binding_of_caller (~> 1.0)
|
76
83
|
pry (~> 0.13)
|
84
|
+
psych (5.1.1.1)
|
85
|
+
stringio
|
77
86
|
racc (1.7.1)
|
78
87
|
rack (2.2.8)
|
79
88
|
rack-test (2.1.0)
|
@@ -94,11 +103,15 @@ GEM
|
|
94
103
|
zeitwerk (~> 2.5)
|
95
104
|
rainbow (3.1.1)
|
96
105
|
rake (13.0.6)
|
106
|
+
rdoc (6.6.2)
|
107
|
+
psych (>= 4.0.0)
|
97
108
|
reek (6.1.4)
|
98
109
|
kwalify (~> 0.7.0)
|
99
110
|
parser (~> 3.2.0)
|
100
111
|
rainbow (>= 2.0, < 4.0)
|
101
112
|
regexp_parser (2.8.1)
|
113
|
+
reline (0.4.1)
|
114
|
+
io-console (~> 0.5)
|
102
115
|
rexml (3.2.6)
|
103
116
|
rspec (3.12.0)
|
104
117
|
rspec-core (~> 3.12.0)
|
@@ -139,11 +152,10 @@ GEM
|
|
139
152
|
rubocop (~> 1.33)
|
140
153
|
rubocop-capybara (~> 2.17)
|
141
154
|
rubocop-factory_bot (~> 2.22)
|
142
|
-
ruby-graphviz (1.2.5)
|
143
|
-
rexml
|
144
155
|
ruby-progressbar (1.13.0)
|
145
156
|
ruby2_keywords (0.0.5)
|
146
157
|
shellwords (0.1.0)
|
158
|
+
stringio (3.1.0)
|
147
159
|
thor (1.2.2)
|
148
160
|
tty-color (0.6.0)
|
149
161
|
tty-cursor (0.7.1)
|
@@ -159,8 +171,6 @@ GEM
|
|
159
171
|
concurrent-ruby (~> 1.0)
|
160
172
|
unicode-display_width (2.5.0)
|
161
173
|
uri (0.12.2)
|
162
|
-
visual_call_graph (0.4.0)
|
163
|
-
ruby-graphviz (~> 1.2, >= 1.2.0)
|
164
174
|
wisper (2.0.1)
|
165
175
|
yaml (0.2.1)
|
166
176
|
zeitwerk (2.6.12)
|
@@ -170,7 +180,9 @@ PLATFORMS
|
|
170
180
|
|
171
181
|
DEPENDENCIES
|
172
182
|
clipboard
|
183
|
+
debug
|
173
184
|
erb
|
185
|
+
irb (>= 1.8.0)
|
174
186
|
markdown_exec!
|
175
187
|
minitest
|
176
188
|
mocha
|
@@ -186,7 +198,6 @@ DEPENDENCIES
|
|
186
198
|
rubocop-rspec
|
187
199
|
shellwords
|
188
200
|
uri
|
189
|
-
visual_call_graph
|
190
201
|
yaml (~> 0.2.1)
|
191
202
|
|
192
203
|
BUNDLED WITH
|
data/bin/bmde
CHANGED
@@ -8,106 +8,4 @@ Bundler.require(:default)
|
|
8
8
|
|
9
9
|
require_relative '../lib/markdown_exec'
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
MarkdownExec::MarkParse.new.run
|
14
|
-
else
|
15
|
-
|
16
|
-
def trace_event_properties(tp)
|
17
|
-
# TracePoint.new(:call, :return, :c_call, :c_return, :raise) do |tp|
|
18
|
-
# puts "Event information:"
|
19
|
-
# puts "Event type: #{tp.event}"
|
20
|
-
# puts "File: #{tp.path}"
|
21
|
-
# puts "Line: #{tp.lineno}"
|
22
|
-
# puts "Defined class: #{tp.defined_class}"
|
23
|
-
# puts "Method ID: #{tp.method_id}"
|
24
|
-
# puts "Class method ID: #{tp.defined_class} #{tp.method_id}"
|
25
|
-
# puts "Binding: #{tp.binding.inspect}"
|
26
|
-
# puts "Return value: #{tp.return_value.inspect}" if [:return, :c_return].include?(tp.event)
|
27
|
-
puts "Raised exception: #{tp.raised_exception.inspect}" if tp.event == :raise
|
28
|
-
# puts "---------------------------------"
|
29
|
-
# binding.pry
|
30
|
-
# print format("\n%-20.20s %-20.20s % 5.5d %20s %s", tp.method_id, tp.defined_class, tp.lineno, tp.path.split('/').last, caller[1].split('/').last)
|
31
|
-
|
32
|
-
# print format("\n%-20.20s %-30.30s %s", tp.method_id, tp.defined_class, caller[1].split('/').last.split(':', 3)[0..1].join(':'))
|
33
|
-
# print __LINE__, '.'
|
34
|
-
return if %i[method_missing present?].include?(tp.method_id)
|
35
|
-
return unless %r(/markdown_exec/lib/) =~ caller[1]
|
36
|
-
|
37
|
-
if [:return, :c_return].include?(tp.event)
|
38
|
-
print format("%1.1s %-20.20s %s\n", tp.event, tp.method_id, tp.return_value)
|
39
|
-
else
|
40
|
-
print format("%1.1s %-20.20s %-30.30s %20s\n", tp.event, tp.method_id, tp.defined_class, $~.post_match)
|
41
|
-
end
|
42
|
-
# end.enable
|
43
|
-
end
|
44
|
-
|
45
|
-
def start_trace(events = [:call])
|
46
|
-
trace = TracePoint.new(*events) do |tp|
|
47
|
-
trace_event_properties(tp)
|
48
|
-
end
|
49
|
-
|
50
|
-
trace.enable
|
51
|
-
yield
|
52
|
-
trace.disable
|
53
|
-
end
|
54
|
-
|
55
|
-
start_trace([:call, :return]) { MarkdownExec::MarkParse.new.run }
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
=begin
|
62
|
-
|
63
|
-
To filter what is traced, you can pass any of the following as events:
|
64
|
-
|
65
|
-
:line
|
66
|
-
execute an expression or statement on a new line
|
67
|
-
|
68
|
-
:class
|
69
|
-
start a class or module definition
|
70
|
-
|
71
|
-
:end
|
72
|
-
finish a class or module definition
|
73
|
-
|
74
|
-
:call
|
75
|
-
call a Ruby method
|
76
|
-
|
77
|
-
:return
|
78
|
-
return from a Ruby method
|
79
|
-
|
80
|
-
:c_call
|
81
|
-
call a C-language routine
|
82
|
-
|
83
|
-
:c_return
|
84
|
-
return from a C-language routine
|
85
|
-
|
86
|
-
:raise
|
87
|
-
raise an exception
|
88
|
-
|
89
|
-
:b_call
|
90
|
-
event hook at block entry
|
91
|
-
|
92
|
-
:b_return
|
93
|
-
event hook at block ending
|
94
|
-
|
95
|
-
:a_call
|
96
|
-
event hook at all calls (call, b_call, and c_call)
|
97
|
-
|
98
|
-
:a_return
|
99
|
-
event hook at all returns (return, b_return, and c_return)
|
100
|
-
|
101
|
-
:thread_begin
|
102
|
-
event hook at thread beginning
|
103
|
-
|
104
|
-
:thread_end
|
105
|
-
event hook at thread ending
|
106
|
-
|
107
|
-
:fiber_switch
|
108
|
-
event hook at fiber switch
|
109
|
-
|
110
|
-
:script_compiled
|
111
|
-
new Ruby code compiled (with eval, load or require)
|
112
|
-
|
113
|
-
=end
|
11
|
+
MarkdownExec::MarkParse.new.run
|
data/bin/tab_completion.sh
CHANGED
@@ -13,7 +13,7 @@ __filedirs_all()
|
|
13
13
|
}
|
14
14
|
|
15
15
|
_mde_echo_version() {
|
16
|
-
echo "1.8.
|
16
|
+
echo "1.8.5"
|
17
17
|
}
|
18
18
|
|
19
19
|
_mde() {
|
@@ -36,6 +36,16 @@ _mde() {
|
|
36
36
|
|
37
37
|
-d) COMPREPLY="0"; return 0 ;;
|
38
38
|
|
39
|
+
--dump-dump-delegate-object) COMPREPLY="0"; return 0 ;;
|
40
|
+
|
41
|
+
--dump-blocks-in-file) COMPREPLY="0"; return 0 ;;
|
42
|
+
|
43
|
+
--dump-dump-inherited-lines) COMPREPLY="0"; return 0 ;;
|
44
|
+
|
45
|
+
--dump-menu-blocks) COMPREPLY="0"; return 0 ;;
|
46
|
+
|
47
|
+
--dump-selected-block) COMPREPLY="0"; return 0 ;;
|
48
|
+
|
39
49
|
--filename) COMPREPLY="."; return 0 ;;
|
40
50
|
|
41
51
|
-f) COMPREPLY="."; return 0 ;;
|
@@ -82,7 +92,7 @@ _mde() {
|
|
82
92
|
# present matching option names
|
83
93
|
#
|
84
94
|
if [[ ${cur} == -* ]] ; then
|
85
|
-
opts=("--block-name" "--config" "--debug" "--exit" "--filename" "--find" "--help" "--how" "--list-blocks" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--pwd" "--run-last-script" "--save-executed-script" "--save-execution-output" "--saved-script-folder" "--saved-stdout-folder" "--select-recent-output" "--select-recent-script" "--tab-completions" "--user-must-approve" "--version" "--display-level")
|
95
|
+
opts=("--block-name" "--config" "--debug" "--dump-dump-delegate-object" "--dump-blocks-in-file" "--dump-dump-inherited-lines" "--dump-menu-blocks" "--dump-selected-block" "--exit" "--filename" "--find" "--help" "--how" "--list-blocks" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--pwd" "--run-last-script" "--save-executed-script" "--save-execution-output" "--saved-script-folder" "--saved-stdout-folder" "--select-recent-output" "--select-recent-script" "--tab-completions" "--user-must-approve" "--version" "--display-level")
|
86
96
|
COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
|
87
97
|
|
88
98
|
return 0
|
@@ -105,6 +115,16 @@ _mde() {
|
|
105
115
|
|
106
116
|
-d) COMPREPLY=".BOOL."; return 0 ;;
|
107
117
|
|
118
|
+
--dump-dump-delegate-object) COMPREPLY=".BOOL."; return 0 ;;
|
119
|
+
|
120
|
+
--dump-blocks-in-file) COMPREPLY=".BOOL."; return 0 ;;
|
121
|
+
|
122
|
+
--dump-dump-inherited-lines) COMPREPLY=".BOOL."; return 0 ;;
|
123
|
+
|
124
|
+
--dump-menu-blocks) COMPREPLY=".BOOL."; return 0 ;;
|
125
|
+
|
126
|
+
--dump-selected-block) COMPREPLY=".BOOL."; return 0 ;;
|
127
|
+
|
108
128
|
--filename) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
109
129
|
|
110
130
|
-f) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
@@ -154,4 +174,4 @@ _mde() {
|
|
154
174
|
|
155
175
|
complete -o filenames -o nospace -F _mde mde
|
156
176
|
# _mde_echo_version
|
157
|
-
# echo "Updated: 2023-12-
|
177
|
+
# echo "Updated: 2023-12-22 22:55:35 UTC"
|
data/examples/linked.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Demonstrate setting a variable interactively for use in generated scripts.
|
2
|
+
|
3
|
+
```opts :(document_options)
|
4
|
+
pause_after_script_execution: false
|
5
|
+
user_must_approve: false
|
6
|
+
```
|
7
|
+
|
8
|
+
::: Set VARIABLE to "A"
|
9
|
+
|
10
|
+
```link :set_to_A +(set_to_A)
|
11
|
+
block: display_variable
|
12
|
+
```
|
13
|
+
|
14
|
+
```bash :(set_to_A)
|
15
|
+
VARIABLE=A
|
16
|
+
```
|
17
|
+
|
18
|
+
::: Set VARIABLE to "B"
|
19
|
+
|
20
|
+
```link :set_to_B +(set_to_B)
|
21
|
+
block: display_variable
|
22
|
+
```
|
23
|
+
|
24
|
+
```bash :(set_to_B)
|
25
|
+
VARIABLE=B
|
26
|
+
```
|
27
|
+
|
28
|
+
::: Display value of VARIABLE
|
29
|
+
|
30
|
+
```bash :display_variable
|
31
|
+
source bin/colorize_env_vars.sh
|
32
|
+
colorize_env_vars '' VARIABLE
|
33
|
+
```
|
data/examples/linked1.md
CHANGED
@@ -12,10 +12,10 @@ colorize_env_vars 'vars for page3' PAGE3_VAR_VIA_INHERIT page3_var_via_environme
|
|
12
12
|
```
|
13
13
|
|
14
14
|
```bash :(vars2)
|
15
|
-
PAGE2_VAR_VIA_INHERIT=
|
15
|
+
PAGE2_VAR_VIA_INHERIT=for_page2_from_page1_via_inherited_code_blocks
|
16
16
|
```
|
17
17
|
|
18
|
-
```link :(linked2)
|
18
|
+
```link :(linked2) +(vars2)
|
19
19
|
file: examples/linked2.md
|
20
20
|
```
|
21
21
|
|
data/examples/linked2.md
CHANGED
@@ -17,7 +17,11 @@ colorize_env_vars 'vars for page3' PAGE3_VAR_VIA_INHERIT page3_var_via_environme
|
|
17
17
|
::: 3. executes block "show_vars" to display the imported PAGE3_VAR_VIA_INHERIT.
|
18
18
|
|
19
19
|
```bash :(vars3)
|
20
|
-
PAGE3_VAR_VIA_INHERIT=
|
20
|
+
PAGE3_VAR_VIA_INHERIT=for_page3_from_page2_via_inherited_code_blocks
|
21
|
+
```
|
22
|
+
|
23
|
+
```link :(linked3) +(vars3)
|
24
|
+
file: examples/linked3.md
|
21
25
|
```
|
22
26
|
|
23
27
|
```link :linked3_import_vars +(vars3)
|
data/examples/opts.md
CHANGED
data/lib/ansi_formatter.rb
CHANGED
@@ -28,47 +28,6 @@ class AnsiFormatter
|
|
28
28
|
# "#{line_prefix}#{string_send_color(label, highlight_color_sym)}#{line_postfix}\n" + formatted_deps.join("\n")
|
29
29
|
end
|
30
30
|
|
31
|
-
# Formats and highlights a list of data. data are presented with indentation,
|
32
|
-
# and specific items can be highlighted in a specified color, while others are shown in a plain color.
|
33
|
-
#
|
34
|
-
# @param data [Hash] A hash of data, where each key is a dependency name,
|
35
|
-
# and its value is an array of sub-items.
|
36
|
-
# @param highlight_color_sym [Symbol] The color method to apply to highlighted items.
|
37
|
-
# Default is :exception_color_detail.
|
38
|
-
# @param plain_color_sym [Symbol] The color method for non-highlighted items.
|
39
|
-
# Default is :menu_chrome_color.
|
40
|
-
# @param label [String] The label to prefix the list of data with.
|
41
|
-
# Default is 'data:'.
|
42
|
-
# @param highlight [Array] An array of items to highlight. Each item in this array will be
|
43
|
-
# formatted with the specified highlight color.
|
44
|
-
# @param line_prefix [String] Prefix for each line. Default is ' '.
|
45
|
-
# @param line_postfix [String] Postfix for each line. Default is ''.
|
46
|
-
# @param detail_sep [String] Separator for items in the sub-list. Default is ' '.
|
47
|
-
# @return [String] A formatted string representation of the data with highlighted items.
|
48
|
-
def format_and_highlight_hash(
|
49
|
-
data,
|
50
|
-
highlight_color_sym: :exception_color_detail,
|
51
|
-
plain_color_sym: :menu_chrome_color,
|
52
|
-
label: 'Data:',
|
53
|
-
highlight: [],
|
54
|
-
line_prefix: ' ',
|
55
|
-
line_postfix: '',
|
56
|
-
detail_sep: ' '
|
57
|
-
)
|
58
|
-
formatted_deps = data&.map do |dep_name, sub_items|
|
59
|
-
formatted_sub_items = sub_items.map do |item|
|
60
|
-
color_sym = highlight.include?(item) ? highlight_color_sym : plain_color_sym
|
61
|
-
string_send_color(item, color_sym)
|
62
|
-
end.join(detail_sep)
|
63
|
-
|
64
|
-
"#{line_prefix}- #{string_send_color(dep_name,
|
65
|
-
highlight.include?(dep_name) ? highlight_color_sym : plain_color_sym)}: #{formatted_sub_items}#{line_postfix}"
|
66
|
-
end || []
|
67
|
-
|
68
|
-
"#{line_prefix}#{string_send_color(label,
|
69
|
-
highlight_color_sym)}#{line_postfix}\n" + formatted_deps.join("\n")
|
70
|
-
end
|
71
|
-
|
72
31
|
# Function to scan a string and process its segments based on multiple substrings
|
73
32
|
# @param str [String] The string to scan.
|
74
33
|
# @param substrings [Array<String>] The substrings to match in the string.
|
data/lib/constants.rb
CHANGED
data/lib/directory_searcher.rb
CHANGED
@@ -5,6 +5,30 @@
|
|
5
5
|
|
6
6
|
require 'find'
|
7
7
|
|
8
|
+
def format_and_highlight_hash(
|
9
|
+
data,
|
10
|
+
highlight_color_sym: :exception_color_detail,
|
11
|
+
plain_color_sym: :menu_chrome_color,
|
12
|
+
label: 'Data:',
|
13
|
+
highlight: [],
|
14
|
+
line_prefix: ' ',
|
15
|
+
line_postfix: '',
|
16
|
+
key_has_value: ': '
|
17
|
+
)
|
18
|
+
formatted_deps = data&.map do |key, value|
|
19
|
+
color_sym = highlight.include?(key) ? highlight_color_sym : plain_color_sym
|
20
|
+
dkey = string_send_color(key, color_sym)
|
21
|
+
|
22
|
+
"#{line_prefix}#{dkey}#{key_has_value}" \
|
23
|
+
"#{string_send_color(value,
|
24
|
+
highlight.include?(value) ? highlight_color_sym : plain_color_sym)}: " \
|
25
|
+
"#{formatted_sub_items}#{line_postfix}"
|
26
|
+
end
|
27
|
+
|
28
|
+
"#{line_prefix}#{string_send_color(label,
|
29
|
+
highlight_color_sym)}#{line_postfix}\n" + formatted_deps.join("\n")
|
30
|
+
end
|
31
|
+
|
8
32
|
# Formats and highlights a list of dependencies. Dependencies are presented with indentation,
|
9
33
|
# and specific items can be highlighted in a specified color, while others are shown in a plain color.
|
10
34
|
#
|
@@ -47,6 +71,24 @@ def format_and_highlight_dependencies(
|
|
47
71
|
end
|
48
72
|
# warn menu_blocks.to_yaml.sub(/^(?:---\n)?/, "MenuBlocks:\n")
|
49
73
|
|
74
|
+
def format_and_highlight_lines(
|
75
|
+
lines,
|
76
|
+
highlight_color_sym: :exception_color_detail,
|
77
|
+
plain_color_sym: :menu_chrome_color,
|
78
|
+
label: 'Dependencies:',
|
79
|
+
highlight: [],
|
80
|
+
line_prefix: ' ',
|
81
|
+
line_postfix: ''
|
82
|
+
)
|
83
|
+
formatted_deps = lines&.map do |item|
|
84
|
+
"#{line_prefix}- #{string_send_color(dep_name,
|
85
|
+
highlight.include?(dep_name) ? highlight_color_sym : plain_color_sym)}: #{item}#{line_postfix}"
|
86
|
+
end || []
|
87
|
+
|
88
|
+
"#{line_prefix}#{string_send_color(label,
|
89
|
+
highlight_color_sym)}#{line_postfix}\n" + formatted_deps.join("\n")
|
90
|
+
end
|
91
|
+
|
50
92
|
IndexedLine = Struct.new(:index, :line) do
|
51
93
|
def to_s
|
52
94
|
line
|
@@ -77,7 +119,6 @@ class DirectorySearcher
|
|
77
119
|
match_dirs = []
|
78
120
|
@paths.each do |path|
|
79
121
|
Find.find(path) do |p|
|
80
|
-
# p 'search_in_directory_names', p
|
81
122
|
# Find.prune unless @include_subdirectories || path == p
|
82
123
|
match_dirs << p if File.directory?(p) && p.match?(@pattern)
|
83
124
|
end
|
data/lib/filter.rb
CHANGED
@@ -61,15 +61,8 @@ module MarkdownExec
|
|
61
61
|
# @param name [String] The name of the fenced code block.
|
62
62
|
#
|
63
63
|
def self.apply_name_filters(options, filters, name)
|
64
|
-
|
65
|
-
|
66
|
-
filters[:name_select] = true
|
67
|
-
filters[:name_exclude] = false
|
68
|
-
else
|
69
|
-
filters[:name_exclude] = true
|
70
|
-
filters[:name_select] = false
|
71
|
-
end
|
72
|
-
end
|
64
|
+
filters[:name_select] = true
|
65
|
+
filters[:name_exclude] = false
|
73
66
|
|
74
67
|
if name.present? && filters[:name_select].nil? && options[:select_by_name_regex].present?
|
75
68
|
filters[:name_select] =
|
@@ -239,12 +232,6 @@ if $PROGRAM_NAME == __FILE__
|
|
239
232
|
assert Filter.fcb_select?(@options, @fcb)
|
240
233
|
end
|
241
234
|
|
242
|
-
def test_name_exclude_condition
|
243
|
-
@options[:block_name] = 'test'
|
244
|
-
@fcb[:oname] = 'sample'
|
245
|
-
refute Filter.fcb_select?(@options, @fcb)
|
246
|
-
end
|
247
|
-
|
248
235
|
def test_shell_exclude_condition
|
249
236
|
@options[:exclude_by_shell_regex] = 'exclude_this'
|
250
237
|
@fcb[:shell] = 'exclude_this_shell'
|
@@ -269,12 +256,6 @@ if $PROGRAM_NAME == __FILE__
|
|
269
256
|
assert Filter.fcb_select?(@options, @fcb)
|
270
257
|
end
|
271
258
|
|
272
|
-
def test_bash_only_condition_false
|
273
|
-
@options[:bash_only] = true
|
274
|
-
@fcb[:shell] = 'zsh'
|
275
|
-
refute Filter.fcb_select?(@options, @fcb)
|
276
|
-
end
|
277
|
-
|
278
259
|
def test_default_case
|
279
260
|
assert Filter.fcb_select?(@options, @fcb)
|
280
261
|
end
|