markdown_exec 3.2.0 → 3.3.0

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/Gemfile.lock +1 -1
  4. data/Rakefile +3 -3
  5. data/bats/block-type-ux-auto.bats +1 -1
  6. data/bats/block-type-ux-default.bats +1 -1
  7. data/bats/block-type-ux-echo-hash-transform.bats +1 -1
  8. data/bats/block-type-ux-echo-hash.bats +2 -2
  9. data/bats/block-type-ux-exec-hash-transform.bats +8 -0
  10. data/bats/block-type-ux-exec-hash.bats +15 -0
  11. data/bats/block-type-ux-exec.bats +1 -1
  12. data/bats/block-type-ux-force.bats +9 -0
  13. data/bats/block-type-ux-formats.bats +8 -0
  14. data/bats/block-type-ux-readonly.bats +1 -1
  15. data/bats/block-type-ux-row-format.bats +1 -1
  16. data/bats/block-type-ux-transform.bats +1 -1
  17. data/bats/import-directive-parameter-symbols.bats +9 -0
  18. data/bats/import-duplicates.bats +4 -2
  19. data/bats/import-parameter-symbols.bats +8 -0
  20. data/bats/markup.bats +1 -1
  21. data/bats/options.bats +1 -1
  22. data/bin/tab_completion.sh +5 -1
  23. data/docs/dev/block-type-ux-echo-hash-transform.md +14 -12
  24. data/docs/dev/block-type-ux-exec-hash-transform.md +37 -0
  25. data/docs/dev/block-type-ux-exec-hash.md +93 -0
  26. data/docs/dev/block-type-ux-force.md +20 -0
  27. data/docs/dev/block-type-ux-formats.md +58 -0
  28. data/docs/dev/hexdump_format.md +267 -0
  29. data/docs/dev/import/parameter-symbols.md +6 -0
  30. data/docs/dev/import-directive-parameter-symbols.md +9 -0
  31. data/docs/dev/import-parameter-symbols-template.md +24 -0
  32. data/docs/dev/import-parameter-symbols.md +6 -0
  33. data/docs/dev/load-vars-state-demo.md +35 -0
  34. data/docs/ux-blocks-examples.md +2 -3
  35. data/examples/import_with_substitution_demo.md +130 -26
  36. data/examples/imports/organism_template.md +86 -29
  37. data/lib/cached_nested_file_reader.rb +265 -27
  38. data/lib/constants.rb +8 -1
  39. data/lib/env_interface.rb +13 -7
  40. data/lib/evaluate_shell_expressions.rb +1 -0
  41. data/lib/fcb.rb +120 -28
  42. data/lib/format_table.rb +56 -23
  43. data/lib/fout.rb +5 -0
  44. data/lib/hash_delegator.rb +1158 -347
  45. data/lib/markdown_exec/version.rb +1 -1
  46. data/lib/markdown_exec.rb +2 -0
  47. data/lib/mdoc.rb +13 -11
  48. data/lib/menu.src.yml +139 -34
  49. data/lib/menu.yml +116 -32
  50. data/lib/string_util.rb +80 -0
  51. data/lib/table_extractor.rb +170 -64
  52. data/lib/ww.rb +325 -29
  53. metadata +18 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c39aff829d6b7a3d4eb05134922cdb6fed1d54192fab72ba244d7d7ff73183e
4
- data.tar.gz: f2bbfa6b9be857c718ba23c1bbc071b91ffe7ba027626c9a27b1d06c8bfce5a9
3
+ metadata.gz: a1b653c2db50fe8b7a8de3ea448a49d814b0210fd90090f06b829f30465dc313
4
+ data.tar.gz: e48016ab6903bf7967c575fa5f3c84893bf2ffb7e35b5b00788a59b5de2257e5
5
5
  SHA512:
