markdown_exec 2.0.8.2 → 2.0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39b3a2b14b7efe82967efab04742281a8233a24daebf7c68f11fec661c8cd80e
4
- data.tar.gz: 16586313129a6c66cced3e45b6c94c758eba0fa0ea7fccce47a848366435ff11
3
+ metadata.gz: 942e4a005f42e2f3c2bd4542ba1b61e666c7379c0a2d81a5427f14ec76590a7d
4
+ data.tar.gz: c38976432cd43684654663876cd6ee5fa35b40339d5217bae00e282c29cd7415
5
5
  SHA512:
6
- metadata.gz: b7bcb0cb4ffdf2979ccc749a9abe1aaf86314b7a4ecd8fa34f9d6bfac7ae7d8a62f1981dcbdf7f0e7dd211e193392f009865b2adcd5eb5aa9d15610cd60559bb
7
- data.tar.gz: 5ab77246617cec9bb918a44e51d40ba1ef4d1215c57de9541538f2f10aa60e61144fad31e7bd7901d7985b95064863783258ddec35dea48fe1a86faf4dbd15f2
6
+ metadata.gz: e02a78e7a564273392203583c1b7d9502647c3379fa0894bf3b2a4b858127cfb8196a493d43e404395762449f267f8e68df48567585aa39d66d804c6c11e2edc
7
+ data.tar.gz: 1bf94ff09d5248dd54853eca88dbc8ebce6ce5c17e9e5110103a2bc91250fa099120a81c7de0f060afdc0d08c607e5fbb7096735aea9ffcb4c7a4ee9bb33220f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (2.0.8.2)
4
+ markdown_exec (2.0.8.3)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -13,7 +13,7 @@ __filedirs_all()
13
13
  }
14
14
 
15
15
  _mde_echo_version() {
16
- echo "2.0.8.2"
16
+ echo "2.0.8.3"
17
17
  }
18
18
 
