markdown_exec 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -94,13 +94,18 @@ class InputSequencer
94
94
  break if exit_when_bq_empty && bq_is_empty? && !now_menu.prior_block_was_link
95
95
 
96
96
  if now_menu.display_menu
97
+ # !!b
97
98
  break if run_yield(:end_of_cli, &block) == :exit
99
+ # !!b
98
100
 
99
101
  exit_when_bq_empty = false
100
102
  run_yield :display_menu, &block
103
+ # !!b
101
104
 
102
105
  choice = run_yield :user_choice, &block
106
+ # !!b
103
107
  break if choice == :break
108
+ # !!b
104
109
 
105
110
  raise BlockMissing, 'Block not recognized.' if choice.nil?
106
111
  # Exit loop and method to terminate the app
@@ -115,7 +120,9 @@ class InputSequencer
115
120
  if now_menu.block_name && !now_menu.block_name.empty?
116
121
  block_name = now_menu.block_name
117
122
  else
123
+ # break if bq_is_empty? # Exit loop if no more blocks to process
118
124
  if bq_is_empty? # Exit loop if no more blocks to process
125
+ # !!b
119
126
  run_yield :end_of_cli, &block
120
127
  break
121
128
  end
@@ -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 = '2.7.1'
10
+ VERSION = '2.7.3'
11
11
  end
data/lib/markdown_exec.rb CHANGED
@@ -19,7 +19,6 @@ require_relative 'ansi_formatter'
19
19
  require_relative 'cached_nested_file_reader'
20
20
  require_relative 'cli'
21
21
  require_relative 'color_scheme'
22
- require_relative 'colorize'
23
22
  require_relative 'directory_searcher'
24
23
  require_relative 'env'
25
24
  require_relative 'exceptions'
@@ -95,7 +94,7 @@ class NamedCaptureExtractor
95
94
  str&.match(regexp)&.named_captures&.transform_keys(&:to_sym)
96
95
  end
97
96
 
98
- def self.extract_named_group2(match_data)
97
+ def self.extract_named_group_match_data(match_data)
99
98
  match_data&.named_captures&.transform_keys(&:to_sym)
100
99
  end
101
100
  end
data/lib/mdoc.rb CHANGED
@@ -177,12 +177,12 @@ module MarkdownExec
177
177
  blocks.map do |block|
178
178
  (block[:wraps] || []).map do |wrap|
179
179
  wrap_before = wrap.sub('}', '-before}') ### hardcoded wrap name
180
- @table.select { |fcb| [wrap_before, wrap].include? fcb.oname }
180
+ @table.select { |fcb| fcb.code_name_included?(wrap_before, wrap) }
181
181
  end.flatten(1) +
182
182
  [block] +
183
183
  (block[:wraps] || []).reverse.map do |wrap|
184
184
  wrap_after = wrap.sub('}', '-after}') ### hardcoded wrap name
185
- @table.select { |fcb| fcb.oname == wrap_after }
185
+ @table.select { |fcb| fcb.code_name_included?(wrap_after) }
186
186
  end.flatten(1)
187
187
  end.flatten(1).compact
188
188
  end
@@ -623,25 +623,22 @@ if $PROGRAM_NAME == __FILE__
623
623
  # Mocking the @table object for testing
624
624
  def setup
625
625
  @table = [
626
- OpenStruct.new(oname: '{wrap1}'),
627
- OpenStruct.new(oname: '{wrap2-before}'),
628
- OpenStruct.new(oname: '{wrap2}'),
629
- OpenStruct.new(oname: '{wrap2-after}'),
630
- OpenStruct.new(oname: '{wrap3-before}'),
631
- OpenStruct.new(oname: '{wrap3}'),
632
- OpenStruct.new(oname: '{wrap3-after}')
626
+ FCB.new(oname: '{wrap1}'),
627
+ FCB.new(oname: '{wrap2-before}'),
628
+ FCB.new(oname: '{wrap2}'),
629
+ FCB.new(oname: '{wrap2-after}'),
630
+ FCB.new(oname: '{wrap3-before}'),
631
+ FCB.new(oname: '{wrap3}'),
632
+ FCB.new(oname: '{wrap3-after}')
633
633
  ]
634
634
  @mdoc = MDoc.new(@table)
635
635
  end
636
636
 
637
637
  def test_collect_wrapped_blocks
638
638
  # Test case 1: blocks with wraps
639
- OpenStruct.new(oname: 'block1')
640
-
641
639
  assert_equal(%w[{wrap2-before} {wrap2} b {wrap2-after}],
642
640
  @mdoc.collect_wrapped_blocks(
643
- [OpenStruct.new(oname: 'b',
644
- wraps: ['{wrap2}'])]
641
+ [FCB.new(oname: 'b', wraps: ['{wrap2}'])]
645
642
  ).map(&:oname))
646
643
 
647
644
  assert_equal(%w[{wrap2-before} {wrap2} {wrap3-before} {wrap3} c {wrap3-after} {wrap2-after}],
data/lib/menu.src.yml CHANGED
@@ -200,6 +200,12 @@
200
200
  :default: "(document_opts)"
201
201
  :procname: val_as_str
202
202
 
203
+ - :opt_name: document_load_shell_block_name
204
+ :env_var: MDE_DOCUMENT_LOAD_SHELL_BLOCK_NAME
205
+ :description: Name of shell block to load with the document
206
+ :default: "(document_shell)"
207
+ :procname: val_as_str
208
+
203
209
  - :opt_name: document_load_vars_block_name
204
210
  :env_var: MDE_DOCUMENT_LOAD_VARS_BLOCK_NAME
205
211
  :description: Name of Vars block to load with the document
@@ -676,8 +682,7 @@
676
682
  :env_var: MDE_MENU_ACTIVE_COLOR_PASTEL_MESSAGES
677
683
  :description: menu_active_color_pastel_messages
678
684
  :default:
679
- - bright_magenta
680
- - on_black
685
+ - inverse
681
686
 
682
687
  - :opt_name: menu_back_at_top
683
688
  :env_var: MDE_MENU_BACK_AT_TOP
@@ -899,11 +904,10 @@
899
904
  :procname: val_as_str
900
905
 
901
906
  ## lines that start with "/" are comments (hidden), not notes (visible)
902
- # - :default: "^(?<indent>[ \t]*)(?<line>(?!/)(?<text>.*?)(?<trailing>[ \t]*))?$"
903
907
  - :opt_name: menu_note_match
904
908
  :env_var: MDE_MENU_NOTE_MATCH
905
909
  :description: Pattern for notes in block selection menu
906
- :default: "^(?<line>(?![ \t]*/)(?<text>.*?)(?<trailing>[ \t]*))$"
910
+ :default: "^(?<indent>[ \t]*)(?<line>(?!/)(?<text>.*?)(?<trailing>[ \t]*))?$"
907
911
  :procname: val_as_str
908
912
 
909
913
  - :opt_name: menu_option_back_name
data/lib/menu.yml CHANGED
@@ -166,6 +166,11 @@
166
166
  :description: Name of Opts block to load with the document
167
167
  :default: "(document_opts)"
168
168
  :procname: val_as_str
169
+ - :opt_name: document_load_shell_block_name
170
+ :env_var: MDE_DOCUMENT_LOAD_SHELL_BLOCK_NAME
171
+ :description: Name of shell block to load with the document
172
+ :default: "(document_shell)"
173
+ :procname: val_as_str
169
174
  - :opt_name: document_load_vars_block_name
170
175
  :env_var: MDE_DOCUMENT_LOAD_VARS_BLOCK_NAME
171
176
  :description: Name of Vars block to load with the document
@@ -572,8 +577,7 @@
572
577
  :env_var: MDE_MENU_ACTIVE_COLOR_PASTEL_MESSAGES
573
578
  :description: menu_active_color_pastel_messages
574
579
  :default:
575
- - bright_magenta
576
- - on_black
580
+ - inverse
577
581
  - :opt_name: menu_back_at_top
578
582
  :env_var: MDE_MENU_BACK_AT_TOP
579
583
  :description: Display Back option at top of menu (vs bottom)
@@ -762,7 +766,7 @@
762
766
  - :opt_name: menu_note_match
763
767
  :env_var: MDE_MENU_NOTE_MATCH
764
768
  :description: Pattern for notes in block selection menu
765
- :default: "^(?<line>(?![ \t]*/)(?<text>.*?)(?<trailing>[ \t]*))$"
769
+ :default: "^(?<indent>[ \t]*)(?<line>(?!/)(?<text>.*?)(?<trailing>[ \t]*))?$"
766
770
  :procname: val_as_str
767
771
  - :opt_name: menu_option_back_name
768
772
  :env_var: MDE_MENU_OPTION_BACK_NAME
data/lib/ww.rb CHANGED
@@ -15,7 +15,7 @@ if $debug && ENV['WW_MINIMUM'].nil?
15
15
  end
16
16
 
17
17
  def ww(*objs, **kwargs)
18
- return unless $debug
18
+ return objs.size == 1 ? objs.first : objs unless $debug
19
19
 
20
20
  ww0(*objs, **kwargs.merge(locations: caller_locations))
21
21
  end
@@ -70,11 +70,13 @@ def ww0(*objs,
70
70
  output.flush
71
71
 
72
72
  # Optionally log to a file
73
- return unless log_file
73
+ return objs.size == 1 ? objs.first : objs unless log_file
74
74
 
75
75
  File.open(log_file, 'a') do |file|
76
76
  file.puts(formatted_message)
77
77
  end
78
+
79
+ objs.size == 1 ? objs.first : objs
78
80
  end
79
81
 
80
82
  class Array
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: 2.7.1
4
+ version: 2.7.3
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-12-10 00:00:00.000000000 Z
11
+ date: 2025-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -107,12 +107,17 @@ files:
107
107
  - assets/select_a_block.png
108
108
  - assets/select_a_file.png
109
109
  - bats/bats.bats
110
+ - bats/block-type-opts.bats
111
+ - bats/block-type-vars.bats
110
112
  - bats/block-types.bats
113
+ - bats/border.bats
111
114
  - bats/cli.bats
112
115
  - bats/command-substitution.bats
116
+ - bats/document-shell.bats
113
117
  - bats/fail.bats
114
118
  - bats/history.bats
115
119
  - bats/import.bats
120
+ - bats/line-wrapping.bats
116
121
  - bats/markup.bats
117
122
  - bats/mde.bats
118
123
  - bats/options-collapse.bats
@@ -134,11 +139,14 @@ files:
134
139
  - docs/dev/block-type-opts.md
135
140
  - docs/dev/block-type-port.md
136
141
  - docs/dev/block-type-vars.md
142
+ - docs/dev/border.md
137
143
  - docs/dev/command-substitution.md
138
144
  - docs/dev/data-blocks.md
139
145
  - docs/dev/disable.md
146
+ - docs/dev/document-shell.md
140
147
  - docs/dev/import-missing.md
141
148
  - docs/dev/import.md
149
+ - docs/dev/line-wrapping.md
142
150
  - docs/dev/linked-file.md
143
151
  - docs/dev/load1.sh
144
152
  - docs/dev/load_code.md
@@ -197,7 +205,7 @@ files:
197
205
  - examples/variable-expansion-save-block.md
198
206
  - examples/variable-expansion.md
199
207
  - examples/vars-blocks.md
200
- - examples/wrap.md
208
+ - examples/wrapped-blocks.md
201
209
  - lib/ansi_formatter.rb
202
210
  - lib/ansi_string.rb
203
211
  - lib/argument_processor.rb
File without changes