6
- metadata.gz: 1b97c91ff7b91da388ff9d3aed19ee5e15fd25bd4d6e8f3591a8997614736e27e1c12fb3682a3395bae5853131578b924cbf55284ffda2beb9b89843c8b7c2b7
7
- data.tar.gz: 3056e41d512fa097204cae511a057b193c5ad3c70e406dee3da1df369bb0bed4f517137cf55e86ac6fcdc1308b70d604c75e9c2c2ee8c9b30edf0d5f574c006e
6
+ metadata.gz: 8e34466abddbda4228bb45d6bfb75e18e3bf4f9fc664a38eaa89aed3d93aceb0b042463854f02a4c0bb9ccf51e2d03226247e2a5c247315d1bb65954b3635739
7
+ data.tar.gz: 77bf12764fe5bf436d270a3d8c1763de469fae4fb6741714dedd1d400bb2e11d1fbeb2811cf062460fdd9cfe05ef2a32e9b6bd83b3e77e3f7f720d808a3472ed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.3.0] - 2025-09-02
4
+
5
+ ### Added
6
+
7
+ - Process Shell, Vars, and UX blocks in sequence.
8
+ - A personal exclude file that is not checked in.
9
+ - Option to annotate required lines.
10
+ - Option to make the directory if it does not exist when saving inherited code.
11
+ - Support for single-line tables.
12
+ - Options to decorate UX blocks per its activation.
13
+ - Special value '0' for environment variable 'WW' silences it. Otherwise, 'WW' outputs that it's testing new algorithm when the app is started.
14
+ - Apply text substitutions for each parameter according to a symbol.
15
+
16
+ ### Changed
17
+
18
+ - Trigger a selected block by it ID instead of its name. Stops co-triggering of blocks with and without names.
19
+ - Imported documents are skipped if duplicate. Importing a document with alternate parameters makes it unique.
20
+ - Set multiple variables in a UX block:
21
+ - UX blocks set multiple variables from echo expansions or exec evaluations
22
+ - Automatic allowed value based on echo or exec is the first line of the first variable set by the block
23
+ - Debug output improvements:
24
+ - Debug output indicates the depth of the call stack in each line.
25
+ - Add a function to alert and abort
26
+ - Add an environment variable to the log file name to document variations.
27
+ - Remove an unused option.
28
+ - Improve handling of interrupt at prompt.
29
+
3
30
  ## [3.2.0] - 2025-07-24
4
31
 
5
32
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (3.2.0)
4
+ markdown_exec (3.3.0)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
data/Rakefile CHANGED
@@ -103,9 +103,9 @@ task :bats do
103
103
  execute_with_error_handling(FileList['bats/**/*.bats']) do |file|
104
104
  next nil if %w[bats/bats.bats bats/fail.bats].include?(file)
105
105
 
106
- # temporary clear WW to disable debugging
107
- # WW pollutes output expected by BATS tests
108
- %(unset WW; bats #{file})
106
+ # If enabled, WW pollutes stderr processed by BATS tests
107
+ # silence with WW=0
108
+ %(export WW=0; bats #{file})
109
109
  end
110
110
  end
111
111
 
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Initial values' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-auto.md \
7
- 'v1 = _v2 = _v3 = 12_v4 = 21_v5 = markdown_exec__v6 = 31'
7
+ 'v1 = _v2 = _v3 = 12_v4 = 21_v5 = markdown_exec_v6 = 31'
8
8
  }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Initial values' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-default.md \
7
- 'v1 = _v2 = 11_v3 = 12_v4 = 21_v5 = markdown_exec__v6 = 31'
7
+ 'v1 = _v2 = 11_v3 = 12_v4 = 21_v5 = markdown_exec_v6 = 31'
8
8
  }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Each key in the echo hash is processed.' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo-hash-transform.md \
7
- 'Tapanuli Orangutan_Species: PONGO TAPANULIENSIS_Genus: PONGO_Tapanuli Orangutan_Family: H:Hominidae_Order: P:Primates'
7
+ 'Tapanuli Orangutan_Species: PONGO TAPANULIENSIS_Genus: PONGO_Tapanuli Orangutan_Family: H:Hominidae_Order: P:Primates_Psychedelic Frogfish_Species2: Haccdeeehhiiilnopprsstyy_Genus2: Hehiinoprsty_Family2: Aaadeeiinnnrt'
8
8
  }
