markdown_exec 1.8.9 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,229 @@
1
+ #!/usr/bin/env bundle exec ruby
2
+ # frozen_string_literal: true
3
+
4
+ # encoding=utf-8
5
+
6
+ require_relative 'dev/instance_method_wrapper' # for ImwUx
7
+ require_relative 'env'
8
+ require_relative 'link_history'
9
+
10
+ # InputSequencer manages the sequence of menu interactions and block executions based on user input.
11
+ class InputSequencer
12
+ # extend ImwUx # This makes imw_indent available as a class method
13
+ # include ImwUx # This makes imw_indent available as a class method
14
+
15
+ # self.prepend InstanceMethodWrapper # traps initialize as well
16
+ attr_reader :document_filename, :current_block, :block_queue
17
+
18
+ def initialize(document_filename, initial_blocks = nil)
19
+ @document_filename = document_filename
20
+ @current_block = nil
21
+ @block_queue = initial_blocks
22
+ @debug = Env::env_bool('INPUT_SEQUENCER_DEBUG', default: false) ### false e
23
+ end
24
+
25
+ # Merges the current menu state with the next, prioritizing the next state's values.
26
+ def self.merge_link_state(current, next_state)
27
+ MarkdownExec::LinkState.new(
28
+ block_name: next_state.block_name,
29
+ display_menu: next_state.display_menu.nil? ? current.display_menu : next_state.display_menu,
30
+ document_filename: next_state.document_filename || current.document_filename,
31
+ inherited_block_names: next_state.inherited_block_names,
32
+ inherited_dependencies: next_state.inherited_dependencies,
33
+ inherited_lines: next_state.inherited_lines,
34
+ prior_block_was_link: next_state.prior_block_was_link.nil? ? current.prior_block_was_link : next_state.prior_block_was_link
35
+ )
36
+ rescue
37
+ binding.irb
38
+ end
39
+
40
+ # Generates the next menu state based on provided attributes.
41
+
42
+ def self.next_link_state(block_name: nil, display_menu: nil, document_filename: nil, prior_block_was_link: false)
43
+ MarkdownExec::LinkState.new(
44
+ block_name: block_name,
45
+ display_menu: display_menu,
46
+ document_filename: document_filename,
47
+ prior_block_was_link: prior_block_was_link
48
+ )
49
+ end
50
+
51
+ # Orchestrates the flow of menu states and user interactions.
52
+ def run_yield(sym, *args, &block)
53
+ block.call sym, *args
54
+ end
55
+
56
+ def bq_is_empty?
57
+ !@block_queue || @block_queue.empty?
58
+ end
59
+
60
+ # Orchestrates the flow of menu states and user interactions.
61
+ def run(&block)
62
+ now_menu = InputSequencer.next_link_state(
63
+ display_menu: bq_is_empty?,
64
+ document_filename: @document_filename,
65
+ prior_block_was_link: false # true bypass_exit when last block was a link (from cli)
66
+ )
67
+ exit_when_bq_empty = !bq_is_empty? # true when running blocks from cli; unless "stay" is used
68
+ loop do
69
+ break if run_yield(:parse_document, now_menu.document_filename, &block) == :break
70
+
71
+ pp [__LINE__, 'exit_when_bq_empty', exit_when_bq_empty, '@block_queue', @block_queue, 'now_menu', now_menu] if @debug
72
+ # self.imw_ins now_menu, 'now_menu'
73
+
74
+ break if exit_when_bq_empty && bq_is_empty? && !now_menu.prior_block_was_link
75
+
76
+ if now_menu.display_menu
77
+ exit_when_bq_empty = false
78
+
79
+ run_yield :display_menu, &block
80
+
81
+ choice = run_yield :user_choice, &block
82
+
83
+ break if run_yield(:exit?, choice&.downcase, &block) # Exit loop and method to terminate the app
84
+
85
+ next_state = run_yield :execute_block, choice, &block
86
+ # imw_ins next_state, 'next_state'
87
+ pp [__LINE__, 'next_state', next_state] if @debug
88
+ return :break if next_state == :break
89
+
90
+ next_menu = next_state
91
+
92
+ else
93
+ if now_menu.block_name && !now_menu.block_name.empty?
94
+ block_name = now_menu.block_name
95
+ else
96
+ break if bq_is_empty? # Exit loop if no more blocks to process
97
+
98
+ block_name = @block_queue.shift
99
+ end
100
+ # self.imw_ins block_name, 'block_name'
101
+ pp [__LINE__, 'block_name', block_name] if @debug
102
+
103
+ next_menu = if block_name == '.'
104
+ exit_when_bq_empty = false
105
+ InputSequencer.next_link_state(display_menu: true)
106
+ else
107
+ state = run_yield :execute_block, block_name, &block
108
+ state.display_menu = bq_is_empty?
109
+ state
110
+ end
111
+ pp [__LINE__, 'next_menu', next_menu] if @debug
112
+ next_menu
113
+ # imw_ins next_menu, 'next_menu'
114
+ end
115
+ now_menu = InputSequencer.merge_link_state(now_menu, next_menu)
116
+ end
117
+ rescue
118
+ binding.irb
119
+ end
120
+ end
121
+
122
+ return if __FILE__ != $PROGRAM_NAME
123
+
124
+ $doc1 = {
125
+ 'b1' => 'Content of bash1',
126
+ 'b2' => 'Content of bash2',
127
+ 'b3' => 'Content of bash3',
128
+ 'l1' => { 'block_name' => 'b1', 'document_filename' => 'd1' },
129
+ 'l2' => { 'block_name' => 'b2', 'document_filename' => 'd2' },
130
+ 'l3' => { 'block_name' => 'b3' }
131
+ }.freeze
132
+ $stay = '.' # keep menu open (from command line)
133
+ $texit = 'x'
134
+
135
+ class MDE
136
+ # extend ImwUx # This makes imw_indent available as a class method
137
+ # include ImwUx # This makes imw_indent available as a class method
138
+
139
+ def initialize(document_filename, initial_blocks = [])
140
+ @inpseq = InputSequencer.new(document_filename, initial_blocks)
141
+ end
142
+
143
+ def do_run
144
+ @inpseq.run do |msg, data|
145
+ case msg
146
+ when :parse_document # once for each menu
147
+ # self.imw_ins data, '@ - parse document'
148
+ parse_document(data)
149
+ when :display_menu
150
+ puts "? - Select a block to execute (or type #{$texit} to exit):"
151
+ puts "doc: #{@document_filename}"
152
+ display_menu
153
+ when :user_choice
154
+ $stdin.gets.chomp
155
+ when :execute_block
156
+ # self.imw_ins data, "! - Executing block"
157
+ execute_block(data)
158
+ when :exit?
159
+ data == $texit
160
+ when :stay?
161
+ data == $stay
162
+ else
163
+ raise "Invalid message: #{msg}"
164
+ end
165
+ end
166
+ end
167
+
168
+ private
169
+
170
+ def display_menu
171
+ @blocks.each_key { |block| puts block }
172
+ puts $texit
173
+ end
174
+
175
+ def execute_block(block_name)
176
+ content = @blocks[block_name]
177
+ if content
178
+ puts content
179
+ if block_name.start_with?('l')
180
+ interpret_link_block(content)
181
+ else
182
+ InputSequencer.next_link_state
183
+ end
184
+ else
185
+ puts "! - Block not found: #{block_name}"
186
+ InputSequencer.next_link_state
187
+ end
188
+ end
189
+
190
+ def interpret_link_block(content)
191
+ # Stub: Interpret a "Link" block, extracting directives for the next action
192
+ # In a real implementation, this would parse the content for next block or document
193
+ puts "! - Interpreting Link block: #{content}"
194
+ InputSequencer.next_link_state(
195
+ block_name: content.fetch('block_name', nil),
196
+ document_filename: content.fetch('document_filename', nil),
197
+ prior_block_was_link: true
198
+ )
199
+ end
200
+
201
+ def load_document(_name)
202
+ # Stub: Load and return the content of the document
203
+ # In a real implementation, this would read the file and return its content
204
+ # "Block 1: Content of block 1\nBlock 2: Content of block 2\nLink: block_name 3, document_filename doc2"
205
+ $doc1.map { |key, value| "#{key}: #{value}" }.join("\n")
206
+ end
207
+
208
+ def parse_document(data)
209
+ load_document(data)
210
+ # Stub: Parse document content into blocks
211
+ # In a real implementation, this would split the document into named blocks
212
+ @blocks = $doc1
213
+ end
214
+ end
215
+ # MDE.singleton_class.prepend(ImwUx)
216
+ # MDE.prepend(ImwUx)
217
+
218
+ def main
219
+ if ARGV.empty?
220
+ puts "Usage: #{__FILE__} document_filename [block_name...]"
221
+ exit(1)
222
+ end
223
+ document_filename = ARGV.shift
224
+ initial_blocks = ARGV
225
+ mde = MDE.new(document_filename, initial_blocks)
226
+ mde.do_run
227
+ end
228
+
229
+ main
data/lib/link_history.rb CHANGED
@@ -4,8 +4,9 @@
4
4
  # encoding=utf-8
5
5
  module MarkdownExec
6
6
  class LinkState
7
- attr_accessor :block_name, :document_filename,
8
- :inherited_block_names, :inherited_dependencies, :inherited_lines
7
+ attr_accessor :block_name, :display_menu, :document_filename,
8
+ :inherited_block_names, :inherited_dependencies, :inherited_lines,
9
+ :prior_block_was_link
9
10
 
10
11
  # Initialize the LinkState with keyword arguments for each attribute.
11
12
  # @param block_name [String, nil] the name of the block.
@@ -13,13 +14,16 @@ module MarkdownExec
13
14
  # @param inherited_block_names [Array<String>, nil] the names of the inherited blocks.
14
15
  # @param inherited_dependencies [?, nil] the dependecy hierarcy.
15
16
  # @param inherited_lines [Array<String>, nil] the inherited lines of code.
16
- def initialize(block_name: nil, document_filename: nil,
17
- inherited_block_names: [], inherited_dependencies: nil, inherited_lines: nil)
17
+ def initialize(block_name: nil, display_menu: nil, document_filename: nil,
18
+ inherited_block_names: [], inherited_dependencies: nil, inherited_lines: nil,
19
+ prior_block_was_link: nil)
18
20
  @block_name = block_name
21
+ @display_menu = display_menu
19
22
  @document_filename = document_filename
20
23
  @inherited_block_names = inherited_block_names
21
24
  @inherited_dependencies = inherited_dependencies
22
25
  @inherited_lines = inherited_lines
26
+ @prior_block_was_link = prior_block_was_link
23
27
  end
24
28
 
25
29
  # Creates an empty LinkState instance.
@@ -34,10 +38,12 @@ module MarkdownExec
34
38
  def ==(other)
35
39
  other.class == self.class &&
36
40
  other.block_name == block_name &&
41
+ other.display_menu == display_menu &&
37
42
  other.document_filename == document_filename &&
38
43
  other.inherited_block_names == inherited_block_names &&
39
44
  other.inherited_dependencies == inherited_dependencies &&
40
- other.inherited_lines == inherited_lines
45
+ other.inherited_lines == inherited_lines &&
46
+ other.prior_block_was_link == prior_block_was_link
41
47
  end
42
48
  end
43
49
 
@@ -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.8.9'
10
+ VERSION = '2.0.0'
11
11
  end
data/lib/markdown_exec.rb CHANGED
@@ -10,6 +10,7 @@ require 'open3'
10
10
  require 'optparse'
11
11
  require 'shellwords'
12
12
  require 'tmpdir'
13
+ # require 'tty-file'
13
14
  require 'tty-prompt'
14
15
  require 'yaml'
15
16
 
@@ -25,6 +26,7 @@ require_relative 'fcb'
25
26
  require_relative 'filter'
26
27
  require_relative 'fout'
27
28
  require_relative 'hash_delegator'
29
+ require_relative 'input_sequencer'
28
30
  require_relative 'markdown_exec/version'
29
31
  require_relative 'mdoc'
30
32
  require_relative 'option_value'
@@ -103,7 +105,6 @@ module MarkdownExec
103
105
 
104
106
  ##
105
107
  #
106
- # rubocop:disable Layout/LineLength
107
108
  # :reek:DuplicateMethodCall { allow_calls: ['block', 'item', 'lm', 'opts', 'option', '@options', 'required_blocks'] }
108
109
  # rubocop:enable Layout/LineLength
109
110
  # :reek:MissingSafeMethod { exclude: [ read_configuration_file! ] }
@@ -293,15 +294,12 @@ module MarkdownExec
293
294
 
294
295
  ## position 1: block name (optional)
295
296
  #
296
- block_name = rest.shift
297
- @options[:block_name] = block_name if block_name.present?
297
+ @options[:block_name] = nil
298
298
  @options[:input_cli_rest] = @rest
299
299
  rescue FileMissingError
300
300
  warn_format('finalize_cli_argument_processing',
301
301
  "File missing -- #{$!}", { abort: true })
302
- # @options[:block_name] = ''
303
- # @options[:filename] = ''
304
- # exit 1
302
+ exit 1
305
303
  rescue StandardError
306
304
  error_handler('finalize_cli_argument_processing')
307
305
  end
data/lib/mdoc.rb CHANGED
@@ -70,10 +70,10 @@ module MarkdownExec
70
70
  # @param name [String] The name of the code block to start the retrieval from.
71
71
  # @return [Array<Hash>] An array of code blocks required by the specified code block.
72
72
  #
73
- def collect_block_dependencies(name)
74
- name_block = get_block_by_anyname(name)
73
+ def collect_block_dependencies(anyname:)
74
+ name_block = get_block_by_anyname(anyname)
75
75
  if name_block.nil? || name_block.keys.empty?
76
- raise "Named code block `#{name}` not found. (@#{__LINE__})"
76
+ raise "Named code block `#{anyname}` not found. (@#{__LINE__})"
77
77
  end
78
78
 
79
79
  nickname = name_block[:nickname] || name_block[:oname]
@@ -116,9 +116,9 @@ module MarkdownExec
116
116
  # @param name [String] The name of the code block to start the collection from.
117
117
  # @return [Array<String>] An array of strings containing the collected code blocks.
118
118
  #
