markdown_exec 3.0.6 → 3.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e90e469ce0209e21b14e2534769a953c7d8122a97e9fe22714e346620e5a3b46
4
- data.tar.gz: 8edf46cc55bb88b2d8cb32a147ce9c730d7951ec1e87b249f346cb5aa226d836
3
+ metadata.gz: fd2355b28f935804fb135a650cc4260276be2bed20a8ed33cf9d188e01734466
4
+ data.tar.gz: 9e001b6252ebc4f012408e8a43373ab49b474d72982fc9bbc653c93e6d39c497
5
5
  SHA512:
6
- metadata.gz: 8da075848dc51de098e42f6f09aaa99914c53604f892c473e9ea834cf99c9e3e9a9fa7e41604991c1d912ff637a186e6e4b5c9dfc3d7d2fbdffc9245262e5c4f
7
- data.tar.gz: 892adbee4f68a4a1aedaf8aedd10baffa724f31454b31e8384def5eb97f4d5bb06e50f777a33afaa92fb1c1b2fd42c022a405208dbf41ba9d0ac31a0680145f2
6
+ metadata.gz: a17c1e662569ae1b0f34ecbb63571120c3d56bc2efdde29651240ec6d6d07e0f24e361ae9c95d34725f5c9f6a1c2d6f18fc9aad9971bdba3e2b2f850f14418d5
7
+ data.tar.gz: 95184776dfde2e6579aa18e0893a9f54180c2b641d65263f0d47f5533512611f3b92c9012959bb18c0c263ca3f50dccc42e4f69651f46a4af878d02784ce40ba
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (3.0.6)
4
+ markdown_exec (3.0.8)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -14,45 +14,6 @@
14
14
  # result.new_field = 42
15
15
  # result.new_field # => 42
16
16
  # result.success? # => true
17
-
18
- # require 'ostruct'
19
-
20
- # class CommandResult < OpenStruct
21
- # def initialize(**attributes)
22
- # # Set defaults
23
- # defaults = { exit_status: 0, stdout: '' }
24
- # super(defaults.merge(attributes))
25
- # end
26
-
27
- # def failure?
28
- # !success?
29
- # end
30
-
31
- # def success?
32
- # exit_status.zero?
33
- # end
34
-
35
- # # intercept specific getters and setters
36
- # def new_lines
37
- # # read current value
38
- # # binding.irb
39
- # v = self[:new_lines]
40
- # ww caller.deref[0..4], v
41
- # v
42
- # end
43
-
44
- # # Intercept specific setter
45
- # def new_lines=(value)
46
- # ww caller.deref[0..4], value
47
- # # binding.irb
48
- # super(value)
49
- # end
50
- # end
51
-
52
-
53
-
54
-
55
-
56
17
  class CommandResult
57
18
  # @param attributes [Hash{Symbol=>Object}] initial named attributes
58
19
  def initialize(**attributes)
@@ -71,17 +32,17 @@ class CommandResult
71
32
  exit_status.zero?
72
33
  end
73
34
 
74
- def new_lines
75
- value = @attributes[:new_lines]
76
- ww caller.deref[0..4], value
77
- value
78
- end
79
-
80
- # trap assignment to new_lines
81
- def new_lines=(value)
82
- ww caller.deref[0..4], value
83
- @attributes[:new_lines] = value
84
- end
35
+ # def new_lines
36
+ # value = @attributes[:new_lines]
37
+ # ww caller.deref[0..4], value
38
+ # value
39
+ # end
40
+
41
+ # # trap assignment to new_lines
42
+ # def new_lines=(value)
43
+ # ww caller.deref[0..4], value
44
+ # @attributes[:new_lines] = value
45
+ # end
85
46
 
86
47
  def method_missing(name, *args)
87
48
  key = name.to_s.chomp('=').to_sym
@@ -45,6 +45,11 @@ def evaluate_shell_expressions(initial_code, expressions, shell: '/bin/bash',
45
45
  end
46
46
 
47
47
  result_hash
48
+
49
+ rescue StandardError
50
+ ww $@, $!, caller.deref
51
+ ww initial_code, expressions
52
+ raise StandardError, $!
48
53
  end
49
54
 
50
55
  return if $PROGRAM_NAME != __FILE__
data/lib/fcb.rb CHANGED
@@ -232,7 +232,7 @@ module MarkdownExec
232
232
  export.init = case
233
233
  when export.allow.present?
234
234
  UxActSource::ALLOW
235
- when export.default.present?###keep?
235
+ when export.default.present?
236
236
  UxActSource::DEFAULT
237
237
  when export.echo.present?
238
238
  UxActSource::ECHO
@@ -994,6 +994,9 @@ module MarkdownExec
994
994
  initial_code_required: false,
995
995
  occurrence_expressions: nil
996
996
  )
997
+ ww commands
998
+ ww link_state
999
+ # binding.irb####
997
1000
  evaluate_shell_expressions(
998
1001
  (link_state&.inherited_lines_block || ''),
999
1002
  commands,
@@ -1110,9 +1113,11 @@ module MarkdownExec
1110
1113
  selected, mdoc, inherited_code: nil, force: true, only_default: false,
1111
1114
  silent:
1112
1115
  )
1116
+ ww selected
1113
1117
  ret_command_result = nil
1114
1118
  exit_prompt = @delegate_object[:prompt_filespec_back]
1115
1119
 