@@ -4,11 +4,11 @@ load 'test_helper'
4
4
 
5
5
  @test 'an automatic block sets multiple variables' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo-hash.md \
7
- 'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ----- |_| Species | |_| Genus | |_| Family | |'
7
+ 'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ----- |_| Species | |_| Genus | |_| Family | |'
8
8
  }
9
9
 
10
10
  @test 'an activated block sets multiple variables' {
11
11
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo-hash.md \
12
12
  'Load Tapanuli Orangutan' \
13
- 'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ----------------------- |_| Species | Pongo tapanuliensis |_| Genus | Pongo |_| Family | Hominidae |'
13
+ 'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ------------------- |_| Species | Pongo tapanuliensis |_| Genus | Pongo |_| Family | Hominidae |'
14
14
  }
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test 'Each key in the exec hash is processed.' {
6
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec-hash-transform.md \
7
+ 'Cappuccino Snake_Species_ H Y D R O D Y N A S T E S B I_ 48 59 44 52 4F 44 59 4E 41 53 54 45 53 20 42 49_ C I N C T U S _ _ 43 49 4E 43 54 55 53 0A_Genus_ H Y D R O D Y N A S T E S _ _ 48 59 44 52 4F 44 59 4E 41 53 54 45 53 0A_Family_ C O L U B R I D A E_ 43 4F 4C 55 42 52 49 44 41 45_Order_ S u m t _ _ 53 75 6D 74 0A_Class_ R p i i_ 52 70 69 69_Phylum_ C o d t_ 43 6F 64 74'
8
+ }
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test 'automatic' {
6
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec-hash.md \
7
+ 'A single named variable is set automatically as the_output of the exec string._Common_Name=Yeti Crab_Common_Name=Yeti Crab_ Y e t i C r a b _ _ 59 65 74 69 20 43 72 61 62 0A__Multiple variables are set automatically as the_output of each exec string._One variable is temporary/not stored to inherited lines_but available for calculations within the block._Domain=ukaryota____D=_Domain=ukaryota_ u k a r y o t a _ _ _ 75 6B 61 72 79 6F 74 61 0A 0A__A single named variable is set interactively as the_output of the exec string._Year_Discovered=_Year_Discovered=_$(hexdump_format "$Year_Discovered")__Multiple variables are set interactively as the_output of the exec string._Genus=_Species=_$(hexdump_format "$Species")_Genus=_$(hexdump_format "$Genus")__A single named variable is set automatically as the_first line of the output of the first element in the echo_hash._Kingdom=Animalia_Kingdom=Animalia_ A n i m a l i a_ 41 6E 69 6D 61 6C 69 61__A single named variable is set automatically as the_first line of the output of the first element in the exec_hash._Class=Malacostraca_Class=Malacostraca_ M a l a c o s t r a c a_ 4D 61 6C 61 63 6F 73 74 72 61 63 61'
8
+ }
9
+
10
+ @test 'interactive' {
11
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec-hash.md \
12
+ '[Year_Discovered]' \
13
+ '[Genus]' \
14
+ 'A single named variable is set automatically as the_output of the exec string._Common_Name=Yeti Crab_Common_Name=Yeti Crab_ Y e t i C r a b _ _ 59 65 74 69 20 43 72 61 62 0A__Multiple variables are set automatically as the_output of each exec string._One variable is temporary/not stored to inherited lines_but available for calculations within the block._Domain=ukaryota____D=_Domain=ukaryota_ u k a r y o t a _ _ _ 75 6B 61 72 79 6F 74 61 0A 0A__A single named variable is set interactively as the_output of the exec string._Year_Discovered=2005_Year_Discovered=2005_ 2 0 0 5 _ _ 32 30 30 35 0A__Multiple variables are set interactively as the_output of the exec string._Genus=Kiwa__Species=Kiwa hirsuta_ K i w a h i r s u t a _ _ 4B 69 77 61 20 68 69 72 73 75 74 61 0A_Genus=Kiwa_ K i w a _ _ _ 4B 69 77 61 0A 0A__A single named variable is set automatically as the_first line of the output of the first element in the echo_hash._Kingdom=Animalia_Kingdom=Animalia_ A n i m a l i a_ 41 6E 69 6D 61 6C 69 61__A single named variable is set automatically as the_first line of the output of the first element in the exec_hash._Class=Malacostraca_Class=Malacostraca_ M a l a c o s t r a c a_ 4D 61 6C 61 63 6F 73 74 72 61 63 61'
15
+ }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Output of executed commands as initial value' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec.md \
7
- "ux0=_ux1=Unknown_ux2=markdown_exec__ux3=markdown_exec__ux4=Xform: 'markdown'"
7
+ "ux0=_ux1=Unknown_ux2=markdown_exec_ux3=markdown_exec_ux4=Xform: 'markdown'"
8
8
  }
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ # UX before VARS although VARS appears first
6
+ @test 'automatic' {
7
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-force.md \
8
+ 'Common_Name = Tapanuli Orangutan_ inherited_lines_ - : Common_Name="Tapanuli Orangutan"_ - : Common_Name=Ruby\ Seadragon_Common_Name=Ruby Seadragon_| Common_Name | Ruby Seadragon |'
9
+ }
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test 'UX block appearance' {
6
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-formats.md \
7
+ 'Demonstrate UX block appearance according to its state.__A simple variable declaration._EDIT VAR1 = value1__A selection from predefined options._ALLOW VAR2 = value2__A computed value using command substitution._ECHO VAR3 = Gemfile__An editable computed value._EDIT VAR4 = Gemfile__A command execution with formatted output._EXEC VAR5 = Gemfile___A read-only value._READONLY VAR6 = Gemfile_'
8
+ }
@@ -5,6 +5,6 @@ load 'test_helper'
5
5
  @test 'automatic block - disabled' {
6
6
  spec_mde_args_expect \
7
7
  docs/dev/block-type-ux-readonly.md \
8
- --list-blocks-message readonly --list-blocks-type 3 --list-blocks \
8
+ --blocks readonly \
9
9
  true
10
10
  }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Row format merges with prior table' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-row-format.md \
7
- " | Variable | Value | Prompt |_ | ---------- | -------------------- | --------------------- |_ | Species | Pongo tapanuliensis | New species? |_ | Name: Genu | Value: Xform: 'Pongo | Prompt: New genus? |_ | Family | Hominidae | Enter a value: |"
7
+ " | Variable | Value | Prompt |_ | ----------- | --------------------- | ------------------ |_ | Species | Pongo tapanuliensis | New species? |_ | Name: Genus | Value: Xform: 'Pongo' | Prompt: New genus? |_ | Family | Hominidae | Enter a value: |"
8
8
  }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Transformed output of executed commands' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-transform.md \
7
- '_Execution output has a trailing newline._Var0=markdown_exec__ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 0a __With validate and transform, output has no newline._Var1=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :chomp, output has no newline._Var2=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :upcase, output is in upper case w/ newline._Var3=MARKDOWN_EXEC__ 4d 41 52 4b 44 4f 57 4e 5f 45 58 45 43 0a '
7
+ '_Execution output has a trailing newline._Var0=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 0a __With validate and transform, output has no newline._Var1=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :chomp, output has no newline._Var2=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :upcase, output is in upper case w/ newline._Var3=MARKDOWN_EXEC_ 4d 41 52 4b 44 4f 57 4e 5f 45 58 45 43 0a '
8
8
  }
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test '' {
6
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-directive-parameter-symbols.md \
7
+ --blocks dname \
8
+ 'Stem: U1_Species: Illacme tobini_Genus: Illacme_Stem: U2_Species: Hydrodynastes bicinctus_Genus: Hydrodynastes'
9
+ }
@@ -20,20 +20,22 @@ load 'test_helper'
20
20
  '_d1.1_d0.1_u0.1'
21
21
  }
22
22
 
23
+ # a name in the CLI that matches multiple blocks only loads the first
23
24
  @test 'Import and require blocks with duplicate names - duplicate 0' {
24
25
  BATS_OUTPUT_FILTER=A
25
26
  BATS_SAFE=_
26
27
  spec_mde_args_expect docs/dev/import-duplicates-0.md \
27
28
  'd0' \
28
- '_d1.0_d1.1_d0.0_d0.1'
29
+ '_d1.0_d1.1_d0.1'
29
30
  }
30
31
 
32
+ # a name in the CLI that matches multiple blocks only loads the first
31
33
  @test 'Import and require blocks with duplicate names - duplicate 1' {
32
34
  BATS_OUTPUT_FILTER=A
33
35
  BATS_SAFE=_
34
36
  spec_mde_args_expect docs/dev/import-duplicates-0.md \
35
37
  'd1' \
36
- '_d1.1_d0.1'
38
+ '_d1.1'
37
39
  }
38
40
 
39
41
  @test 'Import and require blocks with duplicate names - unique in import 0' {
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test 'Initial values' {
6
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-parameter-symbols.md \
7
+ 'COMMON_NAME=Tapanuli Orangutan_Command substitution: Tapanuli Orangutan_echo "Command substitution: ${NAMEC}"__Evaluated expression: Tapanuli Orangutan_echo "Evaluated expression: ${NAMEE}"__Raw literal: Tapanuli Orangutan_echo "Raw literal: Tapanuli Orangutan"__Force-quoted literal: Tapanuli Orangutan_echo "Force-quoted literal: ${NAMEQ}"__Variable reference: Tapanuli Orangutan_echo "Variable reference: ${COMMON_NAME}"'
8
+ }
data/bats/markup.bats CHANGED
@@ -16,7 +16,7 @@ load 'test_helper'
16
16
 
17
17
  @test 'Options - list blocks - 3 decorates' {
18
18
  spec_mde_args_expect docs/dev/text-decoration.md \
19
- --list-blocks-message dname --list-blocks-type 3 --list-blocks \
19
+ --blocks dname \
20
20
  $'\x1b\x5b\x33\x38\x3b\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x6d\x2d\x20\x1b\x5b\x30\x6d\x1b\x5b\x31\x6d\x1b\x5b\x34\x6d\x42\x6f\x6c\x64\x2d\x55\x6e\x64\x65\x72\x6c\x69\x6e\x65\x1b\x5b\x32\x32\x6d\x1b\x5b\x32\x34\x6d\x0a\x1b\x5b\x33\x38\x3b\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x6d\x2d\x20\x1b\x5b\x30\x6d\x1b\x5b\x31\x6d\x42\x6f\x6c\x64\x1b\x5b\x32\x32\x6d\x0a\x1b\x5b\x33\x38\x3b\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x6d\x2d\x20\x1b\x5b\x30\x6d\x1b\x5b\x31\x6d\x1b\x5b\x33\x6d\x42\x6f\x6c\x64\x2d\x49\x74\x61\x6c\x69\x63\x1b\x5b\x32\x32\x6d\x1b\x5b\x32\x33\x6d\x0a\x1b\x5b\x33\x38\x3b\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x6d\x2d\x20\x1b\x5b\x30\x6d\x1b\x5b\x34\x6d\x55\x6e\x64\x65\x72\x6c\x69\x6e\x65\x1b\x5b\x32\x34\x6d\x0a\x1b\x5b\x33\x38\x3b\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x6d\x2d\x20\x1b\x5b\x30\x6d\x1b\x5b\x34\x6d\x1b\x5b\x33\x6d\x55\x6e\x64\x65\x72\x6c\x69\x6e\x65\x2d\x49\x74\x61\x6c\x69\x63\x1b\x5b\x32\x33\x6d\x1b\x5b\x32\x34\x6d\x0a\x1b\x5b\x33\x38\x3b\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x6d\x2d\x20\x1b\x5b\x30\x6d\x1b\x5b\x33\x6d\x49\x74\x61\x6c\x69\x63\x1b\x5b\x32\x33\x6d\x0a\x1b\x5b\x33\x38\x3b\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x3b\x31\x39\x32\x6d\x2d\x20\x1b\x5b\x30\x6d\x1b\x5b\x39\x6d\x53\x74\x72\x69\x6b\x65\x74\x68\x72\x6f\x75\x67\x68\x1b\x5b\x32\x39\x6d'
21
21
  }
22
22
 
data/bats/options.bats CHANGED
@@ -74,7 +74,7 @@ load 'test_helper'
74
74
  @test 'Options - load-code' {
75
75
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/load_code.md \
76
76
  --load-code docs/dev/load1.sh \
77
- --list-blocks-message dname --list-blocks-type 3 --list-blocks \
77
+ --blocks dname \
78
78
  'Demonstrate loading inherited code via the command line.__Run this command to display the inherited code._mde --load-code docs/dev/load1.sh docs/dev/load_code.md__| Variable | Value |_| -------- | ----- |_| var1 | line2 |_| var2 | line4 |'
79
79
  }
80
80
 
@@ -26,6 +26,8 @@ _mde() {
26
26
  if [[ ${prev} == -* ]] ; then
27
27
  case $prev in
28
28
 
29
+ --blocks) COMPREPLY="''"; return 0 ;;
30
+
29
31
  --config) COMPREPLY="."; return 0 ;;
