markdown_exec 3.5.1 → 3.5.2

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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/.ai-agent-instructions +54 -0
  3. data/.cursorrules +198 -0
  4. data/.rubocop.wide.yml +5 -0
  5. data/.rubocop.yml +7 -2
  6. data/CHANGELOG.md +12 -1
  7. data/Gemfile.lock +1 -1
  8. data/Rakefile +2 -0
  9. data/ai-principles.md +516 -0
  10. data/architecture-decisions.md +190 -0
  11. data/bats/block-hide.bats +1 -1
  12. data/bats/block-type-bash.bats +5 -5
  13. data/bats/block-type-link.bats +1 -1
  14. data/bats/block-type-opts.bats +3 -3
  15. data/bats/block-type-port.bats +2 -2
  16. data/bats/block-type-shell-require-ux.bats +2 -2
  17. data/bats/block-type-ux-allowed.bats +4 -4
  18. data/bats/block-type-ux-auto.bats +1 -1
  19. data/bats/block-type-ux-chained.bats +1 -1
  20. data/bats/block-type-ux-default.bats +1 -1
  21. data/bats/block-type-ux-echo-hash-transform.bats +1 -1
  22. data/bats/block-type-ux-echo-hash.bats +2 -2
  23. data/bats/block-type-ux-echo.bats +3 -3
  24. data/bats/block-type-ux-exec-hash-transform.bats +1 -1
  25. data/bats/block-type-ux-exec-hash.bats +2 -2
  26. data/bats/block-type-ux-exec.bats +1 -1
  27. data/bats/block-type-ux-force.bats +1 -1
  28. data/bats/block-type-ux-formats.bats +1 -1
  29. data/bats/block-type-ux-hidden.bats +1 -1
  30. data/bats/block-type-ux-invalid.bats +1 -1
  31. data/bats/block-type-ux-readonly.bats +1 -1
  32. data/bats/block-type-ux-require-chained.bats +2 -2
  33. data/bats/block-type-ux-require-context.bats +2 -2
  34. data/bats/block-type-ux-require.bats +2 -2
  35. data/bats/block-type-ux-required-variables.bats +1 -1
  36. data/bats/block-type-ux-row-format.bats +1 -1
  37. data/bats/block-type-ux-sources.bats +4 -4
  38. data/bats/block-type-ux-transform.bats +1 -1
  39. data/bats/block-type-vars.bats +3 -3
  40. data/bats/border.bats +1 -1
  41. data/bats/cli.bats +11 -11
  42. data/bats/command-substitution-options.bats +2 -2
  43. data/bats/command-substitution.bats +1 -1
  44. data/bats/document-shell.bats +1 -1
  45. data/bats/history.bats +5 -5
  46. data/bats/import-conflict.bats +1 -1
  47. data/bats/import-directive-line-continuation.bats +1 -1
  48. data/bats/import-directive-parameter-symbols.bats +1 -1
  49. data/bats/import-duplicates.bats +6 -6
  50. data/bats/import-parameter-symbols.bats +1 -1
  51. data/bats/import-with-text-substitution.bats +1 -1
  52. data/bats/import.bats +3 -3
  53. data/bats/indented-block-type-vars.bats +1 -1
  54. data/bats/indented-multi-line-output.bats +1 -1
  55. data/bats/line-decor-dynamic.bats +1 -1
  56. data/bats/line-wrapping.bats +1 -1
  57. data/bats/load-vars-state-demo.bats +4 -4
  58. data/bats/markup.bats +4 -4
  59. data/bats/mde.bats +4 -4
  60. data/bats/option-expansion.bats +1 -1
  61. data/bats/options-collapse.bats +4 -4
  62. data/bats/options.bats +47 -17
  63. data/bats/plain.bats +1 -1
  64. data/bats/publish.bats +2 -2
  65. data/bats/table-column-truncate.bats +1 -1
  66. data/bats/table.bats +2 -2
  67. data/bats/variable-expansion-multiline.bats +1 -1
  68. data/bats/variable-expansion.bats +6 -6
  69. data/conversation-template.md +611 -0
  70. data/docs/block-execution-modes.md +177 -0
  71. data/docs/block-filtering.md +252 -0
  72. data/docs/block-naming-patterns.md +210 -0
  73. data/docs/block-scanning-patterns.md +248 -0
  74. data/docs/cli-reference.md +370 -0
  75. data/docs/dev/block-hide.md +1 -1
  76. data/docs/dev/block-type-ux-transform.md +5 -4
  77. data/docs/dev/print_bytes.md +3 -0
  78. data/docs/dev/shebang.md +6 -0
  79. data/docs/docker-testing.md +5 -0
  80. data/docs/execution-control.md +384 -0
  81. data/docs/getting-started.md +209 -0
  82. data/docs/import-options.md +391 -0
  83. data/docs/tab-completion.md +7 -0
  84. data/docs/ux-blocks.md +376 -0
  85. data/examples/linked1.md +8 -1
  86. data/implementation-decisions.md +212 -0
  87. data/lib/cached_nested_file_reader.rb +138 -1
  88. data/lib/command_result.rb +27 -6
  89. data/lib/executed_shell_command.rb +512 -0
  90. data/lib/filter.rb +7 -7
  91. data/lib/hash_delegator.rb +403 -350
  92. data/lib/link_history.rb +22 -11
  93. data/lib/markdown_exec/version.rb +1 -1
  94. data/lib/mdoc.rb +103 -44
  95. data/lib/menu.src.yml +110 -83
  96. data/lib/menu.yml +149 -83
  97. data/lib/transformed_shell_command.rb +449 -0
  98. data/lib/wl.rb +15 -0
  99. data/lib/ww.rb +16 -5
  100. data/requirements.md +111 -0
  101. data/semantic-tokens.md +132 -0
  102. data/tasks.md +69 -0
  103. metadata +26 -4
  104. data/docs/ux-blocks-examples.md +0 -120
  105. data/docs/ux-blocks-init-act.md +0 -100
data/bats/border.bats CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Border - ' {
5
+ @test 'renders border between blocks' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/border.md \
7
7
  'A: 1_B: 2'
8
8
  }
data/bats/cli.bats CHANGED
@@ -8,21 +8,21 @@ load 'test_helper'
8
8
  ' ARGS: 1 23'
9
9
  }
10
10
 
11
- @test 'Position 0 File Name - file does not exist; string not found; select a file from the current directory' {
11
+ @test 'searches current directory when file not found' {
12
12
  skip 'algorithm to exit waiting MDE is not ready'
13
13
  BATS_OUTPUT_FILTER=A
14
14
  BATS_SLEEP=8
15
15
  spec_mde_args_expect NotFoundAnywhere 'Searching in: .'
16
16
  }
17
17
 
18
- @test 'Position 1 Block Name - block does not exist' {
18
+ @test 'reports error when block not found' {
19
19
  BATS_OUTPUT_FILTER=A
20
20
  BATS_STATUS=1
21
21
  spec_mde_args_expect docs/dev/pass-through-arguments.md NonExistentBlock \
22
22
  ' Error: Block not found -- name: NonExistentBlock'
23
23
  }
24
24
 
25
- @test 'block named in link does not exist' {
25
+ @test 'reports error when linked block missing' {
26
26
  BATS_STATUS=1
27
27
  spec_mde_args_expect docs/dev/requiring-blocks.md '[link-missing-local-block]' \
28
28
  'Block missing'
@@ -30,46 +30,46 @@ load 'test_helper'
30
30
 
31
31
  # Requiring blocks
32
32
 
33
- @test 'bash block setting an environment variable requires a bash block' {
33
+ @test 'bash block requires another bash block' {
34
34
  BATS_OUTPUT_FILTER=A
35
35
  spec_mde_args_expect docs/dev/requiring-blocks.md '[set-env]' \
36
36
  ' ARG1: 37'
37
37
  }
38
38
 
39
- @test 'vars in link block are appended to inherited lines - local link' {
39
+ @test 'appends vars from link block to inherited lines - local' {
40
40
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/requiring-blocks.md \
41
41
  '[link-local-block-with-vars]' \
42
42
  '* Exit_# [link-local-block-with-vars]_ARG1="37"_block: echo-ARG1_ file: docs/dev/linked-file.md_ vars:_ ARG1: arg1-from-link-file_block: output_arguments_ vars:_ ARG1: 37_block: missing_ARG1=37_output_arguments'
43
43
  }
44
44
 
45
- @test 'vars in link block are appended to inherited lines - external file' {
45
+ @test 'appends vars from link block to inherited lines - external' {
46
46
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/requiring-blocks.md \
47
47
  '[link-file-block-with-vars]' \
48
48
  '* Exit_# [link-file-block-with-vars]_ARG1="arg1-from-link-file"_echo-ARG1'
49
49
  }
50
50
 
51
51
  # the last block is a link block, so menu is displayed
52
- @test 'link block setting an environment variable requires a bash block' {
52
+ @test 'link block requires bash block' {
53
53
  BATS_OUTPUT_FILTER=A
54
54
  spec_mde_args_expect docs/dev/requiring-blocks.md '[link-local-block-with-vars]' $EXIT_MENU \
55
55
  ' ARG1: 37'
56
56
  }
57
57
 
58
58
  # the last block is a link block, so menu is displayed
59
- @test 'link block setting an environment variable calls a bash block in a file' {
59
+ @test 'link block calls bash block in external file' {
60
60
  BATS_OUTPUT_FILTER=A
61
61
  spec_mde_args_expect docs/dev/requiring-blocks.md '[link-file-block-with-vars]' $EXIT_MENU \
62
62
  ' ARG1: arg1-from-link-file'
63
63
  }
64
64
 
65
- @test 'history' {
65
+ @test 'lists history files' {
66
66
  file_name="$(most_recent_history_file_name)"
67
67
  BATS_OUTPUT_GREP="$file_name"
68
68
  spec_mde_args_expect examples/save.md --history \
69
69
  "$file_name"
70
70
  }
71
71
 
72
- @test 'sift - format text' {
72
+ @test 'sifts history with text format' {
73
73
  file_name="$(most_recent_history_file_name)"
74
74
  date="$(date_from_history_file_name "$file_name")"
75
75
  BATS_OUTPUT_GREP="$file_name"
@@ -77,7 +77,7 @@ load 'test_helper'
77
77
  "$file_name"
78
78
  }
79
79
 
80
- @test 'sift - format yaml' {
80
+ @test 'sifts history with yaml format' {
81
81
  file_name="$(most_recent_history_file_name)"
82
82
  date="$(date_from_history_file_name "$file_name")"
83
83
  BATS_OUTPUT_GREP="$file_name"
@@ -2,13 +2,13 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Operator $' {
5
+ @test 'uses $ operator for variable expansion' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/command-substitution-options.md \
7
7
  'operator_$' \
8
8
  'Command substitution__The current value of environment variable Common_Name_is displayed using two different operators._The command echo $SHLVL is executed via command_substitution, using two different operators.__| Operator | Variable Expansion | Command Substitution |_| -------- | ------------------ | -------------------- |_| $ | Tapanuli Orangutan | Pongo tapanuliensis |_| @ | @{Common_Name} | @(echo $Species) |__Toggle between operators.__operator_$__operator_@'
9
9
  }
10
10
 
11
- @test 'Operator @' {
11
+ @test 'uses @ operator for command substitution' {
12
12
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/command-substitution-options.md \
13
13
  'Command substitution__The current value of environment variable Common_Name_is displayed using two different operators._The command echo $SHLVL is executed via command_substitution, using two different operators.__| Operator | Variable Expansion | Command Substitution |_| -------- | ------------------ | -------------------- |_| $ | ${Common_Name} | $(echo $Species) |_| @ | Tapanuli Orangutan | Pongo tapanuliensis |__Toggle between operators.__operator_$__operator_@'
14
14
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Command substitution' {
5
+ @test 'substitutes command output in variables' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/command-substitution.md \
7
7
  'CURRENT BASE NAME IS: MARKDOWN_EXEC_current base name is: markdown_exec_current base name is: markdown_exec_| current base name |_| ----------------- |_| markdown_exec |_: notice the string is not expanded in Shell block types (names or body)._echo "current base name is now $(basename `pwd`)"_load: file_markdown_exec.sh_Status not zero: $(err)'
8
8
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'document_shell - required' {
5
+ @test 'requires document_shell for inherited lines' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/document-shell.md \
7
7
  --dump-inherited-lines t '* Exit' \
8
8
  ' inherited_lines_ - : : from required_ - : : from document_shell'
data/bats/history.bats CHANGED
@@ -2,32 +2,32 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Options - history, sorted' {
5
+ @test 'lists history files sorted' {
6
6
  local log_files="$(ls -1t logs/*examples_save_md*)"
7
7
  spec_mde_args_expect examples/save.md --history \
8
8
  "$log_files"
9
9
  }
10
10
 
11
- @test 'Options - history, dig' {
11
+ @test 'digs through all history files' {
12
12
  skip 'test hangs on menu'
13
13
  local log_files="$(ls -1 logs/*)"
14
14
  spec_mde_args_expect --history --dig \
15
15
  "$log_files"
16
16
  }
17
17
 
18
- @test 'Options - history, probe' {
18
+ @test 'probes history files for pattern' {
19
19
  local log_files="$(grep --files-with-matches '04:31' logs/* 2>/dev/null)"
20
20
  spec_mde_args_expect examples/save.md --probe '04:31' --history \
21
21
  "$log_files"
22
22
  }
23
23
 
24
- @test 'Options - history, sift' {
24
+ @test 'sifts history files by date pattern' {
25
25
  local log_files="$(ls -1 logs/*-31-*examples_save_md*)"
26
26
  spec_mde_args_expect examples/save.md --sift -31- --history \
27
27
  "$log_files"
28
28
  }
29
29
 
30
- @test 'Options - history, sift and probe' {
30
+ @test 'sifts and probes history files' {
31
31
  local log_files="$(grep --files-with-matches 'e' logs/*-31-*examples_save_md* 2>/dev/null)"
32
32
  spec_mde_args_expect examples/save.md --sift -31- --probe e --history \
33
33
  "$log_files"
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Import and require blocks with duplicate names - blocks with same name have different requirements' {
5
+ @test 'executes blocks with same name but different requirements' {
6
6
  BATS_OUTPUT_FILTER=A
7
7
  BATS_SAFE=_
8
8
  spec_mde_args_expect docs/dev/import-conflict-0.md \
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test '' {
5
+ @test 'handles line continuation in import directive' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-directive-line-continuation.md \
7
7
  --blocks dname \
8
8
  'Stem: U1_Species: Illacme tobini'
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test '' {
5
+ @test 'expands parameter symbols in import directive' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-directive-parameter-symbols.md \
7
7
  --blocks dname \
8
8
  'Stem: U1_Species: Illacme tobini_Stem: U2_Species: Hydrodynastes bicinctus'
@@ -4,7 +4,7 @@ load 'test_helper'
4
4
 
5
5
  # Imported blocks `[du]1.*` appear before principal blocks `[du]0.*` in the code evaluated because the import of `import-duplicates-1.md` is above the `0.*` definitions in the principal file.
6
6
 
7
- @test 'Import and require blocks with duplicate names - unique in main 0' {
7
+ @test 'executes unique block from main file 0' {
8
8
  BATS_OUTPUT_FILTER=A
9
9
  BATS_SAFE=_
10
10
  spec_mde_args_expect docs/dev/import-duplicates-0.md \
@@ -12,7 +12,7 @@ load 'test_helper'
12
12
  '_d1.0_d1.1_d0.0_d0.1_u0.0'
13
13
  }
14
14
 
15
- @test 'Import and require blocks with duplicate names - unique in main 1' {
15
+ @test 'executes unique block from main file 1' {
16
16
  BATS_OUTPUT_FILTER=A
17
17
  BATS_SAFE=_
18
18
  spec_mde_args_expect docs/dev/import-duplicates-0.md \
@@ -21,7 +21,7 @@ load 'test_helper'
21
21
  }
22
22
 
23
23
  # a name in the CLI that matches multiple blocks only loads the first
24
- @test 'Import and require blocks with duplicate names - duplicate 0' {
24
+ @test 'executes first matching duplicate block 0' {
25
25
  BATS_OUTPUT_FILTER=A
26
26
  BATS_SAFE=_
27
27
  spec_mde_args_expect docs/dev/import-duplicates-0.md \
@@ -30,7 +30,7 @@ load 'test_helper'
30
30
  }
31
31
 
32
32
  # a name in the CLI that matches multiple blocks only loads the first
33
- @test 'Import and require blocks with duplicate names - duplicate 1' {
33
+ @test 'executes first matching duplicate block 1' {
34
34
  BATS_OUTPUT_FILTER=A
35
35
  BATS_SAFE=_
36
36
  spec_mde_args_expect docs/dev/import-duplicates-0.md \
@@ -38,7 +38,7 @@ load 'test_helper'
38
38
  '_d1.1'
39
39
  }
40
40
 
41
- @test 'Import and require blocks with duplicate names - unique in import 0' {
41
+ @test 'executes unique block from imported file 0' {
42
42
  BATS_OUTPUT_FILTER=A
43
43
  BATS_SAFE=_
44
44
  spec_mde_args_expect docs/dev/import-duplicates-0.md \
@@ -46,7 +46,7 @@ load 'test_helper'
46
46
  '_d1.0_d1.1_u1.0_d0.0_d0.1'
47
47
  }
48
48
 
49
- @test 'Import and require blocks with duplicate names - unique in import 1' {
49
+ @test 'executes unique block from imported file 1' {
50
50
  BATS_OUTPUT_FILTER=A
51
51
  BATS_SAFE=_
52
52
  spec_mde_args_expect docs/dev/import-duplicates-0.md \
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Initial values' {
5
+ @test 'expands parameter symbols in import directives' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-parameter-symbols.md \
7
7
  'COMMON_NAME=Tapanuli Orangutan_Evaluated expression: Tapanuli Orangutan_echo "Evaluated expression: $(printf %s "$COMMON_NAME")"__Raw literal: Tapanuli Orangutan_echo "Raw literal: Tapanuli Orangutan"__Force-quoted literal: Tapanuli Orangutan_echo "Force-quoted literal: Tapanuli Orangutan"__Variable reference: Tapanuli Orangutan_echo "Variable reference: ${COMMON_NAME}"'
8
8
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'enhanced @import functionality with text substitution' {
5
+ @test 'substitutes text in enhanced import directives' {
6
6
  BATS_OUTPUT_FILTER=A
7
7
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-with-text-substitution.md \
8
8
  'IMPORT SUBSTITUTION COMPREHENSIVE TEST__Tests enhanced @import ./functionality with text_substitution using biological entity data.__Basic Import (Backward Compatibility)__Basic import without parameters.__Content: Static biological reference data._Source: Living entities research database._Format: Markdown with embedded data. __Raw Replacement - Simple Parameters__Genus: Pongo_Family: Hominidae _Order: Primates__Classification hierarchy shows Pongo within Hominidae of_Primates.__Raw Replacement - Quoted Values__Common Name: Tapanuli Orangutan_Scientific Name: Pongo tapanuliensis_Discovery Location: Sumatra, Indonesia__Organism Tapanuli Orangutan (Pongo tapanuliensis) found_in Sumatra, Indonesia.__Note: Tapanuli Orangutan contains spaces, Pongo_tapanuliensis contains spaces, Sumatra, Indonesia_contains punctuation.__Raw Replacement - Mixed Parameters__Species: Psychedelic Frogfish (Histiophryne psychedelica)_Discovery: 2009_Depth Range: 15-65 meters_Habitat: Coral reefs__Marine organism Psychedelic Frogfish discovered in 2009._Lives at 15-65 meters in Coral reefs environment.__Test: 2009 is numeric, 15-65 meters contains units, Coral_reefs contains spaces.__Raw Replacement - Numbers and Special Characters__Organism: Yeti Crab_Year: 2005 _Depth: 2200 meters_Temperature: 2°C_Location: Easter Island microplate__Discovery data: Yeti Crab found 2005 at 2200 meters depth._Environment: 2°C water near Easter Island microplate.__Tests: Numbers (2005, 2200), special chars (2°C °C),_complex location.__Raw Replacement - Long Scientific Names__Classification of Ecuadorian Glassfrog:__Scientific Name: Hyalinobatrachium yaku_Genus: Hyalinobatrachium_Family: Centrolenidae_Order: Anura _Class: Amphibia__Full classification: Amphibia > Anura > Centrolenidae >_Hyalinobatrachium > Hyalinobatrachium yaku__Long names test: Hyalinobatrachium and Centrolenidae are_lengthy taxonomic terms._Species Hyalinobatrachium yaku demonstrates complex_scientific nomenclature.__Raw Replacement - Plant Data__Plant Species: Spiny Dandelion (Taraxacum japonicum)__Kingdom: Plantae_Phylum: Tracheophyta _Class: Magnoliopsida__Plant classification differs from animal taxonomy._Spiny Dandelion belongs to Plantae with phylum_Tracheophyta._Classification ends at Magnoliopsida level for this plant.__Test: Plant-specific taxonomic structure. __Raw Replacement - Multiple Species Comparison__Species Comparison:__Species A: Kiwa hirsuta (2005)_Species B: Phyllopteryx dewysea (2015)__Habitat A: Deep sea_Habitat B: Coastal waters__Discovery timeline: Kiwa hirsuta found 2005, Phyllopteryx_dewysea found 2015._Environment: Deep sea vs Coastal waters.__Test: Numbered parameters (Kiwa hirsuta/Phyllopteryx_dewysea) and temporal data.__Raw Replacement - Taxonomic Hierarchy__Complete Taxonomic Classification:__Domain: Eukaryota_Kingdom: Animalia_Phylum: Chordata_Class: Mammalia_Order: Primates_Family: Hominidae_Genus: Homo_Species: Homo luzonensis__Full hierarchy: Eukaryota > Animalia > Chordata >_Mammalia > Primates > Hominidae > Homo > Homo luzonensis__Test: Complete 8-level taxonomic classification with all_major ranks.__Raw Replacement - Research Data__Research Study:__Lead Researcher: Dr. Matthew Leach_Institution: California Academy of Sciences_Method: Genetic analysis_Sample Size: 47 specimens__Study conducted by Dr. Matthew Leach at California_Academy of Sciences._Used Genetic analysis with 47 total samples.__Test: Researcher names, institution names, methodology_terms, numeric data.__Export and Variables__Organism Data Export:__export Illacme tobini_NAME="Illacme tobini"_export 2016=2016_export 414=414_export California="California"_export Endemic="Endemic"__echo "Processing Illacme tobini from 2016"_echo "Characteristics: 414 legs"_echo "Location: California (Endemic)"__Variable assignment test: Illacme tobini has 414 legs,_found in California._Status: Endemic as of 2016 discovery.__Test: Shell exports, numeric values, status terms. __Expected output shows proper text substitution with word_boundary protection.'
data/bats/import.bats CHANGED
@@ -2,20 +2,20 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Directives - import, indented' {
5
+ @test 'lists indented blocks from imported file' {
6
6
  BATS_OUTPUT_FILTER=A
7
7
  spec_mde_args_expect docs/dev/import.md \
8
8
  --list-blocks-message indent --list-blocks \
9
9
  ' '
10
10
  }
11
11
 
12
- @test 'Directives - import, missing' {
12
+ @test 'reports error when imported file missing' {
13
13
  BATS_OUTPUT_FILTER=A
14
14
  spec_mde_args_expect docs/dev/import-missing.md \
15
15
  ' Error: CachedNestedFileReader.readlines -- No such file or directory - this-is-missing.md @@ '
16
16
  }
17
17
 
18
- @test 'Directives - import; list block ids' {
18
+ @test 'lists block ids from imported file' {
19
19
  BATS_OUTPUT_FILTER=A
20
20
  BATS_SAFE=_
21
21
  spec_mde_args_expect docs/dev/import.md \
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'an indented block with multiple lines' {
5
+ @test 'renders indented vars block with multiple lines' {
6
6
  BATS_OUTPUT_FILTER=A
7
7
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/indented-block-type-vars.md \
8
8
  ' Species: Pongo tapanuliensis_ Genus: Pongo'
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Retain whitespace in output from shell blocks' {
5
+ @test 'retains whitespace in shell block output' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/indented-multi-line-output.md \
7
7
  '[make-output]' \
8
8
  '_Species_ Genus_ Family_Order'
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Line decor, dynamic - new pattern, line_decor_pre, ansi' {
5
+ @test 'applies dynamic line decoration with ANSI codes' {
6
6
  spec_mde_dname_doc_blocks_expect docs/dev/line-decor-dynamic.md \
7
7
  $'\e[1m\e[3m\e[38;2;200;200;33m\e[48;2;60;60;32mSpecies\e[22;23;0m'
8
8
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Text and Headings' {
5
+ @test 'wraps text and headings to screen width' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/line-wrapping.md \
7
7
  " DEMO WRAPPING LONG LINES__MDE detects the screen's dimensions:_height (lines) and width (characters)__Normal document text is displayed as_disabled menu lines. The width of these_lines is limited according to the_screen's width.__Test Indented Lines__ Indented with two spaces, this line_ should wrap in an aesthetically_ pleasing way.__ Indented with a tab, this line should_ wrap in an aesthetically pleasing_ way.__ SPECIES GENUS FAMILY ORDER CLASS PHYLUM_ KINGDOM DOMAIN_species genus family order class phylum_kingdom domain"
8
8
  }
@@ -2,24 +2,24 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'document initial state' {
5
+ @test 'displays document initial state' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/load-vars-state-demo.md \
7
7
  'var1 = line1_var3 = line6_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ LOAD BLOCK STATE MODIFICATION DEMO__This document demonstrates how a LOAD block can modify_the inherited state that was initially set by VARS_blocks.__First, establish baseline variables using a VARS block:__Use a LOAD block to modify the initial state:__load-mode-default_load-mode-append_load-mode-replace'
8
8
  }
9
9
 
10
- @test 'load-mode-default' {
10
+ @test 'applies load-mode-default to inherited state' {
11
11
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/load-vars-state-demo.md \
12
12
  load-mode-default \
13
13
  'var1 = line1_var3 = line6_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ - : # line 1_ - : var1=line2_ - : # line 3_ - : var2=line4_ - : # line 5_ LOAD BLOCK STATE MODIFICATION DEMO__This document demonstrates how a LOAD block can modify_the inherited state that was initially set by VARS_blocks.__First, establish baseline variables using a VARS block:__Use a LOAD block to modify the initial state:__load-mode-default_load-mode-append_load-mode-replace'
14
14
  }
15
15
 
16
- @test 'load-mode-append' {
16
+ @test 'appends to inherited state with load-mode-append' {
17
17
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/load-vars-state-demo.md \
18
18
  load-mode-append \
19
19
  'var1 = line1_var3 = line6_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ - : # line 1_ - : var1=line2_ - : # line 3_ - : var2=line4_ - : # line 5_ LOAD BLOCK STATE MODIFICATION DEMO__This document demonstrates how a LOAD block can modify_the inherited state that was initially set by VARS_blocks.__First, establish baseline variables using a VARS block:__Use a LOAD block to modify the initial state:__load-mode-default_load-mode-append_load-mode-replace'
20
20
  }
21
21
 
22
- @test 'load-mode-replace' {
22
+ @test 'replaces inherited state with load-mode-replace' {
23
23
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/load-vars-state-demo.md \
24
24
  load-mode-replace \
25
25
  'var1 = line1_var3 = line6_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ inherited_lines_ - : # line 1_ - : var1=line2_ - : # line 3_ - : var2=line4_ - : # line 5_ LOAD BLOCK STATE MODIFICATION DEMO__This document demonstrates how a LOAD block can modify_the inherited state that was initially set by VARS_blocks.__First, establish baseline variables using a VARS block:__Use a LOAD block to modify the initial state:__load-mode-default_load-mode-append_load-mode-replace'
data/bats/markup.bats CHANGED
@@ -4,17 +4,17 @@ load 'test_helper'
4
4
 
5
5
  # Text Decoration
6
6
 
7
- @test 'Options - list blocks - 1 plain' {
7
+ @test 'displays text decoration with markup' {
8
8
  spec_mde_xansi_oname_doc_blocks_expect docs/dev/text-decoration.md \
9
9
  '- **_Bold-Underline_**_- **Bold**_- **~Bold-Italic~**_- __Underline___- _~Underline-Italic~__- `Italic`_- ~~Strikethrough~~'
10
10
  }
11
11
 
12
- @test 'Options - list blocks - 2 extracts markup' {
12
+ @test 'extracts markup from text decoration' {
13
13
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/text-decoration.md \
14
14
  '- Bold-Underline_- Bold_- Bold-Italic_- Underline_- Underline-Italic_- Italic_- Strikethrough'
15
15
  }
16
16
 
17
- @test 'Options - list blocks - 3 decorates' {
17
+ @test 'applies ANSI decoration to text' {
18
18
  spec_mde_args_expect docs/dev/text-decoration.md \
19
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'
@@ -32,7 +32,7 @@ load 'test_helper'
32
32
  # }
33
33
 
34
34
  # test ANSI escape sequence removal within BATS
35
- @test "comparison with ANSI removal" {
35
+ @test 'removes ANSI escape sequences' {
36
36
  actual="Hello, \e[31mWorld\e[0m!"
37
37
  echo 'actual'
38
38
  echo -en "$actual" | hexdump -C
data/bats/mde.bats CHANGED
@@ -4,14 +4,14 @@ load 'test_helper'
4
4
 
5
5
  # Directives
6
6
 
7
- @test 'Directives - Import' {
7
+ @test 'executes block from imported file' {
8
8
  # this shell block is in the import, not the primary document
9
9
  run_mde_specs_md_args_expect_xansi 'shell-block-in-import' ' shell-block-in-import'
10
10
  }
11
11
 
12
12
  # Blocks, Wrapped
13
13
 
14
- @test 'Shell blocks - wrapped block; nested; inverted' {
14
+ @test 'executes wrapped blocks with nested and inverted nesting' {
15
15
  run_mde_specs_md_args_expect_xansi '[single]' ' outer-before single-body outer-after'
16
16
  run_mde_specs_md_args_expect_xansi '[nested]' ' outer-before inner-before nested-body inner-after outer-after'
17
17
  run_mde_specs_md_args_expect_xansi '[inverted-nesting]' ' inner-before outer-before inverted-nesting outer-after inner-after'
@@ -19,11 +19,11 @@ load 'test_helper'
19
19
 
20
20
  # Blocks, Wrapped, Imported
21
21
 
22
- @test 'Shell blocks - wrapped block; imported' {
22
+ @test 'executes wrapped block from imported file' {
23
23
  # the wrap blocks are in the import, not the primary document
24
24
  run_mde_specs_md_args_expect_xansi '[test-wrap-from-import]' ' wrap-from-import-before test-wrap-from-import wrap-from-import-after'
25
25
  }
26
26
 
27
- @test 'Shell blocks - required; wrapped block' {
27
+ @test 'executes required wrapped block' {
28
28
  run_mde_specs_md_args_expect_xansi '[test-require-wrapped-block]' ' outer-before single-body outer-after test-require-wrapped-block'
29
29
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test '' {
5
+ @test 'expands options in table columns' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/option-expansion.md \
7
7
  '_| Opti | Description | Valu | Va | Defau |_| ---- | ---------------------------- | ---- | -- | ----- |_| scre | Screen width for document an | 2 | 64 | 0 |_| tabl | | 5 | fa | true |'
8
8
  }
@@ -2,24 +2,24 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'Options - Collapsible - Document options' {
5
+ @test 'collapses document options by default' {
6
6
  spec_mde_xansi_oname_doc_blocks_expect docs/dev/options-collapse.md \
7
7
  'H1.1_L1.1_H2.1_H1.2_H1.3_L1.3_H2.3_L2.3_h3.3_L3.3_D4.3_L4.3'
8
8
  }
9
9
 
10
- @test 'Options - Collapsible Heading - Expand' {
10
+ @test 'expands collapsible heading when selected' {
11
11
  spec_mde_xansi_oname_doc_blocks_expect docs/dev/options-collapse.md \
12
12
  H2.1 \
13
13
  'H1.1_L1.1_H2.1_L2.1_h3.1_L3.1_D4.1_L4.1_H1.2_H1.3_L1.3_H2.3_L2.3_h3.3_L3.3_D4.3_L4.3'
14
14
  }
15
15
 
16
- @test 'Options - Collapsible Divider' {
16
+ @test 'expands collapsible divider when selected' {
17
17
  spec_mde_xansi_oname_doc_blocks_expect docs/dev/options-collapse.md \
18
18
  D4.3 \
19
19
  'H1.1_L1.1_H2.1_H1.2_H1.3_L1.3_H2.3_L2.3_h3.3_L3.3_D4.3'
20
20
  }
21
21
 
22
- @test 'Options - Reveal' {
22
+ @test 'reveals multiple collapsed sections' {
23
23
  spec_mde_xansi_oname_doc_blocks_expect docs/dev/options-collapse.md \
24
24
  H1.2 H2.2 h3.2 D4.2 \
25
25
  'H1.1_L1.1_H2.1_H1.2_L1.2_H2.2_L2.2_h3.2_L3.2_D4.2_L4.2_H1.3_L1.3_H2.3_L2.3_h3.3_L3.3_D4.3_L4.3'
data/bats/options.bats CHANGED
@@ -4,59 +4,89 @@ load 'test_helper'
4
4
 
5
5
  # Defaults
6
6
 
7
- @test 'Options - document and block name' {
7
+ @test 'executes block from document' {
8
8
  run_mde_specs_md_args_expect_xansi bash1 \
9
9
  ' bash1!'
10
10
  }
11
11
 
12
12
  # Options
13
13
 
14
- @test 'Options - block-name' {
14
+ @test 'executes block using block-name option' {
15
15
  BATS_OUTPUT_FILTER=A
16
16
  spec_mde_args_expect --block-name bash1 docs/dev/specs.md \
17
17
  ' bash1!'
18
18
  }
19
19
 
20
- @test 'Options - find, find-path in directory names' {
20
+ @test 'find-path searches directory names' {
21
21
  run_mde_specs_md_args_expect_xansi --find-path ./docs --find search \
22
22
  'Searching in: ./docs In directory names ./docs/research In file names ./docs/dev/import-substitution-research.md'
23
23
  }
24
24
 
25
- @test 'Options - find, find-path in file names' {
25
+ @test 'find-path searches file names' {
26
26
  run_mde_specs_md_args_expect_xansi --find-path ./examples --find search \
27
27
  'Searching in: ./examples In file names ./examples/search.md'
28
28
  }
29
29
 
30
- @test 'Options - list blocks' {
30
+ @test 'lists blocks' {
31
31
  BATS_OUTPUT_FILTER=A
32
32
  spec_mde_args_expect --list-blocks-message oname --list-blocks-type 0 examples/colors.md --list-blocks \
33
33
  'load_colors load_colors2 Unspecified1 Unknown1 Bash1 Edit-inherited-blocks History1 Link1 Load1 Opts1 Port1 Save1 Vars1'
34
34
  }
35
35
 
36
- @test 'Options - list blocks, eval' {
36
+ @test 'lists blocks with eval' {
37
37
  BATS_OUTPUT_FILTER=A
38
38
  spec_mde_args_expect --list-blocks-eval block.oname examples/colors.md --list-blocks \
39
39
  'load_colors load_colors2 Unspecified1 Unknown1 Bash1 Edit-inherited-blocks History1 Link1 Load1 Opts1 Port1 Save1 Vars1'
40
40
  }
41
41
 
42
- @test 'Options - how' {
42
+ @test 'shows how option format' {
43
43
  spec_mde_args_expect --how how \
44
- "prompt_show_expr_format: 'Expr: %{expr}' # prompt_show_expr_format"
44
+ "prompt_show_expr_format: 'Expr: %{expr}' # Format string for displaying expression values in prompts"
45
45
  }
46
46
 
47
- @test 'Options - list-default-env' {
47
+ @test 'hide_shebang default value in environment variables output' {
48
+ # [REQ:SHEBANG_HIDING] Verify hide_shebang option appears with default value in env output
49
+ # [IMPL:CLI_OPTION_IMPLEMENTATION] [ARCH:CLI_OPTION_DESIGN] [REQ:SHEBANG_HIDING]
48
50
  BATS_OUTPUT_GREP=SHEBANG
49
51
  spec_mde_args_expect --list-default-env \
50
- "MDE_SHEBANG=\#\!/usr/bin/env # Shebang for saved scripts"
52
+ "MDE_HIDE_SHEBANG=t # Hide shebang lines in document output
53
+ MDE_SHEBANG=\#\!/usr/bin/env # Shebang for saved scripts"
51
54
  }
52
55
 
53
- @test 'Options - list-default-yaml' {
56
+ @test 'hide_shebang default value in YAML output' {
57
+ # [REQ:SHEBANG_HIDING] Verify hide_shebang option appears with default value in YAML output
58
+ # [IMPL:CLI_OPTION_IMPLEMENTATION] [ARCH:CLI_OPTION_DESIGN] [REQ:SHEBANG_HIDING]
59
+ BATS_OUTPUT_FILTER=A
54
60
  BATS_OUTPUT_GREP=shebang
55
61
  spec_mde_args_expect --list-default-yaml \
56
- "shebang: '#!/usr/bin/env' # Shebang for saved scripts"
62
+ "hide_shebang: true # Hide shebang lines in document output shebang: '#!/usr/bin/env' # Shebang for saved scripts"
63
+ }
64
+
65
+ @test 'shebang lines hidden by default in document processing' {
66
+ # [REQ:SHEBANG_HIDING] Verify shebang lines are filtered from document output by default
67
+ # [IMPL:SHEBANG_FILTERING] [ARCH:SHEBANG_EXTRACTION] [REQ:SHEBANG_HIDING]
68
+ BATS_OUTPUT_FILTER=A
69
+ spec_mde_args_expect docs/dev/shebang.md --blocks dname \
70
+ 'Demonstrate opening the document via Shebang. print-test'
71
+ }
72
+
73
+ @test 'markdown file with shebang executable directly' {
74
+ # [REQ:SHEBANG_HIDING] Verify markdown files with shebang can be executed directly
75
+ # [ARCH:SHEBANG_EXTRACTION] [REQ:SHEBANG_HIDING]
76
+ output="$(./docs/dev/shebang.md --blocks dname)"
77
+ output="$(remove_ansi_escape_sequences "$output")"
78
+ [[ "$output" == "Demonstrate opening the document via Shebang. print-test" ]]
79
+ }
80
+
81
+ @test 'shebang file executes specified block name directly' {
82
+ # [REQ:SHEBANG_HIDING] Verify shebang files can execute specific blocks when block name provided
83
+ # [ARCH:SHEBANG_EXTRACTION] [REQ:SHEBANG_HIDING]
84
+ output="$(./docs/dev/shebang.md print-test)"
85
+ output="$(remove_ansi_escape_sequences "$output")"
86
+ [[ "$output" == " Test" ]]
57
87
  }
58
88
 
59
- @test 'Options - list-docs, path' {
89
+ @test 'lists documents in path' {
60
90
  BATS_OUTPUT_FILTER=A
61
91
  BATS_OUTPUT_GREP=specs
62
92
  spec_mde_args_expect --path docs/dev --list-docs \
@@ -71,26 +101,26 @@ load 'test_helper'
71
101
  # "?"
72
102
  # }
73
103
 
74
- @test 'Options - load-code' {
104
+ @test 'loads code from file' {
75
105
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/load_code.md \
76
106
  --load-code docs/dev/load1.sh \
77
107
  --blocks dname \
78
108
  '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
109
  }
80
110
 
81
- @test 'Options - pwd' {
111
+ @test 'prints working directory' {
82
112
  spec_mde_args_expect --pwd \
83
113
  $(pwd)
84
114
  }
85
115
 
86
- @test 'Options - tab-completions' {
116
+ @test 'shows tab completions' {
87
117
  BATS_OUTPUT_FILTER=A
88
118
  BATS_OUTPUT_GREP=find
89
119
  spec_mde_args_expect --tab-completions \
90
120
  '--find --find-path'
91
121
  }
92
122
 
93
- @test 'Options - version' {
123
+ @test 'displays version' {
94
124
  version=$(grep VERSION "lib/markdown_exec/version.rb" | cut -d "'" -f 2)
95
125
  spec_mde_args_expect --version \
96
126
  "$version"
data/bats/plain.bats CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  load 'test_helper'
4
4
 
5
- @test 'no-active-elements' {
5
+ @test 'renders document with no active elements' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/no-active-elements.md \
7
7
  'DEMONSTRATE A DOCUMENT WITH NO ACTIVE ELEMENTS_A document with no active elements.'
8
8
  }