1120
+ ww \
1116
1121
  required = mdoc.collect_recursively_required_code(
1117
1122
  anyname: selected.pub_name,
1118
1123
  label_format_above: @delegate_object[:shell_code_label_format_above],
@@ -1187,6 +1192,9 @@ module MarkdownExec
1187
1192
  end
1188
1193
 
1189
1194
  ret_command_result || CommandResult.new(stdout: required_lines)
1195
+ rescue StandardError
1196
+ ww $@, $!
1197
+ HashDelegator.error_handler('code_from_ux_block_to_set_environment_variables')
1190
1198
  end
1191
1199
 
1192
1200
  def env_set(name, value)
@@ -2532,6 +2540,7 @@ module MarkdownExec
2532
2540
  end
2533
2541
 
2534
2542
  def expand_references!(fcb, link_state)
2543
+ ww fcb, link_state, caller.deref
2535
2544
  expand_variable_references!(
2536
2545
  blocks: [fcb],
2537
2546
  echo_formatter: method(:format_echo_command),
@@ -2574,15 +2583,22 @@ module MarkdownExec
2574
2583
  link_state:,
2575
2584
  pattern:
2576
2585
  )
2586
+ ww blocks####
2587
+ ww link_state
2588
+ # binding.irb
2577
2589
  variable_counts, occurrence_expressions = count_named_group_occurrences(
2578
2590
  blocks, pattern, group_name: group_name
2579
2591
  )
2580
2592
  return if variable_counts.nil? || variable_counts == {}
2593
+ ww [variable_counts, occurrence_expressions]
2581
2594
 
2595
+ ww \
2582
2596
  echo_commands = generate_echo_commands(
2583
2597
  variable_counts, formatter: echo_formatter
2584
2598
  )
2585
2599
 
2600
+ ww link_state
2601
+ ww \
2586
2602
  replacements = build_replacement_dictionary(
2587
2603
  echo_commands, link_state,
2588
2604
  initial_code_required: initial_code_required,
@@ -2590,8 +2606,13 @@ module MarkdownExec
2590
2606
  )
2591
2607
 
2592
2608
  return if replacements.nil?
2593
- return if replacements == EvaluateShellExpression::StatusFail
2609
+ if replacements == EvaluateShellExpression::StatusFail
2610
+ # happens on first processing of blocks before requirements are met
2611
+ ww "EvaluateShellExpression::StatusFail", echo_commands, link_state
2612
+ return
2613
+ end
2594
2614
 
2615
+ ww \
2595
2616
  expand_blocks_with_replacements(blocks, replacements)
2596
2617
  # no return
2597
2618
  end
@@ -2602,10 +2623,10 @@ module MarkdownExec
2602
2623
  exportable = true
2603
2624
  command_result = nil
2604
2625
  new_lines = []
2605
- export_string = string || export.echo
2626
+ export_string = string.nil? ? export.echo : string
2606
2627
  case export_string
2607
2628
  when String, Integer, Float, TrueClass, FalseClass
2608
- command_result, = output_from_adhoc_bash_script_file(
2629
+ command_result, exportable, new_lines = output_from_adhoc_bash_script_file(
2609
2630
  join_array_of_arrays(
2610
2631
  bash_script_lines,
2611
2632
  %(printf '%s' "#{export_string}")
@@ -2994,7 +3015,7 @@ module MarkdownExec
2994
3015
  # convert single items to arrays
2995
3016
  def join_array_of_arrays(*args)
2996
3017
  args.map do |item|
2997
- item.is_a?(Array) ? item : [item]
3018
+ item.nil? ? nil : (item.is_a?(Array) ? item : [item])
2998
3019
  end.compact.flatten(1)
2999
3020
  end
3000
3021
 
@@ -4746,8 +4767,9 @@ module MarkdownExec
4746
4767
  command_result = CommandResult.new(stdout: output)
4747
4768
 
4748
4769
  when :exec, UxActSource::EXEC
4749
- command_result, = output_from_adhoc_bash_script_file(
4750
- join_array_of_arrays(bash_script_lines, export.exec)
4770
+ command_result, exportable, new_lines = output_from_adhoc_bash_script_file(
4771
+ join_array_of_arrays(bash_script_lines, export.exec),
4772
+ export
4751
4773
  )
4752
4774
 
4753
4775
  else
@@ -4792,7 +4814,8 @@ module MarkdownExec
4792
4814
  join_array_of_arrays(
4793
4815
  bash_script_lines,
4794
4816
  %(printf '%s' "#{export.echo}")
4795
- )
4817
+ ),
4818
+ export
4796
4819
  )
4797
4820
  export_init = cr_echo.stdout.split("\n").first
4798
4821
  command_result, exportable, new_lines = export_echo_with_code(
@@ -4805,8 +4828,9 @@ module MarkdownExec
4805
4828
 
4806
4829
  when :exec, ExportValueSource::EXEC
4807
4830
  # extract first line from 'exec' output
4808
- command_result, = output_from_adhoc_bash_script_file(
4809
- join_array_of_arrays(bash_script_lines, export.exec)
4831
+ command_result, exportable, new_lines = output_from_adhoc_bash_script_file(
4832
+ join_array_of_arrays(bash_script_lines, export.exec),
4833
+ export
4810
4834
  )
4811
4835
  unless command_result.failure?
4812
4836
  export_init = command_result.stdout.split("\n").first
@@ -5313,6 +5337,7 @@ module MarkdownExec
5313
5337
  mdoc_menu_and_blocks_from_nested_files(
5314
5338
  @dml_link_state, source_id: source_id
5315
5339
  )
5340
+ ww @dml_link_state####
5316
5341
  dump_delobj(@dml_blocks_in_file, @dml_menu_blocks, @dml_link_state)
5317
5342
  end
5318
5343
 
@@ -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 = '3.0.6'
10
+ VERSION = '3.0.8'
11
11
  end
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: 3.0.6
4
+ version: 3.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fareed Stevenson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-07 00:00:00.000000000 Z
11
+ date: 2025-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard