markdown_exec 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +2 -2
- data/Rakefile +3 -3
- data/bats/block-types.bats +13 -7
- data/bats/import.bats +6 -0
- data/bats/markup.bats +6 -15
- data/bats/options-collapse.bats +26 -0
- data/bats/options.bats +1 -1
- data/bats/table.bats +8 -0
- data/bats/test_helper.bash +74 -49
- data/bats/variable-expansion.bats +46 -0
- data/bin/tab_completion.sh +1 -1
- data/docs/dev/bats-document-configuration.md +8 -1
- data/docs/dev/block-type-bash.md +1 -1
- data/docs/dev/block-type-opts.md +1 -5
- data/docs/dev/block-type-vars.md +4 -0
- data/docs/dev/import-missing.md +2 -0
- data/docs/dev/menu-cli.md +1 -1
- data/docs/dev/options-collapse.md +47 -0
- data/docs/dev/requiring-blocks.md +3 -0
- data/docs/dev/specs.md +2 -1
- data/docs/dev/table-crash.md +39 -0
- data/docs/dev/table-indent.md +26 -0
- data/docs/dev/text-decoration.md +2 -5
- data/docs/dev/variable-expansion.md +2 -4
- data/examples/bash-blocks.md +1 -1
- data/examples/block-names.md +1 -1
- data/examples/block-types.md +1 -1
- data/examples/data-files.md +1 -1
- data/examples/document_options.md +2 -2
- data/examples/indent.md +1 -1
- data/examples/interrupt.md +1 -1
- data/examples/link-blocks-vars.md +1 -1
- data/examples/linked.md +1 -1
- data/examples/linked1.md +1 -1
- data/examples/nickname.md +1 -1
- data/examples/opts-blocks-require.md +1 -1
- data/examples/opts-blocks.md +1 -1
- data/examples/opts_output_execution.md +1 -1
- data/examples/pass-through-arguments.md +1 -1
- data/examples/pause-after-execution.md +1 -1
- data/examples/port-blocks.md +1 -1
- data/examples/save.md +1 -1
- data/examples/text-markup.md +1 -1
- data/examples/variable-expansion.md +6 -2
- data/examples/vars-blocks.md +1 -1
- data/examples/wrap.md +1 -1
- data/lib/block_types.rb +4 -0
- data/lib/cached_nested_file_reader.rb +7 -4
- data/lib/collapser.rb +302 -0
- data/lib/constants.rb +10 -0
- data/lib/evaluate_shell_expressions.rb +0 -3
- data/lib/fcb.rb +13 -17
- data/lib/format_table.rb +11 -7
- data/lib/hash_delegator.rb +461 -272
- data/lib/hierarchy_string.rb +5 -1
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +16 -32
- data/lib/mdoc.rb +100 -35
- data/lib/menu.src.yml +124 -17
- data/lib/menu.yml +102 -16
- data/lib/ww.rb +75 -22
- metadata +12 -9
- data/lib/append_to_bash_history.rb +0 -303
- data/lib/ce_get_cost_and_usage.rb +0 -23
- data/lib/doh.rb +0 -190
- data/lib/layered_hash.rb +0 -143
- data/lib/poly.rb +0 -171
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8e475323e8db8b8288c18f8d97f1c52552c0a292854c42ab2780620bcdb8aa5
|
4
|
+
data.tar.gz: 254288c200e344c55f49c5fad1717d46550df1892eb526033180ed066f6c449d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5a6372f45da7c45ae20b0c65058347c66fa17b7afffbacb63f0000c52ff0efd99e18a22f826e7803a1f130868a1dcf0b2f59b48279d19bb1326709a2dc3c04a
|
7
|
+
data.tar.gz: 4308b84a0591e44e5e2d317c6f0c5cd7b6d74848f91a65aaf85897058321ca041113ee80889313d2b0c1a31a587796af708879f3cd3b169a976755f6cce879c9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.6.0] - 2024-11-27
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Ability to collapse and expand sections.
|
8
|
+
- Collapsible state configurable per document and per section.
|
9
|
+
- User can collapse and expand sections in the UI.
|
10
|
+
- Live shell variable expansion in document text and block content.
|
11
|
+
- Option for name of function to manage executed scripts.
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
|
15
|
+
- Tables are indented per the source.
|
16
|
+
- BATS test helper functions.
|
17
|
+
|
3
18
|
## [2.5.0] - 2024-10-27
|
4
19
|
|
5
20
|
### Added
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -79,16 +79,16 @@ task :bats do
|
|
79
79
|
FileList['bats/**/*.bats'].each do |file|
|
80
80
|
next if %w[bats/bats.bats bats/fail.bats].include?(file)
|
81
81
|
|
82
|
-
|
82
|
+
# temporary clear WW to disable debugging
|
83
|
+
# WW pollutes output expected by BATS tests
|
84
|
+
system "unset WW; bats #{file}"
|
83
85
|
end
|
84
86
|
end
|
85
87
|
|
86
88
|
desc 'minitest'
|
87
89
|
task :minitest do
|
88
90
|
commands = [
|
89
|
-
'./lib/append_to_bash_history.rb',
|
90
91
|
'./lib/argument_processor.rb',
|
91
|
-
'./lib/block_label.rb',
|
92
92
|
'./lib/cached_nested_file_reader.rb',
|
93
93
|
'./lib/directory_searcher.rb',
|
94
94
|
'./lib/evaluate_shell_expressions.rb',
|
data/bats/block-types.bats
CHANGED
@@ -51,15 +51,14 @@ load 'test_helper'
|
|
51
51
|
|
52
52
|
@test 'Opts block - before' {
|
53
53
|
skip 'Fails because command executes after the block is processed'
|
54
|
-
|
55
|
-
|
56
|
-
'BEFORE Species menu_note_format: "AFTER %{line}" '
|
54
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-opts.md \
|
55
|
+
'BEFORE Species_menu_note_format: "AFTER %{line}" '
|
57
56
|
}
|
58
57
|
|
59
58
|
@test 'Opts block - after' {
|
60
|
-
|
61
|
-
|
62
|
-
'AFTER
|
59
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-opts.md \
|
60
|
+
'[decorate-note]' \
|
61
|
+
'AFTER Species_menu_note_format: "AFTER %{line}"'
|
63
62
|
}
|
64
63
|
|
65
64
|
@test 'Opts block - show that menu has changed' {
|
@@ -85,9 +84,16 @@ load 'test_helper'
|
|
85
84
|
|
86
85
|
# Type: Vars
|
87
86
|
|
87
|
+
# includes output from automatic vars block
|
88
|
+
@test 'Vars block - auto load' {
|
89
|
+
BATS_OUTPUT_FILTER=A
|
90
|
+
spec_mde_args_expect docs/dev/block-type-vars.md show \
|
91
|
+
'Species = Not specified Species: Not specified VAULT:'
|
92
|
+
}
|
93
|
+
|
88
94
|
# includes output from assignment and from shell block
|
89
95
|
@test 'Vars block - set variable' {
|
90
96
|
BATS_OUTPUT_FILTER=A
|
91
97
|
spec_mde_args_expect docs/dev/block-type-vars.md '[set_vault_1]' show \
|
92
|
-
'VAULT = 1 VAULT: 1'
|
98
|
+
'Species = Not specified VAULT = 1 Species: Not specified VAULT: 1'
|
93
99
|
}
|
data/bats/import.bats
CHANGED
@@ -8,3 +8,9 @@ load 'test_helper'
|
|
8
8
|
--list-blocks-message indent --list-blocks \
|
9
9
|
' '
|
10
10
|
}
|
11
|
+
|
12
|
+
@test 'Directives - import, missing' {
|
13
|
+
BATS_OUTPUT_FILTER=A
|
14
|
+
spec_mde_args_expect docs/dev/import-missing.md \
|
15
|
+
' Error: CachedNestedFileReader.readlines -- No such file or directory - this-is-missing.md @@ '
|
16
|
+
}
|
data/bats/markup.bats
CHANGED
@@ -5,27 +5,18 @@ load 'test_helper'
|
|
5
5
|
# Text Decoration
|
6
6
|
|
7
7
|
@test 'Options - list blocks - 1 plain' {
|
8
|
-
|
9
|
-
|
10
|
-
docs/dev/text-decoration.md \
|
11
|
-
--list-blocks-message oname \
|
12
|
-
--list-blocks-type 3 \
|
13
|
-
--list-blocks \
|
14
|
-
'- **_Bold-Underline_** - **Bold** - **~Bold-Italic~** - __Underline__ - _~Underline-Italic~_ - `Italic` - ~~Strikethrough~~'
|
8
|
+
spec_mde_xansi_oname_doc_blocks_expect docs/dev/text-decoration.md \
|
9
|
+
'- **_Bold-Underline_**_- **Bold**_- **~Bold-Italic~**_- __Underline___- _~Underline-Italic~__- `Italic`_- ~~Strikethrough~~'
|
15
10
|
}
|
16
11
|
|
17
12
|
@test 'Options - list blocks - 2 extracts markup' {
|
18
|
-
|
19
|
-
|
20
|
-
docs/dev/text-decoration.md \
|
21
|
-
--list-blocks-message dname \
|
22
|
-
--list-blocks-type 3 \
|
23
|
-
--list-blocks \
|
24
|
-
'- Bold-Underline - Bold - Bold-Italic - Underline - Underline-Italic - Italic - Strikethrough'
|
13
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/text-decoration.md \
|
14
|
+
'- Bold-Underline_- Bold_- Bold-Italic_- Underline_- Underline-Italic_- Italic_- Strikethrough'
|
25
15
|
}
|
26
16
|
|
27
17
|
@test 'Options - list blocks - 3 decorates' {
|
28
|
-
spec_mde_args_expect docs/dev/text-decoration.md
|
18
|
+
spec_mde_args_expect docs/dev/text-decoration.md \
|
19
|
+
--list-blocks-message dname --list-blocks-type 3 --list-blocks \
|
29
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'
|
30
21
|
}
|
31
22
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
load 'test_helper'
|
4
|
+
|
5
|
+
@test 'Options - Collapsible - Document options' {
|
6
|
+
spec_mde_xansi_oname_doc_blocks_expect docs/dev/options-collapse.md \
|
7
|
+
'H1.1_L1.1_H2.1_H1.2_H2.2_H1.3_H2.3_L2.3_h3.3_L3.3_D4.3_L4.3'
|
8
|
+
}
|
9
|
+
|
10
|
+
@test 'Options - Collapsible Heading - Expand' {
|
11
|
+
spec_mde_xansi_oname_doc_blocks_expect docs/dev/options-collapse.md \
|
12
|
+
H2.1 \
|
13
|
+
'H1.1_L1.1_H2.1_L2.1_h3.1_L3.1_D4.1_L4.1_H1.2_L1.2_H2.2_H1.3_H2.3_L2.3_h3.3_L3.3_D4.3_L4.3'
|
14
|
+
}
|
15
|
+
|
16
|
+
@test 'Options - Collapsible Divider' {
|
17
|
+
spec_mde_xansi_oname_doc_blocks_expect docs/dev/options-collapse.md \
|
18
|
+
D4.3 \
|
19
|
+
'H1.1_L1.1_H2.1_H1.2_H2.2_H1.3_H2.3_L2.3_h3.3_L3.3_D4.3'
|
20
|
+
}
|
21
|
+
|
22
|
+
@test 'Options - Reveal' {
|
23
|
+
spec_mde_xansi_oname_doc_blocks_expect docs/dev/options-collapse.md \
|
24
|
+
H2.2 h3.2 D4.2 \
|
25
|
+
'H1.1_L1.1_H2.1_H1.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'
|
26
|
+
}
|
data/bats/options.bats
CHANGED
@@ -91,7 +91,7 @@ load 'test_helper'
|
|
91
91
|
}
|
92
92
|
|
93
93
|
@test 'Options - version' {
|
94
|
-
version=$(grep VERSION "
|
94
|
+
version=$(grep VERSION "lib/markdown_exec/version.rb" | cut -d "'" -f 2)
|
95
95
|
spec_mde_args_expect --version \
|
96
96
|
"$version"
|
97
97
|
}
|
data/bats/table.bats
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
load 'test_helper'
|
4
|
+
|
5
|
+
@test 'Tables - indented' {
|
6
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/table-indent.md \
|
7
|
+
' DEMONSTRATE TABLE INDENTATION__Table flush at left._Centered columns._| Common Name | Species | Genus | Family | Year Discovered |_| -------------------- | ------------------------- | ------------ | ------------- | --------------- |_| Tapanuli Orangutan | Pongo tapanuliensis | Pongo | Hominidae | 2017 |_| Psychedelic Frogfish | Histiophryne psychedelica | Histiophryne | Antennariidae | 2009 |_| Ruby Seadragon | Phyllopteryx dewysea | Phyllopteryx | Syngnathidae | 2015 |__ Table indented with two spaces._ Left-justified columns._ | Common Name | Species | Genus | Family | Year Discovered |_ | -------------------------- | -------------- | ------- | --------------- | --------------- |_ | Illacme tobini (Millipede) | Illacme tobini | Illacme | Siphonorhinidae | 2016 |__ Table indented with one tab._ Right-justified columns._ | Common Name | Species | Genus | Family | Year Discovered |_ | --------------- | ------------------- | --------- | ---------- | --------------- |_ | Spiny Dandelion | Taraxacum japonicum | Taraxacum | Asteraceae | 2022 |'
|
8
|
+
}
|
data/bats/test_helper.bash
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# facilitate execution of program, comparison of output
|
2
2
|
|
3
|
-
export PROJECT_ROOT="/Users/fareed/Documents/dev/ruby/markdown_exec"
|
4
|
-
|
5
3
|
date_from_history_file_name () {
|
6
4
|
basename "$1" | sed -E 's/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/\1/'
|
7
5
|
}
|
@@ -10,6 +8,41 @@ echo_hexdump () {
|
|
10
8
|
echo -en "$1" | hexdump -C
|
11
9
|
}
|
12
10
|
|
11
|
+
echo_hexdump_expected_output_filter () {
|
12
|
+
local expected="$1"
|
13
|
+
local output="$2"
|
14
|
+
local filter="$3"
|
15
|
+
|
16
|
+
echo -e "- output_$(echo "$output" | wc -l)_$(echo -n "$output" | wc -c):\n$output"
|
17
|
+
if [[ $filter == A ]]; then
|
18
|
+
echo -e "- converted_$(echo "$output" | wc -l)_$(echo -n "$output" | wc -c):"
|
19
|
+
echo "$(remove_ansi_escape_sequences "$output")"
|
20
|
+
fi
|
21
|
+
echo -e "- expected_$(echo "$expected" | wc -l)_$(echo -n "$expected" | wc -c):\n$expected"
|
22
|
+
|
23
|
+
if [[ $filter == A ]]; then
|
24
|
+
echo "- output"
|
25
|
+
echo_hexdump "$output"
|
26
|
+
echo "- converted"
|
27
|
+
echo_hexdump "$(remove_ansi_escape_sequences "$output")"
|
28
|
+
echo "- expected"
|
29
|
+
echo_hexdump "$expected"
|
30
|
+
fi
|
31
|
+
}
|
32
|
+
|
33
|
+
echo_xansi_command_expected_output_filter () {
|
34
|
+
local command="$1"
|
35
|
+
local expected="$2"
|
36
|
+
local output="$3"
|
37
|
+
local filter="$4"
|
38
|
+
|
39
|
+
echo -e "- command: $command"
|
40
|
+
echo -e "- expected:\n$expected"
|
41
|
+
echo_hexdump "$expected"
|
42
|
+
echo -e "- output:\n$(text_filter_ansi "$output" "$filter")"
|
43
|
+
echo_hexdump "$output"
|
44
|
+
}
|
45
|
+
|
13
46
|
exec_mde () {
|
14
47
|
echo "bin/bmde "$1" "${@:2}""
|
15
48
|
run bin/bmde "$1" ${@:2}
|
@@ -30,6 +63,21 @@ expect_equal_with_conversion () {
|
|
30
63
|
[[ "$expected" == "$actual" ]]
|
31
64
|
}
|
32
65
|
|
66
|
+
hex_dump () {
|
67
|
+
local separator=" --- "
|
68
|
+
local output=""
|
69
|
+
|
70
|
+
echo -en "$@" >&2
|
71
|
+
for arg in "$@"; do
|
72
|
+
output+="${arg}${separator}"
|
73
|
+
done
|
74
|
+
|
75
|
+
output="${output%$separator}" # Remove the trailing separator
|
76
|
+
echo "output: $output"
|
77
|
+
echo ":"
|
78
|
+
echo -en "$output" | hexdump -C >&2
|
79
|
+
}
|
80
|
+
|
33
81
|
most_recent_history_file_name () {
|
34
82
|
ls -f logs/*examples_save_md* | tail -n 1
|
35
83
|
}
|
@@ -73,11 +121,7 @@ run_mde_specs_md_args_expect_xansi () {
|
|
73
121
|
|
74
122
|
filter="${BATS_OUTPUT_FILTER:-A}"
|
75
123
|
if ( ! expect_equal_with_conversion "$expected" "$output" "$filter" ); then
|
76
|
-
|
77
|
-
echo -e "- expected:\n$expected"
|
78
|
-
echo_hexdump "$expected"
|
79
|
-
echo -e "- output:\n$(text_filter_ansi "$output" "$filter")"
|
80
|
-
echo_hexdump "$output"
|
124
|
+
echo_xansi_command_expected_output_filter "${@:1:$#-1}" "$expected" "$output" "$filter"
|
81
125
|
fi
|
82
126
|
|
83
127
|
expect_equal_with_conversion "$expected" "$output" "$filter"
|
@@ -123,38 +167,6 @@ spec_mde_args_expect () {
|
|
123
167
|
"${args[@]: -1}"
|
124
168
|
}
|
125
169
|
|
126
|
-
hex_dump () {
|
127
|
-
local separator=" --- "
|
128
|
-
local output=""
|
129
|
-
|
130
|
-
echo -en "$@" >&2
|
131
|
-
for arg in "$@"; do
|
132
|
-
output+="${arg}${separator}"
|
133
|
-
done
|
134
|
-
|
135
|
-
output="${output%$separator}" # Remove the trailing separator
|
136
|
-
echo "output: $output"
|
137
|
-
echo ":"
|
138
|
-
echo -en "$output" | hexdump -C >&2
|
139
|
-
}
|
140
|
-
|
141
|
-
spec_mde_args_grep_filter_expect_ok () {
|
142
|
-
# Capturing arguments
|
143
|
-
local remaining=("${@:1:$(($#-3))}")
|
144
|
-
local pattern="${@: -3:1}"
|
145
|
-
local filter="${@: -2:1}"
|
146
|
-
local expected="${@: -1}"
|
147
|
-
local STATUS="${BATS_STATUS:-0}"
|
148
|
-
local EXE="${BATS_EXE:-silence_ww bin/bmde}"
|
149
|
-
|
150
|
-
# Print the command being run for debugging
|
151
|
-
echo >&2 $EXE "${remaining[@]}"
|
152
|
-
|
153
|
-
# Pass the exact arguments including empty and space-containing ones
|
154
|
-
run $EXE "${remaining[@]}"
|
155
|
-
}
|
156
|
-
|
157
|
-
|
158
170
|
spec_mde_args_grep_filter_expect () {
|
159
171
|
# Capturing arguments
|
160
172
|
local remaining=("${@:1:$(($#-3))}")
|
@@ -190,22 +202,35 @@ spec_mde_args_grep_filter_expect () {
|
|
190
202
|
fi
|
191
203
|
|
192
204
|
if ( ! expect_equal_with_conversion "$expected" "$output" "$filter"); then
|
193
|
-
|
194
|
-
[[ $filter == A ]] && echo_hexdump "$output"
|
195
|
-
|
196
|
-
if [[ $filter == A ]]; then
|
197
|
-
echo -e "- converted_$(echo "$output" | wc -l)_$(echo -n "$output" | wc -c):"
|
198
|
-
echo "$(remove_ansi_escape_sequences "$output")"
|
199
|
-
echo_hexdump "$(remove_ansi_escape_sequences "$output")"
|
200
|
-
fi
|
201
|
-
echo -e "- expected_$(echo "$expected" | wc -l)_$(echo -n "$expected" | wc -c):\n$expected"
|
202
|
-
[[ $filter == A ]] && echo_hexdump "$expected"
|
205
|
+
echo_hexdump_expected_output_filter "$expected" "$output" "$filter"
|
203
206
|
fi
|
204
207
|
expect_equal_with_conversion "$expected" "$output" "$filter"
|
205
208
|
[[ -n $status ]] && echo "- status: $status"
|
206
209
|
[[ -n $status ]]
|
207
210
|
}
|
208
211
|
|
212
|
+
spec_mde_xansi_dname_doc_blocks_expect () {
|
213
|
+
BATS_OUTPUT_FILTER=A
|
214
|
+
BATS_SAFE=_
|
215
|
+
spec_mde_args_expect "$1" \
|
216
|
+
"${@:2:$(($#-2))}" \
|
217
|
+
--list-blocks-message dname \
|
218
|
+
--list-blocks-type 3 \
|
219
|
+
--list-blocks \
|
220
|
+
"${!#}"
|
221
|
+
}
|
222
|
+
|
223
|
+
spec_mde_xansi_oname_doc_blocks_expect () {
|
224
|
+
BATS_OUTPUT_FILTER=A
|
225
|
+
BATS_SAFE=_
|
226
|
+
spec_mde_args_expect "$1" \
|
227
|
+
"${@:2:$(($#-2))}" \
|
228
|
+
--list-blocks-message oname \
|
229
|
+
--list-blocks-type 3 \
|
230
|
+
--list-blocks \
|
231
|
+
"${!#}"
|
232
|
+
}
|
233
|
+
|
209
234
|
text_filter_ansi () {
|
210
235
|
if [[ $# -eq 2 ]]; then
|
211
236
|
remove_ansi_escape_sequences "$1"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
load 'test_helper'
|
4
|
+
|
5
|
+
@test 'Variable expansion - default' {
|
6
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/variable-expansion.md \
|
7
|
+
' EVIDENCE_ SOURCE is: ${SOURCE}_SOURCE is: ${SOURCE}_SOURCE is: ${SOURCE}_| SOURCE |_| --------- |_| ${SOURCE} |_name_with_${SOURCE}_in_name_load: file_${SOURCE}.sh_ SOURCES'
|
8
|
+
}
|
9
|
+
|
10
|
+
@test 'Variable expansion - LINK_LOAD_SOURCE' {
|
11
|
+
echo "SOURCE='Loaded file'" > temp_variable_expansion.sh
|
12
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/variable-expansion.md \
|
13
|
+
'(LINK_LOAD_SOURCE)' \
|
14
|
+
' EVIDENCE_ SOURCE is: Loaded file_SOURCE is: Loaded file_SOURCE is: Loaded file_| SOURCE |_| ----------- |_| Loaded file |_name_with_${SOURCE}_in_name_load: file_Loaded file.sh_ SOURCES'
|
15
|
+
rm temp_variable_expansion.sh
|
16
|
+
}
|
17
|
+
|
18
|
+
@test 'Variable expansion - LINK_VARS_SOURCE' {
|
19
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/variable-expansion.md \
|
20
|
+
'(LINK_VARS_SOURCE)' \
|
21
|
+
' EVIDENCE_ SOURCE is: Link block_SOURCE is: Link block_SOURCE is: Link block_| SOURCE |_| ---------- |_| Link block |_name_with_${SOURCE}_in_name_load: file_Link block.sh_ SOURCES'
|
22
|
+
}
|
23
|
+
|
24
|
+
@test 'Variable expansion - VARS_SOURCE' {
|
25
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/variable-expansion.md \
|
26
|
+
'(VARS_SOURCE)' \
|
27
|
+
' EVIDENCE_ SOURCE is: Vars block_SOURCE is: Vars block_SOURCE is: Vars block_| SOURCE |_| ---------- |_| Vars block |_name_with_${SOURCE}_in_name_load: file_Vars block.sh_ SOURCES'
|
28
|
+
}
|
29
|
+
|
30
|
+
### Load source
|
31
|
+
|
32
|
+
@test 'Variable expansion - in block body' {
|
33
|
+
BATS_OUTPUT_FILTER=A
|
34
|
+
spec_mde_args_expect docs/dev/variable-expansion.md \(VARS_SOURCE\) \
|
35
|
+
--list-blocks --list-blocks-type 3 \
|
36
|
+
--list-blocks-eval "block.body&.first&.start_with?(\"load: \") ? block.body : nil" \
|
37
|
+
'load: file_Vars block.sh'
|
38
|
+
}
|
39
|
+
|
40
|
+
@test 'Variable expansion - in block dname' {
|
41
|
+
BATS_OUTPUT_FILTER=A
|
42
|
+
spec_mde_args_expect docs/dev/variable-expansion.md \(VARS_SOURCE\) \
|
43
|
+
--list-blocks --list-blocks-type 3 \
|
44
|
+
--list-blocks-eval "block.body&.first&.start_with?(\"load: \") ? block.dname : nil" \
|
45
|
+
'load: file_Vars block.sh'
|
46
|
+
}
|
data/bin/tab_completion.sh
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
```opts :(
|
1
|
+
```opts :(document_opts)
|
2
|
+
divider4_center: false
|
3
|
+
|
2
4
|
dump_blocks_in_file: false # Dump BlocksInFile (stage 1)
|
3
5
|
dump_delegate_object: false # Dump @delegate_object
|
4
6
|
dump_inherited_lines: false # Dump inherited lines
|
@@ -7,6 +9,11 @@ dump_selected_block: false # Dump selected block
|
|
7
9
|
|
8
10
|
execute_in_own_window: false
|
9
11
|
|
12
|
+
menu_divider_format:
|
13
|
+
menu_with_back: false
|
14
|
+
menu_with_exit: false
|
15
|
+
menu_with_shell: false
|
16
|
+
|
10
17
|
output_execution_report: false
|
11
18
|
output_execution_summary: false
|
12
19
|
|
data/docs/dev/block-type-bash.md
CHANGED
data/docs/dev/block-type-opts.md
CHANGED
@@ -3,13 +3,9 @@ Species
|
|
3
3
|
menu_note_format: "AFTER %{line}"
|
4
4
|
```
|
5
5
|
@import bats-document-configuration.md
|
6
|
-
```opts :(
|
7
|
-
menu_divider_format:
|
6
|
+
```opts :(document_opts)
|
8
7
|
menu_final_divider:
|
9
8
|
menu_for_saved_lines: false
|
10
9
|
menu_initial_divider:
|
11
10
|
menu_note_format: "BEFORE %{line}"
|
12
|
-
menu_with_back: false
|
13
|
-
menu_with_exit: false
|
14
|
-
menu_with_shell: false
|
15
11
|
```
|
data/docs/dev/block-type-vars.md
CHANGED
data/docs/dev/menu-cli.md
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
/ All are collapsible
|
2
|
+
/ Only H2 is collapsed by default
|
3
|
+
# H1.1
|
4
|
+
L1.1
|
5
|
+
## H2.1
|
6
|
+
L2.1
|
7
|
+
### H3.1
|
8
|
+
L3.1
|
9
|
+
::: D4.1
|
10
|
+
L4.1
|
11
|
+
/ Collapse all
|
12
|
+
#+ H1.2
|
13
|
+
L1.2
|
14
|
+
##+ H2.2
|
15
|
+
L2.2
|
16
|
+
###+ H3.2
|
17
|
+
L3.2
|
18
|
+
:::+ D4.2
|
19
|
+
L4.2
|
20
|
+
/ Expand all
|
21
|
+
#- H1.3
|
22
|
+
L1.3
|
23
|
+
##- H2.3
|
24
|
+
L2.3
|
25
|
+
###- H3.3
|
26
|
+
L3.3
|
27
|
+
:::- D4.3
|
28
|
+
L4.3
|
29
|
+
@import bats-document-configuration.md
|
30
|
+
```opts :(document_opts)
|
31
|
+
divider4_center: false
|
32
|
+
divider4_collapse: false
|
33
|
+
divider4_collapsible: true
|
34
|
+
heading1_center: false
|
35
|
+
heading1_collapse: false
|
36
|
+
heading1_collapsible: false
|
37
|
+
heading2_center: false
|
38
|
+
heading2_collapse: true
|
39
|
+
heading2_collapsible: true
|
40
|
+
heading3_center: false
|
41
|
+
heading3_collapse: false
|
42
|
+
heading3_collapsible: true
|
43
|
+
|
44
|
+
heading1_match: "^#(?<line>(?!#)(?<collapse>[+-~]?)(?<indent>[ \t]*)(?<text>.*?)(?<trailing>[ \t]*))?$"
|
45
|
+
menu_collapsible_symbol_collapsed: '(+)'
|
46
|
+
menu_collapsible_symbol_expanded: '(-)'
|
47
|
+
```
|
data/docs/dev/specs.md
CHANGED
@@ -77,7 +77,8 @@ dump_menu_blocks: false
|
|
77
77
|
```
|
78
78
|
|
79
79
|
@import bats-document-configuration.md
|
80
|
-
```opts :(
|
80
|
+
```opts :(document_opts) +(disable_dump_*)
|
81
81
|
menu_note_color: 'plain'
|
82
|
+
menu_with_exit: true
|
82
83
|
menu_with_inherited_lines: false
|
83
84
|
```
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/ The lines below are an invalid table
|
2
|
+
| Region| VPC ID| VPC Name
|
3
|
+
-
|
4
|
+
# Demonstrate Tables
|
5
|
+
|
6
|
+
Table flush at left.
|
7
|
+
Centered columns.
|
8
|
+
| Common Name| Species| Genus| Family| Year Discovered
|
9
|
+
|:-:|:-:|:-:|:-:|:-:
|
10
|
+
| Tapanuli Orangutan| Pongo tapanuliensis| Pongo| Hominidae| 2017
|
11
|
+
| Psychedelic Frogfish| Histiophryne psychedelica| Histiophryne| Antennariidae| 2009
|
12
|
+
| Ruby Seadragon| Phyllopteryx dewysea| Phyllopteryx| Syngnathidae| 2015
|
13
|
+
|
14
|
+
Table indented with two spaces.
|
15
|
+
Left-justified columns.
|
16
|
+
| Common Name| Species| Genus| Family| Year Discovered
|
17
|
+
|:-|:-|:-|:-|:-
|
18
|
+
| Illacme tobini (Millipede)| Illacme tobini| Illacme| Siphonorhinidae| 2016
|
19
|
+
| Cappuccino Snake| Hydrodynastes bicinctus| Hydrodynastes| Colubridae| 2021
|
20
|
+
| Homo luzonensis| Homo luzonensis| Homo| Hominidae| 2019
|
21
|
+
|
22
|
+
Table indented with one tab.
|
23
|
+
Right-justified columns.
|
24
|
+
| Common Name| Species| Genus| Family| Year Discovered
|
25
|
+
|-:|-:|-:|-:|-:
|
26
|
+
| Spiny Dandelion| Taraxacum japonicum| Taraxacum| Asteraceae| 2022
|
27
|
+
| Mythical Monkey| Cercopithecus lomamiensis| Cercopithecus| Cercopithecidae| 2012
|
28
|
+
| Yeti Crab| Kiwa hirsuta| Kiwa| Kiwaidae| 2005
|
29
|
+
|
30
|
+
## Non-table text is not modified
|
31
|
+
1. |
|
32
|
+
2. ||
|
33
|
+
|
|
34
|
+
||
|
35
|
+
|
36
|
+
## markup with table
|
37
|
+
| Common Name| Species| Genus| Family| Year Discovered
|
38
|
+
|:-:|:-:|:-:|:-:|:-:
|
39
|
+
| `Tapanuli Orangutan`| **Pongo tapanuliensis**| __Pongo__| Hominidae| 2017
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Demonstrate Table Indentation
|
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
|
+
|
17
|
+
Table indented with one tab.
|
18
|
+
Right-justified columns.
|
19
|
+
| Common Name| Species| Genus| Family| Year Discovered
|
20
|
+
|-:|-:|-:|-:|-:
|
21
|
+
| Spiny Dandelion| Taraxacum japonicum| Taraxacum| Asteraceae| 2022
|
22
|
+
@import bats-document-configuration.md
|
23
|
+
```opts :(document_opts)
|
24
|
+
heading1_center: false
|
25
|
+
table_center: false
|
26
|
+
```
|
data/docs/dev/text-decoration.md
CHANGED
@@ -5,11 +5,8 @@
|
|
5
5
|
- _~Underline-Italic~_
|
6
6
|
- `Italic`
|
7
7
|
- ~~Strikethrough~~
|
8
|
-
|
9
|
-
|
8
|
+
@import bats-document-configuration.md
|
9
|
+
```opts :(document_opts)
|
10
10
|
menu_for_saved_lines: false
|
11
11
|
menu_initial_divider:
|
12
|
-
menu_with_back: false
|
13
|
-
menu_with_exit: false
|
14
|
-
menu_with_shell: false
|
15
12
|
```
|
@@ -24,7 +24,7 @@ vars:
|
|
24
24
|
SOURCE: Vars block
|
25
25
|
```
|
26
26
|
@import bats-document-configuration.md
|
27
|
-
```opts :(
|
27
|
+
```opts :(document_opts)
|
28
28
|
heading1_center: false
|
29
29
|
heading2_center: false
|
30
30
|
heading3_center: false
|
@@ -32,7 +32,5 @@ menu_final_divider:
|
|
32
32
|
menu_for_saved_lines: false
|
33
33
|
menu_initial_divider:
|
34
34
|
menu_vars_set_format:
|
35
|
-
|
36
|
-
menu_with_exit: false
|
37
|
-
menu_with_shell: false
|
35
|
+
table_center: false
|
38
36
|
```
|