markdown_exec 1.4.1 → 1.6

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: 6655d4d2fdbf1334fd7eb786e8b8e3e8401ac0e8cb0e10927c1e426be9422d83
4
- data.tar.gz: 5e2e1272f186e8fb00d240fd11501cdc5630ab497298fcc02e43c42c9b3e0f45
3
+ metadata.gz: 97323ce7d6c677603ca89432c9ca64e45ff205a5b6cc03a71f4be1210bf8104a
4
+ data.tar.gz: ccce852fe96571b00c4443012371ea5ad29caec29dfdc9649cec7da2c091defe
5
5
  SHA512:
6
- metadata.gz: 63ab33098867f8f1af0b0281690e816cd657d9fc42181cdb895ee78ab2e722cc5c63303d2c2be7f9791a7cacc9503cbfc45d9277b1a35e5cdb33ef4217a8607a
7
- data.tar.gz: 4535992b37f72e175388264c3e7ab9f5189a06e57b8a973521d95f62ea75a22de445518f19577563d78a81ebc2c8a99c3cc3e24639f04f792ad9017780c426bb
6
+ metadata.gz: bc08d47d135d9a078240c6e3001322ec8b35b8fb4f7febeabec02729240d7524a40464d9d563aeb15e5c8d09695bd0b512251d970dfede46cf07bd377af72181
7
+ data.tar.gz: ec61f969d204b0216c02e2e13d270363aef35ecf3ad6ff5a26d653e2d5c8f1608ff3e70a24ab65ab3bd48d8c546e1a6c627734c8e03e08a2440c18b1d9db7fed
data/.rubocop.yml CHANGED
@@ -14,7 +14,9 @@ Layout/LineContinuationLeadingSpace:
14
14
  Enabled: false
15
15
 
16
16
  Layout/LineLength:
17
- Max: 96
17
+ Max: 72
18
+ # Max: 80
19
+ # Max: 96
18
20
 
19
21
  Lint/Debugger:
20
22
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.6] - 2023-11-13
4
+
5
+ ### Added
6
+
7
+ - Options to remember a block's indentation in the source document and to display with same indentation in the menu.
8
+
9
+ ### Changed
10
+
11
+ - Note option matches the remaining lines in the document and they are displayed in the menu.
12
+
13
+ ## [1.5] - 2023-11-08
14
+
15
+ ### Added
16
+
17
+ - Confirmation between execution of block and display of next menu.
18
+ - Option for block loaded automatically per document.
19
+ - Options for note lines copied from source into menu.
20
+ - Options to format menu chrome.
21
+ - Options to generate title for a block without a name.
22
+ - Remove consecutive blank lines from menu.
23
+ - Restore options between menu choices. Add options for "notes" in menu.
24
+
3
25
  ## [1.4.1] - 2023-11-02
4
26
 
5
27
  ### Added
data/Gemfile CHANGED
@@ -22,4 +22,7 @@ gem 'rubocop-rake', require: false
22
22
  gem 'rubocop-rspec', require: false
23
23
  gem 'shellwords'
24
24
  gem 'uri'
25
+
26
+ gem 'visual_call_graph'
27
+
25
28
  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.4.1)
4
+ markdown_exec (1.6)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -139,6 +139,8 @@ GEM
139
139
  rubocop (~> 1.33)
140
140
  rubocop-capybara (~> 2.17)
141
141
  rubocop-factory_bot (~> 2.22)
142
+ ruby-graphviz (1.2.5)
143
+ rexml
142
144
  ruby-progressbar (1.13.0)
143
145
  ruby2_keywords (0.0.5)
144
146
  shellwords (0.1.0)
@@ -157,6 +159,8 @@ GEM
157
159
  concurrent-ruby (~> 1.0)
158
160
  unicode-display_width (2.5.0)
159
161
  uri (0.12.2)
162
+ visual_call_graph (0.4.0)
163
+ ruby-graphviz (~> 1.2, >= 1.2.0)
160
164
  wisper (2.0.1)
161
165
  yaml (0.2.1)
162
166
  zeitwerk (2.6.12)
@@ -182,6 +186,7 @@ DEPENDENCIES
182
186
  rubocop-rspec
183
187
  shellwords
184
188
  uri
189
+ visual_call_graph
185
190
  yaml (~> 0.2.1)
186
191
 
187
192
  BUNDLED WITH
data/bin/bmde CHANGED
@@ -8,4 +8,106 @@ Bundler.require(:default)
8
8
 
9
9
  require_relative '../lib/markdown_exec'