19
19
  _mde() {
@@ -178,4 +178,4 @@ _mde() {
178
178
 
179
179
  complete -o filenames -o nospace -F _mde mde
180
180
  # _mde_echo_version
181
- # echo "Updated: 2024-06-07 23:43:21 UTC"
181
+ # echo "Updated: 2024-06-15 14:50:18 UTC"
data/examples/linked.md CHANGED
@@ -1,6 +1,7 @@
1
1
  Demonstrate setting variable values interactively for use in generated scripts.
2
2
 
3
3
  ```opts :(document_options)
4
+ menu_with_inherited_lines: true
4
5
  pause_after_script_execution: false
5
6
  user_must_approve: false
6
7
  ```
@@ -40,7 +41,7 @@ vars:
40
41
  ::: Set variable ALPHA in a Vars block
41
42
  For each environment variable named in block,
42
43
  append an inherited line that assigns the variable the specified value.
43
- ```vars :set_ALPHA_to_1_via_vars_block
44
+ ```vars :[set_ALPHA_to_1_via_vars_block]
44
45
  ALPHA: 1
45
46
  ```
46
47
 
@@ -48,7 +49,7 @@ ALPHA: 1
48
49
  For each environment variable in `vars`,
49
50
  append an inherited line that assigns the variable the specified value.
50
51
  Subsequently, run the `display_variable_ALPHA` block.
51
- ```link :set_ALPHA_to_2_via_link_block_and_display
52
+ ```link :[set_ALPHA_to_2_via_link_block_and_display]
52
53
  block: display_variable_ALPHA
53
54
  vars:
54
55
  ALPHA: 2
@@ -59,14 +60,14 @@ Subsequently, run the `display_variable_ALPHA` block.
59
60
  ```bash :(bash_set_to_3)
60
61
  ALPHA=3
61
62
  ```
62
- ```link :set_ALPHA_to_3_via_required_block_and_display +(bash_set_to_3)
63
+ ```link :[set_ALPHA_to_3_via_required_block_and_display] +(bash_set_to_3)
63
64
  block: display_variable_ALPHA
64
65
  ```
65
66
 
66
67
  Evaluate the code in the required block `(bash_eval_set_to_4)` and
67
68
  save (transformed) output into inherited lines.
68
69
  Subsequently, run the `display_variable_ALPHA` block.
69
- ```link :set_ALPHA_to_4_via_evaluated_required_block_and_display +(bash_eval_set_to_4)
70
+ ```link :[set_ALPHA_to_4_via_evaluated_required_block_and_display] +(bash_eval_set_to_4)
70
71
  eval: true
71
72
  next_block: display_variable_ALPHA
72
73
  ```
@@ -1482,6 +1482,7 @@ module MarkdownExec
1482
1482
  # @param mdoc [YourMDocClass] An instance of the MDoc class.
1483
1483
  #
1484
1484
  def execute_shell_type(selected:, mdoc:, block_source:, link_state: LinkState.new)
1485
+ # binding.irb
1485
1486
  if selected.fetch(:shell, '') == BlockType::LINK
1486
1487
  debounce_reset
1487
1488
  push_link_history_and_trigger_load(link_block_body: selected.fetch(:body, ''),
@@ -1695,7 +1696,6 @@ module MarkdownExec
1695
1696
 
1696
1697
  def inpseq_execute_block(block_name)
1697
1698
  @dml_block_state = block_state_for_name_from_cli(block_name)
1698
-
1699
1699
  dump_and_warn_block_state(selected: @dml_block_state.block)
1700
1700
  @dml_link_state, @dml_menu_default_dname = \
1701
1701
  exec_bash_next_state(
@@ -1761,7 +1761,10 @@ module MarkdownExec
1761
1761
 
1762
1762
  if link_block_data.fetch(LinkKeys::EXEC, false)
1763
1763
  @run_state.files = Hash.new([])
1764
- execute_command_with_streams([cmd])
1764
+ execute_command_with_streams([cmd]) do |_stdin, stdout, stderr, _thread|
1765
+ line = stdout || stderr
1766
+ output_lines.push(line) if line
1767
+ end
1765
1768
 
1766
1769
  ## select output_lines that look like assignment or match other specs
1767
1770
  #
@@ -2121,7 +2124,7 @@ module MarkdownExec
2121
2124
  end
2122
2125
 
2123
2126
  def pop_add_current_code_to_head_and_trigger_load(link_state, block_names, code_lines,
2124
- dependencies, selected)
2127
+ dependencies, selected, next_block_name: nil)
2125
2128
  pop = @link_history.pop # updatable
2126
2129
  if pop.document_filename
2127
2130
  next_state = LinkState.new(
@@ -2146,7 +2149,7 @@ module MarkdownExec
2146
2149
  inherited_block_names: ((link_state&.inherited_block_names || []) + block_names).sort.uniq,
2147
2150
  inherited_dependencies: (link_state&.inherited_dependencies || {}).merge(dependencies || {}), ### merge, not replace, key data
2148
2151
  inherited_lines: HashDelegator.code_merge(link_state&.inherited_lines, code_lines),
2149
- next_block_name: '', # not link_block_data[LinkKeys::BLOCK] || ''
2152
+ next_block_name: next_block_name,
2150
2153
  next_document_filename: @delegate_object[:filename], # not next_document_filename
2151
2154
  next_load_file: LoadFile::REUSE # not next_document_filename == @delegate_object[:filename] ? LoadFile::REUSE : LoadFile::LOAD
2152
2155
  )
@@ -2424,7 +2427,7 @@ module MarkdownExec
2424
2427
  end
2425
2428
  end
2426
2429
 
2427
- ## append blocks loaded, apply LinkKeys::EVAL
2430
+ ## append blocks loaded
2428
2431
  #
2429
2432
  if (load_expr = link_block_data.fetch(LinkKeys::LOAD, '')).present?
2430
2433
  load_filespec = load_filespec_from_expression(load_expr)
@@ -2439,10 +2442,11 @@ module MarkdownExec
2439
2442
  end
2440
2443
 
2441
2444
  next_document_filename = write_inherited_lines_to_file(link_state, link_block_data)
2445
+ next_block_name = link_block_data.fetch(LinkKeys::NEXT_BLOCK, nil) || link_block_data.fetch(LinkKeys::BLOCK, nil) || ''
2442
2446
 
2443
2447
  if link_block_data[LinkKeys::RETURN]
2444
2448
  pop_add_current_code_to_head_and_trigger_load(link_state, block_names, code_lines,
2445
- dependencies, selected)
2449
+ dependencies, selected, next_block_name: next_block_name)
2446
2450
 
2447
2451
  else
2448
2452
  link_history_push_and_next(
@@ -2451,8 +2455,7 @@ module MarkdownExec
2451
2455
  inherited_block_names: ((link_state&.inherited_block_names || []) + block_names).sort.uniq,
2452
2456
  inherited_dependencies: (link_state&.inherited_dependencies || {}).merge(dependencies || {}), ### merge, not replace, key data
2453
2457
  inherited_lines: HashDelegator.code_merge(link_state&.inherited_lines, code_lines),
2454
- next_block_name: link_block_data.fetch(LinkKeys::NEXT_BLOCK,
2455
- nil) || link_block_data[LinkKeys::BLOCK] || '',
2458
+ next_block_name: next_block_name,
2456
2459
  next_document_filename: next_document_filename,
2457
2460
  next_load_file: next_document_filename == @delegate_object[:filename] ? LoadFile::REUSE : LoadFile::LOAD
2458
2461
  )
@@ -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.0.8.2'
10
+ VERSION = '2.0.8.3'
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: 2.0.8.2
4
+ version: 2.0.8.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-06-07 00:00:00.000000000 Z
11
+ date: 2024-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard