markdown_exec 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +11 -2
  3. data/CHANGELOG.md +19 -0
  4. data/Gemfile.lock +1 -1
  5. data/Rakefile +32 -8
  6. data/bats/bats.bats +33 -0
  7. data/bats/block-types.bats +56 -0
  8. data/bats/cli.bats +74 -0
  9. data/bats/fail.bats +11 -0
  10. data/bats/history.bats +34 -0
  11. data/bats/markup.bats +66 -0
  12. data/bats/mde.bats +29 -0
  13. data/bats/options.bats +92 -0
  14. data/bats/test_helper.bash +152 -0
  15. data/bin/tab_completion.sh +44 -20
  16. data/docs/dev/block-type-opts.md +10 -0
  17. data/docs/dev/block-type-port.md +24 -0
  18. data/docs/dev/block-type-vars.md +7 -0
  19. data/docs/dev/pass-through-arguments.md +8 -0
  20. data/docs/dev/specs-import.md +9 -0
  21. data/docs/dev/specs.md +83 -0
  22. data/docs/dev/text-decoration.md +7 -0
  23. data/examples/bash-blocks.md +4 -4
  24. data/examples/block-names.md +2 -2
  25. data/examples/import0.md +23 -0
  26. data/examples/import1.md +13 -0
  27. data/examples/link-blocks-vars.md +3 -3
  28. data/examples/opts-blocks-require.md +6 -6
  29. data/examples/table-markup.md +31 -0
  30. data/examples/text-markup.md +58 -0
  31. data/examples/vars-blocks.md +2 -2
  32. data/examples/wrap.md +87 -9
  33. data/lib/ansi_formatter.rb +12 -6
  34. data/lib/ansi_string.rb +153 -0
  35. data/lib/argument_processor.rb +160 -0
  36. data/lib/cached_nested_file_reader.rb +4 -2
  37. data/lib/ce_get_cost_and_usage.rb +4 -3
  38. data/lib/cli.rb +1 -1
  39. data/lib/colorize.rb +39 -11
  40. data/lib/constants.rb +17 -0
  41. data/lib/directory_searcher.rb +4 -2
  42. data/lib/doh.rb +190 -0
  43. data/lib/env.rb +1 -1
  44. data/lib/exceptions.rb +9 -6
  45. data/lib/fcb.rb +0 -199
  46. data/lib/filter.rb +18 -5
  47. data/lib/find_files.rb +8 -3
  48. data/lib/format_table.rb +406 -0
  49. data/lib/hash_delegator.rb +888 -603
  50. data/lib/hierarchy_string.rb +113 -25
  51. data/lib/input_sequencer.rb +16 -10
  52. data/lib/instance_method_wrapper.rb +2 -1
  53. data/lib/layered_hash.rb +143 -0
  54. data/lib/link_history.rb +22 -8
  55. data/lib/markdown_exec/version.rb +1 -1
  56. data/lib/markdown_exec.rb +413 -165
  57. data/lib/mdoc.rb +27 -34
  58. data/lib/menu.src.yml +825 -710
  59. data/lib/menu.yml +799 -703
  60. data/lib/namer.rb +6 -12
  61. data/lib/object_present.rb +1 -1
  62. data/lib/option_value.rb +7 -3
  63. data/lib/poly.rb +33 -14
  64. data/lib/resize_terminal.rb +60 -52
  65. data/lib/saved_assets.rb +45 -34
  66. data/lib/saved_files_matcher.rb +6 -3
  67. data/lib/streams_out.rb +7 -1
  68. data/lib/table_extractor.rb +166 -0
  69. data/lib/tap.rb +5 -6
  70. data/lib/text_analyzer.rb +144 -8
  71. metadata +26 -3
  72. data/lib/std_out_err_logger.rb +0 -119
@@ -0,0 +1,152 @@
1
+ # facilitate execution of program, comparison of output
2
+
3
+ export PROJECT_ROOT="/Users/fareed/Documents/dev/ruby/markdown_exec"
4
+
5
+ date_from_history_file_name () {
6
+ basename "$1" | sed -E 's/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/\1/'
7
+ }
8
+
9
+ echo_hexdump () {
10
+ echo -en "$1" | hexdump -C
11
+ }
12
+
13
+ exec_mde () {
14
+ echo "bin/bmde "$1" "${@:2}""
15
+ run bin/bmde "$1" ${@:2}
16
+ }
17
+
18
+ expect_equal_with_conversion () {
19
+ local expected="$1"
20
+ local actual="$2"
21
+ if [[ $3 == A ]]; then
22
+ actual="$(remove_ansi_escape_sequences "$2")"
23
+ # echo "- expected"
24
+ # echo "$expected" | hexdump -C
25
+ # echo "- actual"
26
+ # echo "$actual" | hexdump -C
27
+ fi
28
+ [[ "$expected" == "$actual" ]]
29
+ }
30
+
31
+ most_recent_history_file_name () {
32
+ ls -f logs/*examples_save_md* | tail -n 1
33
+ }
34
+
35
+ # remove_ansi_escape_sequences
36
+ #
37
+ # A function to process a string by removing ANSI escape sequences and replacing
38
+ # newlines with spaces. This is particularly useful when dealing with formatted
39
+ # text output that includes color codes or other terminal formatting and needs
40
+ # to be sanitized for plain text processing.
41
+ #
42
+ # Parameters:
43
+ # $1 (string): The input string that may contain ANSI escape sequences and/or
44
+ # various whitespace characters (newlines, tabs, etc.).
45
+ #
46
+ # Returns:
47
+ # The processed string with ANSI escape sequences removed and all specified
48
+ # whitespace characters replaced by spaces.
49
+ #
50
+ # Example:
51
+ # input="Hello \e[31mWorld\e[0m\nThis\tis\ra test.\vPage\fBreak"
52
+ # result=$(remove_ansi_escape_sequences "$input")
53
+ # echo "$result"
54
+ # # Output: "Hello World This is a test. Page Break"
55
+ #
56
+ # Note:
57
+ # - The function does not modify the original input string but returns a new
58
+ # processed string.
59
+ # - ANSI escape sequences are sequences used to control formatting, color, and
60
+ # other output options on text terminals.
61
+ # - The following whitespace characters are replaced with spaces: newlines (\n),
62
+ # tabs (\t), carriage returns (\r), vertical tabs (\v), and form feeds (\f).
63
+ #
64
+ remove_ansi_escape_sequences() {
65
+ echo -en "$1" | perl -pe 's/\e\[\?*[0-9;]*[a-zA-Z]//g' | tr '\n\t\r\v\f' ' '
66
+ }
67
+
68
+ run_mde_specs_md_args_expect_xansi () {
69
+ expected="${!#}"
70
+ exec_mde docs/dev/specs.md ${@:1:$#-1}
71
+
72
+ filter="${BATS_OUTPUT_FILTER:-A}"
73
+ if ( ! expect_equal_with_conversion "$expected" "$output" "$filter" ); then
74
+ echo -e "- command: ${@:1:$#-1}"
75
+ echo -e "- expected:\n$expected"
76
+ echo_hexdump "$expected"
77
+ echo -e "- output:\n$(text_filter_ansi "$output" "$filter")"
78
+ echo_hexdump "$output"
79
+ fi
80
+
81
+ expect_equal_with_conversion "$expected" "$output" "$filter"
82
+ (( $status != $0 )) && echo "- status: $status"
83
+ [ "$status" -eq 0 ]
84
+ }
85
+
86
+ spec_mde_args_expect () {
87
+ # while :; do
88
+ # SHIFT_COUNT=2
89
+ # case "$1" in
90
+ # --ansver) RANSVER="$2" ;;
91
+ # --auto) TTY="" ; SHIFT_COUNT=1 ;;
92
+ # *) break ;;
93
+ # esac
94
+ # shift "$SHIFT_COUNT"
95
+ # done
96
+ spec_mde_args_grep_filter_expect ${@:1:$#-1} "$BATS_OUTPUT_GREP" "$BATS_OUTPUT_FILTER" "${@: -1}"
97
+ }
98
+
99
+ spec_mde_args_grep_filter_expect () {
100
+ local remaining="${@:1:$(($#-3))}"
101
+ local pattern="${@: -3:1}"
102
+ local filter="${@: -2:1}"
103
+ local expected="${@: -1}"
104
+ SL="${BATS_SLEEP}"
105
+ local STATUS="${BATS_STATUS:-0}"
106
+
107
+ if [[ -z $SL ]]; then
108
+ # echo bin/bmde "$remaining"
109
+ run bin/bmde $remaining
110
+ else
111
+ bash -c "
112
+ SL=$SL
113
+ bin/bmde $remaining >/tmp/mde.out &"'
114
+ app_pid=$!
115
+ sleep $SL
116
+ kill $app_pid && wait $app_pid 2>/dev/null
117
+ ls -al /tmp/mde.out
118
+ # cat /tmp/mde.out
119
+ :'
120
+ output="$(cat /tmp/mde.out)"
121
+ rm /tmp/mde.out
122
+ fi
123
+ local output0="$output"
124
+ if [[ -n $pattern ]]; then
125
+ # prevent error from grep
126
+ output="$(echo -en "$output" | grep "$pattern")" || :
127
+ fi
128
+
129
+ if ( ! expect_equal_with_conversion "$expected" "$output" "$filter"); then
130
+ echo -e "- output_$(echo "$output" | wc -l)_$(echo -n "$output" | wc -c):\n$output"
131
+ [[ $filter == A ]] && echo_hexdump "$output"
132
+
133
+ if [[ $filter == A ]]; then
134
+ echo -e "- converted_$(echo "$output" | wc -l)_$(echo -n "$output" | wc -c):"
135
+ echo "$(remove_ansi_escape_sequences "$output")"
136
+ echo_hexdump "$(remove_ansi_escape_sequences "$output")"
137
+ fi
138
+ echo -e "- expected_$(echo "$expected" | wc -l)_$(echo -n "$expected" | wc -c):\n$expected"
139
+ [[ $filter == A ]] && echo_hexdump "$expected"
140
+ fi
141
+ expect_equal_with_conversion "$expected" "$output" "$filter"
142
+ (( $status != $STATUS )) && echo "- status: $status"
143
+ [ "$status" -eq $STATUS ]
144
+ }
145
+
146
+ text_filter_ansi () {
147
+ if [[ $# -eq 2 ]]; then
148
+ remove_ansi_escape_sequences "$1"
149
+ else
150
+ echo -n "$1"
151
+ fi
152
+ }
@@ -13,7 +13,7 @@ __filedirs_all()
13
13
  }
14
14
 
15
15
  _mde_echo_version() {
16
- echo "2.3.0"
16
+ echo "2.4.0"
17
17
  }
18
18
 
19
19
  _mde() {
@@ -32,27 +32,29 @@ _mde() {
32
32
 
33
33
  --config) COMPREPLY="."; return 0 ;;
34
34
 
35
- --debug) COMPREPLY="0"; return 0 ;;
35
+ --debug) COMPREPLY="f"; return 0 ;;
36
36
 
37
- -d) COMPREPLY="0"; return 0 ;;
37
+ -d) COMPREPLY="f"; return 0 ;;
38
38
 
39
- --dump-delegate-object) COMPREPLY="0"; return 0 ;;
39
+ --dump-blocks-in-file) COMPREPLY="f"; return 0 ;;
40
40
 
41
- --dump-blocks-in-file) COMPREPLY="0"; return 0 ;;
41
+ --dump-delegate-object) COMPREPLY="f"; return 0 ;;
42
42
 
43
- --dump-inherited-block_names) COMPREPLY="0"; return 0 ;;
43
+ --dump-dependencies) COMPREPLY="f"; return 0 ;;
44
44
 
45
- --dump-inherited-dependencies) COMPREPLY="0"; return 0 ;;
45
+ --dump-inherited-block-names) COMPREPLY="f"; return 0 ;;
46
46
 
47
- --dump-inherited-lines) COMPREPLY="0"; return 0 ;;
47
+ --dump-inherited-dependencies) COMPREPLY="f"; return 0 ;;
48
48
 
49
- --dump-menu-blocks) COMPREPLY="0"; return 0 ;;
49
+ --dump-inherited-lines) COMPREPLY="f"; return 0 ;;
50
50
 
51
- --dump-selected-block) COMPREPLY="0"; return 0 ;;
51
+ --dump-menu-blocks) COMPREPLY="f"; return 0 ;;
52
52
 
53
- --execute_in_own_window) COMPREPLY="0"; return 0 ;;
53
+ --dump-selected-block) COMPREPLY="f"; return 0 ;;
54
54
 
55
- -w) COMPREPLY="0"; return 0 ;;
55
+ --execute-in-own-window) COMPREPLY="f"; return 0 ;;
56
+
57
+ -w) COMPREPLY="f"; return 0 ;;
56
58
 
57
59
  --filename) COMPREPLY="."; return 0 ;;
58
60
 
@@ -68,8 +70,16 @@ _mde() {
68
70
 
69
71
  -?) COMPREPLY="''"; return 0 ;;
70
72
 
73
+ --list-blocks-eval) COMPREPLY="''"; return 0 ;;
74
+
75
+ --list-blocks-message) COMPREPLY="oname"; return 0 ;;
76
+
77
+ --list-blocks-type) COMPREPLY="0"; return 0 ;;
78
+
71
79
  --list-count) COMPREPLY="32"; return 0 ;;
72
80
 
81
+ --format) COMPREPLY="text"; return 0 ;;
82
+
73
83
  --load-code) COMPREPLY="''"; return 0 ;;
74
84
 
75
85
  -l) COMPREPLY="''"; return 0 ;;
@@ -78,17 +88,19 @@ _mde() {
78
88
 
79
89
  -o) COMPREPLY="''"; return 0 ;;
80
90
 
81
- --output-script) COMPREPLY="0"; return 0 ;;
91
+ --output-script) COMPREPLY="f"; return 0 ;;
82
92
 
83
- --output-stdout) COMPREPLY="1"; return 0 ;;
93
+ --output-stdout) COMPREPLY="t"; return 0 ;;
84
94
 
85
95
  --path) COMPREPLY="."; return 0 ;;
86
96
 
87
97
  -p) COMPREPLY="."; return 0 ;;
88
98
 
89
- --user-must-approve) COMPREPLY="0"; return 0 ;;
99
+ --pause-after-script-execution) COMPREPLY="f"; return 0 ;;
100
+
101
+ --user-must-approve) COMPREPLY="f"; return 0 ;;
90
102
 
91
- -q) COMPREPLY="0"; return 0 ;;
103
+ -q) COMPREPLY="f"; return 0 ;;
92
104
 
93
105
  --display-level) COMPREPLY="1"; return 0 ;;
94
106
 
@@ -100,7 +112,7 @@ _mde() {
100
112
  # present matching option names
101
113
  #
102
114
  if [[ ${cur} == -* ]] ; then
103
- opts=("--block-name" "--config" "--debug" "--dump-delegate-object" "--dump-blocks-in-file" "--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" "--how" "--list-blocks" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--load-code" "--open" "--output-script" "--output-stdout" "--path" "--pwd" "--run-last-script" "--tab-completions" "--user-must-approve" "--version" "--display-level")
115
+ 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")
104
116
  COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
105
117
 
106
118
  return 0
@@ -123,11 +135,13 @@ _mde() {
123
135
 
124
136
  -d) COMPREPLY=".BOOL."; return 0 ;;
125
137
 
138
+ --dump-blocks-in-file) COMPREPLY=".BOOL."; return 0 ;;
139
+
126
140
  --dump-delegate-object) COMPREPLY=".BOOL."; return 0 ;;
127
141
 
128
- --dump-blocks-in-file) COMPREPLY=".BOOL."; return 0 ;;
142
+ --dump-dependencies) COMPREPLY=".BOOL."; return 0 ;;
129
143
 
130
- --dump-inherited-block_names) COMPREPLY=".BOOL."; return 0 ;;
144
+ --dump-inherited-block-names) COMPREPLY=".BOOL."; return 0 ;;
131
145
 
132
146
  --dump-inherited-dependencies) COMPREPLY=".BOOL."; return 0 ;;
133
147
 
@@ -137,7 +151,7 @@ _mde() {
137
151
 
138
152
  --dump-selected-block) COMPREPLY=".BOOL."; return 0 ;;
139
153
 
140
- --execute_in_own_window) COMPREPLY=".BOOL."; return 0 ;;
154
+ --execute-in-own-window) COMPREPLY=".BOOL."; return 0 ;;
141
155
 
142
156
  -w) COMPREPLY=".BOOL."; return 0 ;;
143
157
 
@@ -155,8 +169,16 @@ _mde() {
155
169
 
156
170
  -?) COMPREPLY=".HOW."; return 0 ;;
157
171
 
172
+ --list-blocks-eval) COMPREPLY=".EVAL."; return 0 ;;
173
+
174
+ --list-blocks-message) COMPREPLY=".MESSAGE."; return 0 ;;
175
+
176
+ --list-blocks-type) COMPREPLY=".TYPE."; return 0 ;;
177
+
158
178
  --list-count) COMPREPLY=".INT.1-."; return 0 ;;
159
179
 
180
+ --format) COMPREPLY=".FORMAT."; return 0 ;;
181
+
160
182
  --load-code) COMPREPLY=".PATH."; return 0 ;;
161
183
 
162
184
  -l) COMPREPLY=".PATH."; return 0 ;;
@@ -173,6 +195,8 @@ _mde() {
173
195
 
174
196
  -p) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
175
197
 
198
+ --pause-after-script-execution) COMPREPLY=".BOOL."; return 0 ;;
199
+
176
200
  --user-must-approve) COMPREPLY=".BOOL."; return 0 ;;
177
201
 
178
202
  -q) COMPREPLY=".BOOL."; return 0 ;;
@@ -0,0 +1,10 @@
1
+ Species
2
+ ```opts :[decorate-note]
3
+ menu_note_format: "AFTER %{line}"
4
+ ```
5
+ @import bats-document-configuration.md
6
+ ```opts :(document_options)
7
+ menu_divider_format:
8
+ menu_note_format: "BEFORE %{line}"
9
+ menu_with_exit: false
10
+ ```
@@ -0,0 +1,24 @@
1
+ ```vars :[set_vault_1]
2
+ VAULT: 1
3
+ ```
4
+
5
+ ::: This is a Port block that saves current/live environment variable values into the generated script.
6
+
7
+ ```port :[vault]
8
+ VAULT
9
+ ```
10
+
11
+ ```bash :VAULT-is-export
12
+ exported_vault=$(export -p | grep '^declare -x VAULT')
13
+ # (No output, var is not exported)
14
+ ```
15
+
16
+ ::: This block requires the Port block and displays the value.
17
+ ::: The Port block contributes the variable VAULT to the generated script.
18
+
19
+ ```bash :show +[set_vault_1] +[vault]
20
+ : ${VAULT:=This variable has not been set.}
21
+ echo "VAULT: $VAULT"
22
+ ```
23
+
24
+ @import bats-document-configuration.md
@@ -0,0 +1,7 @@
1
+ ```vars :[set_vault_1]
2
+ VAULT: 1
3
+ ```
4
+ ```bash :show
5
+ echo "VAULT: $VAULT"
6
+ ```
7
+ @import bats-document-configuration.md
@@ -0,0 +1,8 @@
1
+ This block will output any command line arguments after "--".
2
+ ```bash :output_arguments
3
+ echo "ARGS: $*"
4
+ ```
5
+ ```link :[ok]
6
+ block: output_arguments
7
+ ```
8
+ @import bats-document-configuration.md
@@ -0,0 +1,9 @@
1
+ ```bash :shell-block-in-import
2
+ echo shell-block-in-import
3
+ ```
4
+ ```bash :{wrap-from-import}
5
+ echo "wrap-from-import-before"
6
+ ```
7
+ ```bash :{wrap-from-import-after}
8
+ echo "wrap-from-import-after"
9
+ ```
data/docs/dev/specs.md ADDED
@@ -0,0 +1,83 @@
1
+ # Automated tests
2
+
3
+ ## Shell blocks
4
+
5
+ ```bash :bash1
6
+ echo "bash1!"
7
+ ```
8
+
9
+ ## Link Vars
10
+
11
+ | inputs to MDE| expected output
12
+ | -| -
13
+ | '[VARIABLE1]'| ' VARIABLE1: 1'
14
+ | '[VARIABLE1]' '(echo-VARIABLE1)'| ' VARIABLE1: 1 VARIABLE1: 1'
15
+
16
+ ```bash :(echo-VARIABLE1)
17
+ for var_name in "VARIABLE1"; do
18
+ # echo -e "\033[0;33m${var_name}\033[0;31m:\033[0m ${!var_name}"
19
+ echo -e "${var_name}: ${!var_name}"
20
+ done
21
+ ```
22
+ ```link :[VARIABLE1]
23
+ block: (echo-VARIABLE1)
24
+ vars:
25
+ VARIABLE1: 1
26
+ ```
27
+
28
+ ## Nested wraps
29
+
30
+ | inputs to MDE| expected output
31
+ | -| -
32
+ | '[single]'| ' single-body'
33
+ | '[inverted-nesting]'| ' inner-before outer-before single-body outer-after inner-after'
34
+
35
+ ```bash :[single] +{outer}
36
+ echo single-body
37
+ ```
38
+ Expect output: "outer-before", "inner-before", "nested body", "inner-after", and "outer-after".
39
+ ```bash :[nested] +{outer} +{inner}
40
+ echo nested-body
41
+ ```
42
+ ```bash :[inverted-nesting] +{inner} +{outer}
43
+ echo inverted-nesting
44
+ ```
45
+ ```bash :{inner}
46
+ echo inner-before
47
+ ```
48
+ ```bash :{inner-after}
49
+ echo inner-after
50
+ ```
51
+ ```bash :{outer}
52
+ echo outer-before
53
+ ```
54
+ ```bash :{outer-after}
55
+ echo outer-after
56
+ ```
57
+
58
+ @import specs-import.md
59
+
60
+ / Import `{wrap1}` blocks.
61
+ ```bash :[test-wrap-from-import] +{wrap-from-import}
62
+ echo "test-wrap-from-import"
63
+ ```
64
+
65
+ / Include a wrapped block.
66
+ ```bash :[test-require-wrapped-block] +[single]
67
+ echo "test-require-wrapped-block"
68
+ ```
69
+
70
+ ```opts :(disable_dump_*)
71
+ dump_blocks_in_file: false
72
+ dump_dependencies: false
73
+ dump_inherited_block_names: false
74
+ dump_inherited_dependencies: false
75
+ dump_inherited_lines: false
76
+ dump_menu_blocks: false
77
+ ```
78
+
79
+ @import bats-document-configuration.md
80
+ ```opts :(document_options) +(disable_dump_*)
81
+ menu_note_color: 'plain'
82
+ menu_with_inherited_lines: false
83
+ ```
@@ -0,0 +1,7 @@
1
+ - **_Bold-Underline_**
2
+ - **Bold**
3
+ - **~Bold-Italic~**
4
+ - __Underline__
5
+ - _~Underline-Italic~_
6
+ - `Italic`
7
+ - ~~Strikethrough~~
@@ -1,18 +1,18 @@
1
1
  # Demonstrate requiring shell blocks
2
2
  ## Requiring a named block
3
- ::: Click below to trigger. If it prints "species", "genus", the required block was processed.
3
+ ::: Select below to trigger. If it prints "species", "genus", the required block was processed.
4
4
  The un-named block prints "species" and requires block "genus".
5
5
  ```bash +genus
6
6
  echo "species"
7
7
  ```
8
- ::: Click below to trigger. If it prints "genus", the block was processed.
8
+ ::: Select below to trigger. If it prints "genus", the block was processed.
9
9
  The named block prints "genus".
10
10
  ```bash :genus
11
11
  echo "genus"
12
12
  ```
13
13
 
14
14
  ## Requiring a block with a nickname and a hidden block
15
- ::: Click below to trigger. If it prints "family", "order", "class" the required blocks were processed.
15
+ ::: Select below to trigger. If it prints "family", "order", "class" the required blocks were processed.
16
16
  The named block prints "family" and requires blocks "[order]" and "(class)".
17
17
  ```bash :family +[order] +(class)
18
18
  echo "family"
@@ -39,7 +39,7 @@ The hidden block "(biology)" prints "biology".
39
39
  ```bash :(biology)
40
40
  echo "biology"
41
41
  ```
42
- ::: Click below to trigger. If it prints "biology", "phylum", "kingdom", "domain", and "taxonomy" the required blocks were processed.
42
+ ::: Select below to trigger. If it prints "biology", "phylum", "kingdom", "domain", and "taxonomy" the required blocks were processed.
43
43
  The named block prints "kingdom" and requires blocks wrapper blocks "{phylum-domain}" and "{phylum-domain-after}".
44
44
  Notice the wrapper blocks are exclusive to the single block with the requirement.
45
45
  ```bash :kingdom +{phylum-domain} +(biology) +(taxonomy)
@@ -1,6 +1,6 @@
1
1
  ## Demonstrate handling of special characters in block names
2
2
 
3
- ::: Click below to trigger. If it prints "1","2","3","4", the Link blocks were required.
3
+ ::: Select below to trigger. If it prints "1","2","3","4", the Link blocks were required.
4
4
  Long block names can be required by a Bash block.
5
5
  ```bash :calling-block +long_block_name_12345678901234567890123456789012345678901234567890 +(long_block_name_12345678901234567890123456789012345678901234567890) +[long_block_name_12345678901234567890123456789012345678901234567890]
6
6
  echo '1'
@@ -31,7 +31,7 @@ Block names with all chars.
31
31
  / UTF-8
32
32
  / !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
33
33
  / ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
34
- ::: Click below to trigger. If it prints "Success", the Link block was processed.
34
+ ::: Select below to trigger. If it prints "Success", the Link block was processed.
35
35
  This block name uses the printable characters in the first 128 values. It is executable.
36
36
  ```link :!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
37
37
  block: (success)
data/examples/import0.md CHANGED
@@ -40,3 +40,26 @@ menu_include_imported_notes: true
40
40
  ```link :page_1
41
41
  file: examples/import1.md
42
42
  ```
43
+
44
+ ::: Imported `{wrap1}` blocks.
45
+ ```bash :test-wrap1 +{wrap1}
46
+ echo "test wrap1"
47
+ ```
48
+
49
+ ::: Imported and Overloaded `{wrap2}` blocks.
50
+ ```bash :test-wrap2 +{wrap2}
51
+ echo "test wrap2 - overloaded"
52
+ ```
53
+ ```bash :{wrap2}
54
+ echo "wrap2 before - overloaded"
55
+ ```
56
+ ```bash :{wrap2-after}
57
+ echo "wrap2 after- overloaded"
58
+ ```
59
+ Local wrapped blocks, before or after the principal block, generate the same output.
60
+ __Output__
61
+ wrap2 before
62
+ wrap2 before - overloaded
63
+ test wrap2 - overloaded
64
+ wrap2 after
65
+ wrap2 after- overloaded
data/examples/import1.md CHANGED
@@ -9,3 +9,16 @@ echo "page 1 block 1 visible"
9
9
  ```bash :(page1_block2)
10
10
  echo "page 1 block 2 hidden"
11
11
  ```
12
+
13
+ ```bash :{wrap1}
14
+ echo "wrap1 before"
15
+ ```
16
+ ```bash :{wrap1-after}
17
+ echo "wrap1 after"
18
+ ```
19
+ ```bash :{wrap2}
20
+ echo "wrap2 before"
21
+ ```
22
+ ```bash :{wrap2-after}
23
+ echo "wrap2 after"
24
+ ```
@@ -8,7 +8,7 @@ pause_after_script_execution: true
8
8
  ```
9
9
 
10
10
  ## Demonstrate a link block that sets a variable
11
- ::: Click below to trigger. If it prints "VARIABLE1: 1", the Link block was processed.
11
+ ::: Select below to trigger. If it prints "VARIABLE1: 1", the Link block was processed.
12
12
  The hidden block "(print-VARIABLE1)" is required below. It prints variable "VARIABLE1".
13
13
  ```bash :(print-VARIABLE1)
14
14
  source bin/colorize_env_vars.sh
@@ -27,7 +27,7 @@ This block "[bash_set_to_3]" is required below. It sets the variable "ALPHA".
27
27
  ```bash :[bash_set_to_3]
28
28
  ALPHA=3
29
29
  ```
30
- ::: Click below to trigger. If it prints "ALPHA: 3", the Link block was processed.
30
+ ::: Select below to trigger. If it prints "ALPHA: 3", the Link block was processed.
31
31
  These blocks require the *code* of the named shell block.
32
32
  ```link +[bash_set_to_3]
33
33
  block: "(display_variable_ALPHA)"
@@ -40,7 +40,7 @@ This block "[bash_set_to_4]" is required below. It prints a command that sets th
40
40
  ```bash :[bash_set_to_4]
41
41
  echo "ALPHA=4"
42
42
  ```
43
- ::: Click below to trigger. If it prints "ALPHA: 4", the Link block was processed.
43
+ ::: Select below to trigger. If it prints "ALPHA: 4", the Link block was processed.
44
44
  These blocks require the *output* of the execution of the code in the named shell block.
45
45
  ```link +[bash_set_to_4]
46
46
  eval: true
@@ -8,21 +8,21 @@ menu_divider_color: green # color to indicate success
8
8
  ## Automatic documents options
9
9
  ::: If this text is green, the required Opts block was processed; if this text is red, the required Opts block was NOT processed hidden, name: "(custom)"
10
10
 
11
- ## Click this named block to test
12
- ::: Click below to trigger. If this text starts with "+++", the required Opts block was processed; name: "custom"
11
+ ## Select this named block to test
12
+ ::: Select below to trigger. If this text starts with "+++", the required Opts block was processed; name: "custom"
13
13
  ```opts :custom
14
14
  menu_divider_format: "+++ %{line}" # format to indicate success
15
15
  ```
16
16
 
17
- ## Click this nicknamed block to test
18
- ::: Click below to trigger. If this text starts with "!!!", the Opts block was processed; name: "[custom]"
17
+ ## Select this nicknamed block to test
18
+ ::: Select below to trigger. If this text starts with "!!!", the Opts block was processed; name: "[custom]"
19
19
  This block has a nickname "[custom]". It is executable.
20
20
  ```opts :[custom]
21
21
  menu_divider_format: "!!! %{line}" # format to indicate success
22
22
  ```
23
23
 
24
- ## Click this unnamed block to test
25
- ::: Click below to trigger. If this text starts with "@@@", the required Opts block was processed; unnamed
24
+ ## Select this unnamed block to test
25
+ ::: Select below to trigger. If this text starts with "@@@", the required Opts block was processed; unnamed
26
26
  ```opts
27
27
  menu_divider_format: "@@@ %{line}" # format to indicate success
28
28
  ```
@@ -0,0 +1,31 @@
1
+ # Demonstrate Tables
2
+
3
+ Table flush at left.
4
+ Centered columns.
5
+ | Common Name| Species| Genus| Family| Year Discovered
6
+ |:-:|:-:|:-:|:-:|:-:
7
+ | Tapanuli Orangutan| Pongo tapanuliensis| Pongo| Hominidae| 2017
8
+ | Psychedelic Frogfish| Histiophryne psychedelica| Histiophryne| Antennariidae| 2009
9
+ | Ruby Seadragon| Phyllopteryx dewysea| Phyllopteryx| Syngnathidae| 2015
10
+
11
+ Table indented with two spaces.
12
+ Left-justified columns.
13
+ | Common Name| Species| Genus| Family| Year Discovered
14
+ |:-|:-|:-|:-|:-
15
+ | Illacme tobini (Millipede)| Illacme tobini| Illacme| Siphonorhinidae| 2016
16
+ | Cappuccino Snake| Hydrodynastes bicinctus| Hydrodynastes| Colubridae| 2021
17
+ | Homo luzonensis| Homo luzonensis| Homo| Hominidae| 2019
18
+
19
+ Table indented with one tab.
20
+ Right-justified columns.
21
+ | Common Name| Species| Genus| Family| Year Discovered
22
+ |-:|-:|-:|-:|-:
23
+ | Spiny Dandelion| Taraxacum japonicum| Taraxacum| Asteraceae| 2022
24
+ | Mythical Monkey| Cercopithecus lomamiensis| Cercopithecus| Cercopithecidae| 2012
25
+ | Yeti Crab| Kiwa hirsuta| Kiwa| Kiwaidae| 2005
26
+
27
+ ## Non-table text is not modified
28
+ 1. |
29
+ 2. ||
30
+ |
31
+ ||