10
10
 
11
- MarkdownExec::MarkParse.new.run
11
+ if true
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
@@ -13,7 +13,7 @@ __filedirs_all()
13
13
  }
14
14
 
15
15
  _mde_echo_version() {
16
- echo "1.4.1"
16
+ echo "1.6"
17
17
  }
18
18
 
19
19
  _mde() {
@@ -138,4 +138,4 @@ _mde() {
138
138
 
139
139
  complete -o filenames -o nospace -F _mde mde
140
140
  # _mde_echo_version
141
- # echo "Updated: 2023-11-02 13:20:09 UTC"
141
+ # echo "Updated: 2023-11-13 16:19:21 UTC"
data/examples/opts.md CHANGED
@@ -4,10 +4,19 @@
4
4
 
5
5
  ```opts :opts1
6
6
  menu_divider_color: yellow
7
+ menu_note_match:
7
8
  menu_task_color: fg_rgb_255_63_255
8
9
  ```
9
10
 
10
11
  ```opts :opts2
11
- menu_divider_color: fg_rgb_255_0_255
12
+ menu_divider_color: red
13
+ menu_note_color: yellow
14
+ menu_note_match: "^\\+ +(?<line>.+?) *$"
12
15
  menu_task_color: fg_rgb_127_127_255
13
16
  ```
17
+
18
+ ```opts :(document_options)
19
+ menu_divider_color: green
20
+ menu_link_color: fg_rgbh_88_cc_66
21
+ menu_note_color: yellow
22
+ ```
data/lib/block_types.rb CHANGED
@@ -1,7 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- BLOCK_TYPE_BASH = 'bash'
4
- BLOCK_TYPE_LINK = 'link'
5
- BLOCK_TYPE_OPTS = 'opts'
6
- BLOCK_TYPE_PORT = 'port'
7
- BLOCK_TYPE_VARS = 'vars'
3
+ class BlockType
4
+ ALL = [
5
+ BASH = 'bash',
6
+ LINK = 'link',
7
+ OPTS = 'opts',
8
+ PORT = 'port',
9
+ VARS = 'vars'
10
+ ].freeze
11
+ end
data/lib/filter.rb CHANGED
@@ -125,7 +125,7 @@ module MarkdownExec
125
125
 
126
126
  return unless options[:bash_only]
127
127
 
128
- filters[:shell_default] = (shell == BLOCK_TYPE_BASH)
128
+ filters[:shell_default] = (shell == BlockType::BASH)
129
129
  end
130
130
 
131
131
  # Evaluates the filter settings to make a final decision on
@@ -138,8 +138,8 @@ module MarkdownExec
138
138
  # if it should be excluded.
139
139
  #
140
140
  def self.evaluate_filters(options, filters)
141
- if options[:no_chrome] && filters[:fcb_chrome] == true
142
- false
141
+ if filters[:fcb_chrome] == true
142
+ !options[:no_chrome]
143
143
  elsif options[:exclude_expect_blocks] && filters[:shell_expect] == true
144
144
  false
145
145
  elsif filters[:hidden_name] == true
@@ -159,6 +159,17 @@ module MarkdownExec
159
159
  true
160
160
  end
161
161
  end
162
+
163
+ # blocks for menu, without missing exit and back chrome
164
+ # remove hidden blocks
165
+ #
166
+ def self.prepared_not_in_menu?(options, fcb)
167
+ fcb[:shell] == BlockType::BASH &&
168
+ ((options[:block_name_include_match].present? &&
169
+ fcb[:oname] =~ /#{options[:block_name_include_match]}/) ||
170
+ (options[:block_name_wrapper_match].present? &&
171
+ fcb[:oname] =~ /#{options[:block_name_wrapper_match]}/))
172
+ end
162
173
  end
163
174
  end
164
175
 
@@ -239,7 +250,7 @@ if $PROGRAM_NAME == __FILE__
239
250
 
240
251
  def test_bash_only_condition_true
241
252
  @options[:bash_only] = true
242
- @fcb[:shell] = BLOCK_TYPE_BASH
253
+ @fcb[:shell] = BlockType::BASH
243
254
  assert Filter.fcb_select?(@options, @fcb)
244
255
  end
245
256
 
@@ -7,5 +7,5 @@ module MarkdownExec
7
7
  BIN_NAME = 'mde'
8
8
  GEM_NAME = 'markdown_exec'
9
9
  TAP_DEBUG = 'MDE_DEBUG'
10
- VERSION = '1.4.1'
10
+ VERSION = '1.6'
11
11
  end