119
- def collect_recursively_required_code(name, block_source:, label_body: true, label_format_above: nil,
119
+ def collect_recursively_required_code(anyname:, block_source:, label_body: true, label_format_above: nil,
120
120
  label_format_below: nil)
121
- block_search = collect_block_dependencies(name)
121
+ block_search = collect_block_dependencies(anyname: anyname)
122
122
  if block_search[:blocks]
123
123
  blocks = collect_wrapped_blocks(block_search[:blocks])
124
124
  # &bc 'blocks.count:',blocks.count
@@ -453,12 +453,12 @@ if $PROGRAM_NAME == __FILE__
453
453
 
454
454
  ### broken test
455
455
  def test_collect_block_dependencies
456
- result = @doc.collect_block_dependencies('block3')[:blocks]
456
+ result = @doc.collect_block_dependencies(anyname: 'block3')[:blocks]
457
457
  expected_result = [@table[0], @table[1], @table[2]]
458
458
  assert_equal expected_result, result
459
459
 
460
460
  assert_raises(RuntimeError) do
461
- @doc.collect_block_dependencies('missing_block')
461
+ @doc.collect_block_dependencies(anyname: 'missing_block')
462
462
  end
463
463
  end
464
464
 
data/lib/menu.src.yml CHANGED
@@ -121,6 +121,22 @@
121
121
  :opt_name: dump_blocks_in_file
122
122
  :procname: val_as_bool
123
123
 
124
+ - :arg_name: BOOL
125
+ :default: false
126
+ :description: Dump inherited block_names
127
+ :env_var: MDE_DUMP_INHERITED_BLOCK_NAMES
128
+ :long_name: dump-dump-inherited-block_names
129
+ :opt_name: dump_inherited_block_names
130
+ :procname: val_as_bool
131
+
132
+ - :arg_name: BOOL
133
+ :default: false
134
+ :description: Dump inherited dependencies
135
+ :env_var: MDE_DUMP_INHERITED_DEPENDENCIES
136
+ :long_name: dump-dump-inherited-dependencies
137
+ :opt_name: dump_inherited_dependencies
138
+ :procname: val_as_bool
139
+
124
140
  - :arg_name: BOOL
125
141
  :default: false
126
142
  :description: Dump inherited lines
@@ -211,11 +227,12 @@
211
227
  tell the first window
212
228
  set bounds to {xoff, yoff, xoff + winWidth, yoff + winHeight}
213
229
  tell the current session
214
- write text "# %{script_filespec}"
215
- write text "# %{output_filespec}"
230
+ write text "s=\"%{script_filespec}\""
231
+ write text "o=\"%{output_filespec}\""
216
232
  write text "echo -ne \"\\033]; %{started_at} - %{document_filename} - %{block_name} \\007\""
217
233
  write text "cd \"%{home}\""
218
- write text "\"%{script_filename}\" | tee \"%{output_filespec}\""
234
+ write text "# \"%{script_filename}\" | tee -a \"%{output_filespec}\""
235
+ write text "\"$s\" | tee -a \"$o\""
219
236
  end tell
220
237
  end tell
221
238
  end tell'
@@ -591,9 +608,8 @@
591
608
  :opt_name: menu_note_format
592
609
  :procname: val_as_str
593
610
 
594
- ## all non-blank lines are notes
595
- #
596
- - :default: "^(?<line>.*?) *$"
611
+ ## all lines that do not start with "/ " are notes
612
+ - :default: "^(?<line>(?!/ ).*)?$"
597
613
  :description: Pattern for notes in block selection menu
598
614
  :env_var: MDE_MENU_NOTE_MATCH
599
615
  :opt_name: menu_note_match
@@ -712,21 +728,25 @@
712
728
  :env_var: MDE_OUTPUT_ASSIGNMENT_BEGIN
713
729
  :opt_name: output_assignment_begin
714
730
  :procname: val_as_str
731
+
715
732
  - :default:
716
733
  :description: Expression to match to stop collecting lines
717
734
  :env_var: MDE_OUTPUT_ASSIGNMENT_END
718
- :opt_name: output_assignment_begin
735
+ :opt_name: output_assignment_end
719
736
  :procname: val_as_str
720
- - :default: "%{line} # !!!"
737
+
738
+ - :default: "%{line}"
721
739
  :description: Format for assignments from output
722
740
  :env_var: MDE_OUTPUT_ASSIGNMENT_FORMAT
723
741
  :opt_name: output_assignment_format
724
742
  :procname: val_as_str
743
+
725
744
  - :default: "^ *(?<line>\\w+=.*?) *$"
726
745
  :description: Pattern for assignments from output
727
746
  :env_var: MDE_OUTPUT_ASSIGNMENT_MATCH
728
747
  :opt_name: output_assignment_match
729
748
  :procname: val_as_str
749
+
730
750
  - :arg_name: BOOL
731
751
  :default: false
732
752
  :description: Display summary for execution
@@ -821,12 +841,24 @@
821
841
  :opt_name: prompt_debounce
822
842
  :procname: val_as_str
823
843
 
844
+ - :default: 'Name? '
845
+ :description: Prompt to enter a filespec
846
+ :env_var: MDE_PROMPT_ENTER_FILESPEC
847
+ :opt_name: prompt_enter_filespec
848
+ :procname: val_as_str
849
+
824
850
  - :default: Exit
825
851
  :description: Prompt to exit app
826
852
  :env_var: MDE_PROMPT_EXIT
827
853
  :opt_name: prompt_exit
828
854
  :procname: val_as_str
829
855
 
856
+ - :default: Other
857
+ :description: Prompt for a custom file name
858
+ :env_var: MDE_PROMPT_FILESPEC_OTHER
859
+ :opt_name: prompt_filespec_other
860
+ :procname: val_as_str
861
+
830
862
  - :default: 'No'
831
863
  :description: Prompt for no
832
864
  :env_var: MDE_PROMPT_NO
@@ -851,6 +883,12 @@
851
883
  :opt_name: prompt_select_block
852
884
  :procname: val_as_str
853
885
 
886
+ - :default: "\nChoose a file:"
887
+ :description: Prompt to select a file with inherited lines
888
+ :env_var: MDE_PROMPT_SELECT_CODE_FILE
889
+ :opt_name: prompt_select_code_file
890
+ :procname: val_as_str
891
+
854
892
  - :default: "\nChoose a file:"
855
893
  :description: Prompt to select a markdown document
856
894
  :env_var: MDE_PROMPT_SELECT_MD
@@ -863,6 +901,12 @@
863
901
  :opt_name: prompt_select_output
864
902
  :procname: val_as_str
865
903
 
904
+ - :default: 'Expr: %{expr}'
905
+ :description: prompt_show_expr_format
906
+ :env_var: MDE_PROMPT_SHOW_EXPR_FORMAT
907
+ :opt_name: prompt_show_expr_format
908
+ :procname: val_as_str
909
+
866
910
  - :default: Uninterrupted
867
911
  :description: Uninterrupted execution
868
912
  :env_var: MDE_PROMPT_UNINTERRUPTED
@@ -1047,12 +1091,18 @@
1047
1091
  :opt_name: shell_code_label_format_above
1048
1092
  :procname: val_as_str
1049
1093
 
1050
- - :default: "# -v- +%{block_name} -o- %{document_filename} -v-"
1094
+ - :default: "# -v- +%{block_name} -o- %{document_filename} -o- %{time_now_date} -v-"
1051
1095
  :description: shell_code_label_format_below
1052
1096
  :env_var: MDE_SHELL_CODE_LABEL_FORMAT_BELOW
1053
1097
  :opt_name: shell_code_label_format_below
1054
1098
  :procname: val_as_str
1055
1099
 
1100
+ - :default: "%FT%TZ"
1101
+ :description: Format for time in code lael
1102
+ :env_var: MDE_SHELL_CODE_LABEL_TIME_FORMAT
1103
+ :opt_name: shell_code_label_time_format
1104
+ :procname: val_as_str
1105
+
1056
1106
  - :description: List tab completions
1057
1107
  :long_name: tab-completions
1058
1108
  :opt_name: tab_completions
data/lib/menu.yml CHANGED
@@ -1,4 +1,4 @@
1
- # MDE - Markdown Executor (1.8.9)
1
+ # MDE - Markdown Executor (2.0.0)
2
2
  ---
3
3
  - :description: Show current configuration values
4
4
  :procname: show_config
@@ -102,6 +102,20 @@
102
102
  :long_name: dump-blocks-in-file
103
103
  :opt_name: dump_blocks_in_file
104
104
  :procname: val_as_bool
105
+ - :arg_name: BOOL
106
+ :default: false
107
+ :description: Dump inherited block_names
108
+ :env_var: MDE_DUMP_INHERITED_BLOCK_NAMES
109
+ :long_name: dump-dump-inherited-block_names
110
+ :opt_name: dump_inherited_block_names
111
+ :procname: val_as_bool
112
+ - :arg_name: BOOL
113
+ :default: false
114
+ :description: Dump inherited dependencies
115
+ :env_var: MDE_DUMP_INHERITED_DEPENDENCIES
116
+ :long_name: dump-dump-inherited-dependencies
117
+ :opt_name: dump_inherited_dependencies
118
+ :procname: val_as_bool
105
119
  - :arg_name: BOOL
106
120
  :default: false
107
121
  :description: Dump inherited lines
@@ -173,12 +187,12 @@
173
187
  yoff to xoff mod (screenHeight - winHeight)\n \n create window with
174
188
  default profile\n tell the first window\n set bounds to {xoff,
175
189
  yoff, xoff + winWidth, yoff + winHeight}\n tell the current session\n
176
- \ write text \"# %{script_filespec}\"\n write text
177
- \"# %{output_filespec}\"\n write text \"echo -ne \\\"\\\\033];
190
+ \ write text \"s=\\\"%{script_filespec}\\\"\"\n write
191
+ text \"o=\\\"%{output_filespec}\\\"\"\n write text \"echo -ne \\\"\\\\033];
178
192
  %{started_at} - %{document_filename} - %{block_name} \\\\007\\\"\"\n write
179
- text \"cd \\\"%{home}\\\"\"\n write text \"\\\"%{script_filename}\\\"
180
- | tee \\\"%{output_filespec}\\\"\"\n end tell\n end tell\n end
181
- tell'\n"
193
+ text \"cd \\\"%{home}\\\"\"\n write text \"# \\\"%{script_filename}\\\"
194
+ | tee -a \\\"%{output_filespec}\\\"\"\n write text \"\\\"$s\\\"
195
+ | tee -a \\\"$o\\\"\"\n end tell\n end tell\n end tell'\n"
182
196
  :description: execute_command_format
183
197
  :env_var: MDE_EXECUTE_COMMAND_FORMAT
184
198
  :opt_name: execute_command_format
@@ -491,7 +505,7 @@
491
505
  :env_var: MDE_MENU_NOTE_FORMAT
492
506
  :opt_name: menu_note_format
493
507
  :procname: val_as_str
494
- - :default: "^(?<line>.*?) *$"
508
+ - :default: "^(?<line>(?!/ ).*)?$"
495
509
  :description: Pattern for notes in block selection menu
496
510
  :env_var: MDE_MENU_NOTE_MATCH
497
511
  :opt_name: menu_note_match
@@ -595,9 +609,9 @@
595
609
  - :default:
596
610
  :description: Expression to match to stop collecting lines
597
611
  :env_var: MDE_OUTPUT_ASSIGNMENT_END
598
- :opt_name: output_assignment_begin
612
+ :opt_name: output_assignment_end
599
613
  :procname: val_as_str
600
- - :default: "%{line} # !!!"
614
+ - :default: "%{line}"
601
615
  :description: Format for assignments from output
602
616
  :env_var: MDE_OUTPUT_ASSIGNMENT_FORMAT
603
617
  :opt_name: output_assignment_format
@@ -693,11 +707,21 @@
693
707
  :env_var: MDE_PROMPT_DEBOUNCE
694
708
  :opt_name: prompt_debounce
695
709
  :procname: val_as_str
710
+ - :default: 'Name? '
711
+ :description: Prompt to enter a filespec
712
+ :env_var: MDE_PROMPT_ENTER_FILESPEC
713
+ :opt_name: prompt_enter_filespec
714
+ :procname: val_as_str
696
715
  - :default: Exit
697
716
  :description: Prompt to exit app
698
717
  :env_var: MDE_PROMPT_EXIT
699
718
  :opt_name: prompt_exit
700
719
  :procname: val_as_str
720
+ - :default: Other
721
+ :description: Prompt for a custom file name
722
+ :env_var: MDE_PROMPT_FILESPEC_OTHER
723
+ :opt_name: prompt_filespec_other
724
+ :procname: val_as_str
701
725
  - :default: 'No'
702
726
  :description: Prompt for no
703
727
  :env_var: MDE_PROMPT_NO
@@ -722,6 +746,13 @@
722
746
  :procname: val_as_str
723
747
  - :default: |2-
724
748
 
749
+ Choose a file:
750
+ :description: Prompt to select a file with inherited lines
751
+ :env_var: MDE_PROMPT_SELECT_CODE_FILE
752
+ :opt_name: prompt_select_code_file
753
+ :procname: val_as_str
754
+ - :default: |2-
755
+
725
756
  Choose a file:
726
757
  :description: Prompt to select a markdown document
727
758
  :env_var: MDE_PROMPT_SELECT_MD
@@ -734,6 +765,11 @@
734
765
  :env_var: MDE_PROMPT_SELECT_OUTPUT
735
766
  :opt_name: prompt_select_output
736
767
  :procname: val_as_str
768
+ - :default: 'Expr: %{expr}'
769
+ :description: prompt_show_expr_format
770
+ :env_var: MDE_PROMPT_SHOW_EXPR_FORMAT
771
+ :opt_name: prompt_show_expr_format
772
+ :procname: val_as_str
737
773
  - :default: Uninterrupted
738
774
  :description: Uninterrupted execution
739
775
  :env_var: MDE_PROMPT_UNINTERRUPTED
@@ -894,11 +930,17 @@
894
930
  :env_var: MDE_SHELL_CODE_LABEL_FORMAT_ABOVE
895
931
  :opt_name: shell_code_label_format_above
896
932
  :procname: val_as_str
897
- - :default: "# -v- +%{block_name} -o- %{document_filename} -v-"
933
+ - :default: "# -v- +%{block_name} -o- %{document_filename} -o- %{time_now_date}
934
+ \ -v-"
898
935
  :description: shell_code_label_format_below
899
936
  :env_var: MDE_SHELL_CODE_LABEL_FORMAT_BELOW
900
937
  :opt_name: shell_code_label_format_below
901
938
  :procname: val_as_str
939
+ - :default: "%FT%TZ"
940
+ :description: Format for time in code lael
941
+ :env_var: MDE_SHELL_CODE_LABEL_TIME_FORMAT
942
+ :opt_name: shell_code_label_time_format
943
+ :procname: val_as_str
902
944
  - :description: List tab completions
903
945
  :long_name: tab-completions
904
946
  :opt_name: tab_completions
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_exec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.9
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fareed Stevenson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-20 00:00:00.000000000 Z
11
+ date: 2024-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -114,16 +114,18 @@ files:
114
114
  - bin/tab_completion.sh
115
115
  - bin/tab_completion.sh.erb
116
116
  - examples/colors.md
117
+ - examples/document_options.md
117
118
  - examples/duplicate_block.md
118
119
  - examples/import0.md
119
120
  - examples/import1.md
120
121
  - examples/include.md
121
122
  - examples/indent.md
122
- - examples/infile_config.md
123
+ - examples/index.md
123
124
  - examples/linked.md
124
125
  - examples/linked1.md
125
126
  - examples/linked2.md
126
127
  - examples/linked3.md
128
+ - examples/llm.md
127
129
  - examples/load1.sh
128
130
  - examples/load2.sh
129
131
  - examples/nickname.md
@@ -152,6 +154,7 @@ files:
152
154
  - lib/fout.rb
153
155
  - lib/hash.rb
154
156
  - lib/hash_delegator.rb
157
+ - lib/input_sequencer.rb
155
158
  - lib/link_history.rb
156
159
  - lib/markdown_exec.rb
157
160
  - lib/markdown_exec/version.rb