30
32
 
31
33
  --debug) COMPREPLY="f"; return 0 ;;
@@ -108,7 +110,7 @@ _mde() {
108
110
  # present matching option names
109
111
  #
110
112
  if [[ ${cur} == -* ]] ; then
111
- opts=("--block-name" "--config" "--debug" "--dig" "--dump-blocks-in-file" "--dump-delegate-object" "--dump-dependencies" "--dump-inherited-block-names" "--dump-inherited-dependencies" "--dump-inherited-lines" "--dump-menu-blocks" "--dump-selected-block" "--execute-in-own-window" "--exit" "--filename" "--find" "--find-path" "--help" "--history" "--how" "--list-blocks" "--list-blocks-eval" "--list-blocks-message" "--list-blocks-type" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--format" "--list-recent-output" "--list-recent-scripts" "--load-code" "--mine" "--open" "--output-script" "--output-stdout" "--path" "--pause-after-script-execution" "--probe" "--publish-document-file-mode" "--publish-document-file-name" "--pwd" "--run-last-script" "--sift" "--tab-completions" "--user-must-approve" "--version" "--display-level")
113
+ opts=("--block-name" "--blocks" "--config" "--debug" "--dig" "--dump-blocks-in-file" "--dump-delegate-object" "--dump-dependencies" "--dump-inherited-block-names" "--dump-inherited-dependencies" "--dump-inherited-lines" "--dump-menu-blocks" "--dump-selected-block" "--execute-in-own-window" "--exit" "--filename" "--find" "--find-path" "--help" "--history" "--how" "--list-blocks" "--list-blocks-eval" "--list-blocks-message" "--list-blocks-type" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--format" "--list-recent-output" "--list-recent-scripts" "--load-code" "--mine" "--open" "--output-script" "--output-stdout" "--path" "--pause-after-script-execution" "--probe" "--publish-document-file-mode" "--publish-document-file-name" "--pwd" "--run-last-script" "--sift" "--tab-completions" "--user-must-approve" "--version" "--display-level")
112
114
  COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
113
115
 
114
116
  return 0
@@ -125,6 +127,8 @@ _mde() {
125
127
 
126
128
  -b) COMPREPLY=".NAME."; return 0 ;;
127
129
 
130
+ --blocks) COMPREPLY=".MESSAGE."; return 0 ;;
131
+
128
132
  --config) COMPREPLY=".PATH."; return 0 ;;
129
133
 
130
134
  --debug) COMPREPLY=".BOOL."; return 0 ;;
@@ -25,16 +25,18 @@ validate: >
25
25
  ```
26
26
  Family: ${Family}
27
27
  Order: ${Order}
28
- //
29
- // Each key in the exec hash is processed.
30
- /```ux
31
- /exec:
32
- / Species2: printf %s 'Histiophryne psychedelica'
33
- / Genus2: printf %s 'Histiophryne'
34
- /format: Psychedelic Frogfish
35
- /name: Species2
36
- /transform: :downcase
37
- /```
38
- /Species2: ${Species2}
39
- /Genus2: ${Genus2}
28
+ /
29
+ / Each key in the echo hash is processed.
30
+ ```ux
31
+ echo:
32
+ Species2: Histiophryne psychedelica
33
+ Genus2: Histiophryne
34
+ Family2: Antennariidae
35
+ format: Psychedelic Frogfish
36
+ name: Common2
37
+ transform: :sort_chars
38
+ ```
39
+ Species2: ${Species2}
40
+ Genus2: ${Genus2}
41
+ Family2: ${Family2}
40
42
  @import bats-document-configuration.md
@@ -0,0 +1,37 @@
1
+ / Each key in the exec hash is processed.
2
+ ```ux
3
+ exec:
4
+ Species: echo 'Hydrodynastes bicinctus'
5
+ Genus: echo Hydrodynastes
6
+ Family: printf %s Colubridae
7
+ format: Cappuccino Snake
8
+ name: Common
9
+ transform: :upcase
10
+ ```
11
+ __Species__
12
+ $(hexdump_format "$Species")
13
+ __Genus__
14
+ $(hexdump_format "$Genus")
15
+ __Family__
16
+ $(hexdump_format "$Family")
17
+ /
18
+ ```ux :()
19
+ exec:
20
+ Order: echo Squamata
21
+ Class: printf %s Reptilia
22
+ Phylum: printf %s Chordata
23
+ name: Common
24
+ transform: :delete_even_chars
25
+ ```
26
+ __Order__
27
+ $(hexdump_format "$Order")
28
+ __Class__
29
+ $(hexdump_format "$Class")
30
+ __Phylum__
31
+ $(hexdump_format "$Phylum")
32
+ /
33
+ @import hexdump_format.md
34
+ @import bats-document-configuration.md
35
+ ```opts :(document_opts)
36
+ screen_width: 64
37
+ ```
@@ -0,0 +1,93 @@
1
+ A single named variable is set **automatically** as the output of the exec string.
2
+ ```ux
3
+ exec: echo 'Yeti Crab'
4
+ name: Common_Name
5
+ ```
6
+ Common_Name=${Common_Name}
7
+ $(hexdump_format "$Common_Name")
8
+
9
+
10
+
11
+ Multiple variables are set **automatically** as the output of each exec string.
12
+ One variable is temporary/not stored to inherited lines but available for calculations within the block.
13
+ / Substring Extraction using POSIX parameter expansion.
14
+ ```ux
15
+ exec:
16
+ __D: >-
17
+ echo 'Domain: Eukaryota'
18
+ Domain: >-
19
+ echo "${__D:7,9}"
20
+ name: Domain
21
+ ```
22
+ __D=${__D}
23
+ Domain=${Domain}
24
+ $(hexdump_format "$Domain")
25
+
26
+
27
+
28
+ A single named variable is set **interactively** as the output of the exec string.
29
+ ```ux :[Year_Discovered]
30
+ exec: echo 2005
31
+ init: false
32
+ name: Year_Discovered
33
+ ```
34
+ Year_Discovered=${Year_Discovered}
35
+ $(hexdump_format "$Year_Discovered")
36
+
37
+
38
+
39
+ Multiple variables are set **interactively** as the output of the exec string.
40
+ / String Replacement
41
+ ```ux :[Genus]
42
+ exec:
43
+ Species: echo 'Kiwa hirsuta'
44
+ Genus: echo "${Species/ hirsuta/}"
45
+ init: false
46
+ name: Genus
47
+ ```
48
+ Species=${Species}
49
+ $(hexdump_format "$Species")
50
+ Genus=${Genus}
51
+ $(hexdump_format "$Genus")
52
+
53
+
54
+
55
+ A single named variable is set **automatically** as the first line of the output of the first element in the echo hash.
56
+ ```ux
57
+ allow: :echo
58
+ echo:
59
+ __K: |
60
+ Animalia
61
+ Animalia2
62
+ __P: |
63
+ Arthropoda
64
+ Arthropoda2
65
+ name: Kingdom
66
+ ```
67
+ Kingdom=${Kingdom}
68
+ $(hexdump_format "$Kingdom")
69
+
70
+
71
+
72
+ **A single named variable is set automatically** as the first line of the output of the first element in the exec hash.
73
+ ```ux
74
+ allow: :exec
75
+ exec:
76
+ __C: |
77
+ echo Malacostraca
78
+ echo Malacostraca2
79
+ __P: |
80
+ echo Arthropoda
81
+ echo Arthropoda2
82
+ name: Class
83
+ ```
84
+ Class=${Class}
85
+ $(hexdump_format "$Class")
86
+
87
+
88
+
89
+ @import hexdump_format.md
90
+ @import bats-document-configuration.md
91
+ ```opts :(document_opts)
92
+ screen_width: 64
93
+ ```
@@ -0,0 +1,20 @@
1
+ / The variable is defined mulitple times.
2
+ / Blocks are evaluated in order from top to bottom.
3
+ / The VARS assignment is output.
4
+ / Inherited lines are output.
5
+ / This VARS block creates the first assignment.
6
+ ```vars :(document_vars)
7
+ Common_Name: Tapanuli Orangutan
8
+ ```
9
+ / This UX block forces the value in a second assignment.
10
+ ```ux :[2]
11
+ init: Ruby Seadragon
12
+ force: true
13
+ name: Common_Name
14
+ ```
15
+ ! Common_Name! ${Common_Name}
16
+ @import bats-document-configuration.md
17
+ ```opts :(document_opts)
18
+ dump_inherited_lines: true
19
+ table_center: false
20
+ ```
@@ -0,0 +1,58 @@
1
+ Demonstrate UX block appearance according to its state.
2
+
3
+ A simple variable declaration.
4
+ ```ux
5
+ init: value1
6
+ name: VAR1
7
+ ```
8
+
9
+ A selection from predefined options.
10
+ ```ux
11
+ act: :allow
12
+ allow:
13
+ - value2
14
+ name: VAR2
15
+ ```
16
+
17
+ A computed value using command substitution.
18
+ ```ux
19
+ act: :echo
20
+ echo: '`ls Gemfile`'
21
+ name: VAR3
22
+ ```
23
+
24
+ An editable computed value.
25
+ ```ux
26
+ act: :edit
27
+ echo: '`ls Gemfile`'
28
+ name: VAR4
29
+ ```
30
+
31
+ A command execution with formatted output.
32
+ ```ux
33
+ act: :exec
34
+ exec: ls Gemfile
35
+ name: VAR5
36
+ ```
37
+
38
+ A read-only value.
39
+ ```ux
40
+ exec: ls Gemfile
41
+ name: VAR6
42
+ readonly: true
43
+ ```
44
+ @import bats-document-configuration.md
45
+ ```opts :(document_opts)
46
+ menu_ux_row_format: 'DEFAULT %{name} = ${%{name}}'
47
+ menu_ux_row_format_allow: 'ALLOW %{name} = ${%{name}}'
48
+ menu_ux_row_format_echo: 'ECHO %{name} = ${%{name}}'
49
+ menu_ux_row_format_edit: 'EDIT %{name} = ${%{name}}'
50
+ menu_ux_row_format_exec: 'EXEC %{name} = ${%{name}}'
51
+ menu_ux_row_format_readonly: 'READONLY %{name} = ${%{name}}'
52
+ # menu_ux_color_readonly: fg_bg_rgbh_df_df_00_14_18_1c
53
+ menu_ux_color_allow: fg_rgbh_6f_00_7f
54
+ menu_ux_color_echo: fg_rgbh_3f_00_7f
55
+ menu_ux_color_edit: fg_rgbh_1f_00_7f
56
+ menu_ux_color_exec: fg_rgbh_1f_40_7f
57
+ menu_ux_color_readonly: fg_rgbh_1f_00_9f
58
+ ```