markdown_exec 3.4.0 → 3.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +8 -1
- data/README.md +262 -116
- data/bats/block-type-shell-require-ux.bats +15 -0
- data/bats/block-type-ux-require-context.bats +14 -0
- data/bats/import-directive-line-continuation.bats +1 -1
- data/bats/import-directive-parameter-symbols.bats +1 -1
- data/bats/import-parameter-symbols.bats +1 -1
- data/bats/options.bats +2 -2
- data/demo/trap.demo1.gif +0 -0
- data/demo/trap.demo1.mp4 +0 -0
- data/docs/dev/block-type-shell-require-ux.md +18 -0
- data/docs/dev/block-type-ux-format.md +10 -0
- data/docs/dev/block-type-ux-require-context.md +32 -0
- data/docs/dev/block-type-ux-require.md +8 -4
- data/docs/dev/import-directive-line-continuation.md +0 -1
- data/docs/dev/import-directive-parameter-symbols.md +0 -2
- data/docs/dev/import-parameter-symbols-template.md +7 -5
- data/docs/dev/import-parameter-symbols.md +10 -2
- data/examples/colors.md +31 -29
- data/lib/cached_nested_file_reader.rb +15 -47
- data/lib/command_result.rb +5 -5
- data/lib/constants.rb +3 -1
- data/lib/fcb.rb +7 -1
- data/lib/hash_delegator.rb +76 -32
- data/lib/link_history.rb +1 -1
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/menu.src.yml +18 -8
- data/lib/menu.yml +14 -5
- data/lib/parameter_expansion.rb +918 -0
- data/lib/parse_animation_to_tts.rb +4417 -0
- data/lib/resize_terminal.rb +19 -16
- metadata +11 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a4c6bcbb464222e907cb93cc549ef294d45b83f0f8be5e88e603b87c64eb7a4
|
|
4
|
+
data.tar.gz: dfce2b71eb6c954e3d438b6036b6543da7bcfe63178ca56971ddb198f49852db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7b2076de902483e3f2362b8319d99f1876c7f41e7ffd1815e92278803d55776f700df721dc16700064c890c7c48628657ef2bf4003ba989b7c6eee1c27a9088
|
|
7
|
+
data.tar.gz: ed8705a9687dc56cbef235fe0821065653852d5b1e1c05293a9ea53baf08a7a12c24fdc5e909e9dd04047378d664ddb0b8e7d644e38d54c753ef1a470138ce60
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.5.0] - 2025-11-13
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- MP4 with demonstration of Bash "trap" command.
|
|
8
|
+
- Type casting for tokens in imported documents.
|
|
9
|
+
- Default color for fenced code blocks per type.
|
|
10
|
+
- Shell blocks can require UX blocks.
|
|
11
|
+
- Common markdown patterns for text decorations.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- README.md
|
|
16
|
+
|
|
3
17
|
## [3.4.0] - 2025-09-16
|
|
4
18
|
|
|
5
19
|
### Added
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
markdown_exec (3.
|
|
4
|
+
markdown_exec (3.5.0)
|
|
5
5
|
clipboard (~> 1.3.6)
|
|
6
6
|
open3 (~> 0.1.1)
|
|
7
7
|
optparse (~> 0.1.1)
|
|
@@ -37,6 +37,7 @@ GEM
|
|
|
37
37
|
minitest (>= 5.1)
|
|
38
38
|
mutex_m
|
|
39
39
|
tzinfo (~> 2.0)
|
|
40
|
+
ansi (1.5.0)
|
|
40
41
|
ast (2.4.2)
|
|
41
42
|
base64 (0.2.0)
|
|
42
43
|
bigdecimal (3.1.8)
|
|
@@ -98,6 +99,11 @@ GEM
|
|
|
98
99
|
nokogiri (>= 1.12.0)
|
|
99
100
|
method_source (1.1.0)
|
|
100
101
|
minitest (5.24.1)
|
|
102
|
+
minitest-reporters (1.7.1)
|
|
103
|
+
ansi
|
|
104
|
+
builder
|
|
105
|
+
minitest (>= 5.0)
|
|
106
|
+
ruby-progressbar
|
|
101
107
|
mocha (2.4.5)
|
|
102
108
|
ruby2_keywords (>= 0.0.5)
|
|
103
109
|
mutex_m (0.2.0)
|
|
@@ -227,6 +233,7 @@ DEPENDENCIES
|
|
|
227
233
|
irb
|
|
228
234
|
markdown_exec!
|
|
229
235
|
minitest
|
|
236
|
+
minitest-reporters
|
|
230
237
|
mocha
|
|
231
238
|
pry-nav
|
|
232
239
|
pry-stack_explorer
|
data/README.md
CHANGED
|
@@ -1,150 +1,271 @@
|
|
|
1
1
|
# MarkdownExec
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
3
|
+
[](https://raw.githubusercontent.com/fareedst/markdown_exec/main/demo/trap.demo1.mp4)
|
|
4
|
+
|
|
5
|
+
*Click the GIF above to view the full video with audio (MP4)*
|
|
6
|
+
|
|
7
|
+
Transform static markdown into interactive, executable workflows. Build complex scripts with named blocks, interactive forms, cross-document navigation, and template systems.
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
### Interactive Code Execution
|
|
12
|
+
- **Named Blocks**: Create reusable code blocks with dependencies
|
|
13
|
+
- **Block Requirements**: Automatically include required blocks in execution order
|
|
14
|
+
- **Interactive Selection**: Choose blocks from intuitive menus
|
|
15
|
+
- **Script Approval**: Review generated scripts before execution
|
|
16
|
+
|
|
17
|
+
### UX Blocks - Interactive Forms
|
|
18
|
+
- **Variable Input**: Create interactive forms for user input
|
|
19
|
+
- **Validation**: Built-in regex validation with custom transforms
|
|
20
|
+
- **Dynamic Menus**: Selection from allowed values or command output
|
|
21
|
+
- **Auto-initialization**: Set values from environment, commands, or defaults
|
|
22
|
+
- **Dependencies**: Chain UX blocks with complex relationships
|
|
23
|
+
|
|
24
|
+
### Cross-Document Navigation
|
|
25
|
+
- **Link Blocks**: Navigate between markdown files seamlessly
|
|
26
|
+
- **Variable Passing**: Share data between documents
|
|
27
|
+
- **Inherited Context**: Maintain state across document boundaries
|
|
28
|
+
- **HyperCard-style Navigation**: Create interactive document stacks
|
|
29
|
+
|
|
30
|
+
### Template System & Imports
|
|
31
|
+
- **Import Directives**: Include content from other files with `@import`
|
|
32
|
+
- **Parameter Substitution**: Replace variables in imported content
|
|
33
|
+
- **Shell Expansions**: Use `${variable}` and `$(command)` syntax throughout documents
|
|
34
|
+
- **Dynamic Content**: Generate content based on user selections
|
|
35
|
+
|
|
36
|
+
### Advanced Block Types
|
|
37
|
+
- **Shell Blocks**: Execute bash shells
|
|
38
|
+
- **UX Blocks**: Interactive forms with validation, transforms, and dynamic behavior
|
|
39
|
+
- **Vars Blocks**: Define variables in YAML format
|
|
40
|
+
- **Opts Blocks**: Configure document behavior and appearance
|
|
41
|
+
- **Link Blocks**: Cross-document navigation and variable passing
|
|
42
|
+
|
|
43
|
+
### State Management
|
|
44
|
+
- **Script Persistence**: Save and replay executed scripts
|
|
45
|
+
- **Output Logging**: Capture and review execution results
|
|
46
|
+
- **State Inheritance**: Manage context across sessions
|
|
47
|
+
- **Configuration**: Flexible options via environment, files, or CLI
|
|
34
48
|
|
|
35
49
|
## Installation
|
|
36
50
|
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
```bash
|
|
52
|
+
gem install markdown_exec
|
|
53
|
+
```
|
|
39
54
|
|
|
40
|
-
##
|
|
55
|
+
## Quick Start
|
|
41
56
|
|
|
42
|
-
###
|
|
57
|
+
### Interactive Mode (Recommended)
|
|
58
|
+
```bash
|
|
59
|
+
mde # Process README.md in current folder
|
|
60
|
+
mde my-document.md # Process specific markdown file
|
|
61
|
+
mde . # Select from markdown files in current folder
|
|
62
|
+
```
|
|
43
63
|
|
|
44
|
-
|
|
64
|
+
### Command Line Mode
|
|
65
|
+
```bash
|
|
66
|
+
mde my-document.md my-block # Execute specific block directly
|
|
67
|
+
mde --list-blocks # List all available blocks
|
|
68
|
+
mde --list-docs # List all markdown documents
|
|
69
|
+
```
|
|
45
70
|
|
|
46
|
-
|
|
71
|
+
## Interactive Features
|
|
47
72
|
|
|
48
|
-
###
|
|
73
|
+
### UX Blocks - Interactive Forms
|
|
49
74
|
|
|
50
|
-
|
|
75
|
+
Create interactive forms that prompt users for input:
|
|
51
76
|
|
|
52
|
-
|
|
77
|
+
<pre><code>```ux
|
|
78
|
+
name: USER_NAME
|
|
79
|
+
prompt: Enter your name
|
|
80
|
+
init: Guest
|
|
81
|
+
```
|
|
82
|
+
</code></pre>
|
|
83
|
+
|
|
84
|
+
<pre><code>```ux
|
|
85
|
+
name: ENVIRONMENT
|
|
86
|
+
allow:
|
|
87
|
+
- development
|
|
88
|
+
- staging
|
|
89
|
+
- production
|
|
90
|
+
prompt: Select environment
|
|
91
|
+
```
|
|
92
|
+
</code></pre>
|
|
53
93
|
|
|
54
|
-
|
|
94
|
+
<pre><code>```ux
|
|
95
|
+
name: EMAIL
|
|
96
|
+
prompt: Enter email address
|
|
97
|
+
validate: '(?<local>[^@]+)@(?<domain>[^@]+)'
|
|
98
|
+
transform: '%{local}@%{domain}'
|
|
99
|
+
```
|
|
100
|
+
</code></pre>
|
|
55
101
|
|
|
56
|
-
|
|
102
|
+
### Cross-Document Navigation
|
|
57
103
|
|
|
58
|
-
|
|
104
|
+
Navigate between documents while maintaining context:
|
|
59
105
|
|
|
60
|
-
|
|
106
|
+
<pre><code>```link
|
|
107
|
+
file: next-document.md
|
|
108
|
+
vars:
|
|
109
|
+
current_user: ${USER_NAME}
|
|
110
|
+
environment: ${ENVIRONMENT}
|
|
111
|
+
```
|
|
112
|
+
</code></pre>
|
|
61
113
|
|
|
62
|
-
|
|
114
|
+
### Template System
|
|
63
115
|
|
|
64
|
-
|
|
116
|
+
Use imports with parameter substitution:
|
|
65
117
|
|
|
66
|
-
|
|
118
|
+
```
|
|
119
|
+
@import template.md USER_NAME=John ENVIRONMENT=production
|
|
120
|
+
```
|
|
121
|
+
</code></pre>
|
|
67
122
|
|
|
68
|
-
|
|
123
|
+
### Block Dependencies
|
|
69
124
|
|
|
70
|
-
|
|
125
|
+
Create complex workflows with automatic dependency resolution:
|
|
71
126
|
|
|
72
|
-
|
|
127
|
+
<pre><code>```bash :deploy +setup +test +deploy
|
|
128
|
+
echo "Deploying to ${ENVIRONMENT}"
|
|
129
|
+
```
|
|
130
|
+
</code></pre>
|
|
73
131
|
|
|
74
|
-
|
|
132
|
+
<pre><code>```bash :setup
|
|
133
|
+
echo "Setting up environment"
|
|
134
|
+
```
|
|
135
|
+
</code></pre>
|
|
75
136
|
|
|
76
|
-
|
|
137
|
+
<pre><code>```bash :test
|
|
138
|
+
echo "Running tests"
|
|
139
|
+
```
|
|
140
|
+
</code></pre>
|
|
77
141
|
|
|
78
|
-
|
|
142
|
+
## Advanced Usage
|
|
79
143
|
|
|
80
|
-
|
|
144
|
+
### Configuration
|
|
81
145
|
|
|
82
|
-
|
|
146
|
+
```
|
|
147
|
+
# Environment variables
|
|
148
|
+
export MDE_SAVE_EXECUTED_SCRIPT=1
|
|
149
|
+
export MDE_USER_MUST_APPROVE=1
|
|
83
150
|
|
|
84
|
-
|
|
151
|
+
# Configuration file (.mde.yml)
|
|
152
|
+
save_executed_script: true
|
|
153
|
+
user_must_approve: true
|
|
85
154
|
|
|
86
|
-
|
|
155
|
+
# Command line
|
|
156
|
+
mde --save-executed-script 1 --user-must-approve 1
|
|
157
|
+
```
|
|
87
158
|
|
|
88
|
-
|
|
159
|
+
### Script Management
|
|
89
160
|
|
|
90
|
-
|
|
161
|
+
```bash
|
|
162
|
+
mde --save-executed-script 1 # Save executed scripts
|
|
163
|
+
mde --list-recent-scripts # List saved scripts
|
|
164
|
+
mde --select-recent-script # Execute saved script
|
|
165
|
+
mde --save-execution-output 1 # Save execution output
|
|
166
|
+
```
|
|
91
167
|
|
|
92
|
-
|
|
168
|
+
## Block Types Reference
|
|
93
169
|
|
|
94
|
-
|
|
170
|
+
### Shell Blocks
|
|
171
|
+
<pre><code>```bash
|
|
172
|
+
echo "Hello World"
|
|
173
|
+
```
|
|
174
|
+
</code></pre>
|
|
95
175
|
|
|
96
|
-
|
|
176
|
+
### UX Blocks (Interactive Forms)
|
|
177
|
+
<pre><code>```ux
|
|
178
|
+
name: USER_NAME
|
|
179
|
+
prompt: Enter your name
|
|
180
|
+
init: Guest
|
|
181
|
+
```
|
|
182
|
+
</code></pre>
|
|
183
|
+
|
|
184
|
+
<pre><code>```ux
|
|
185
|
+
name: ENVIRONMENT
|
|
186
|
+
allow:
|
|
187
|
+
- development
|
|
188
|
+
- staging
|
|
189
|
+
- production
|
|
190
|
+
act: :allow
|
|
191
|
+
```
|
|
192
|
+
</code></pre>
|
|
97
193
|
|
|
98
|
-
|
|
194
|
+
<pre><code>```ux
|
|
195
|
+
name: CURRENT_DIR
|
|
196
|
+
exec: basename $(pwd)
|
|
197
|
+
transform: :chomp
|
|
198
|
+
```
|
|
199
|
+
</code></pre>
|
|
99
200
|
|
|
100
|
-
|
|
201
|
+
<pre><code>```ux
|
|
202
|
+
name: EMAIL
|
|
203
|
+
prompt: Enter email address
|
|
204
|
+
validate: '(?<local>[^@]+)@(?<domain>[^@]+)'
|
|
205
|
+
transform: '%{local}@%{domain}'
|
|
206
|
+
```
|
|
207
|
+
</code></pre>
|
|
101
208
|
|
|
102
|
-
|
|
209
|
+
### Variable Blocks
|
|
210
|
+
<pre><code>```vars
|
|
211
|
+
DATABASE_URL: postgresql://localhost:5432/myapp
|
|
212
|
+
DEBUG: true
|
|
213
|
+
```
|
|
214
|
+
</code></pre>
|
|
103
215
|
|
|
104
|
-
|
|
216
|
+
### Link Blocks (Cross-Document Navigation)
|
|
217
|
+
<pre><code>```link
|
|
218
|
+
file: next-page.md
|
|
219
|
+
vars:
|
|
220
|
+
current_user: ${USER_NAME}
|
|
221
|
+
```
|
|
222
|
+
</code></pre>
|
|
223
|
+
|
|
224
|
+
### Data Blocks (YAML)
|
|
225
|
+
<pre><code>```yaml
|
|
226
|
+
users:
|
|
227
|
+
- name: John
|
|
228
|
+
role: admin
|
|
229
|
+
- name: Jane
|
|
230
|
+
role: user
|
|
231
|
+
```
|
|
232
|
+
</code></pre>
|
|
105
233
|
|
|
106
|
-
|
|
234
|
+
### Import Directives
|
|
235
|
+
```
|
|
236
|
+
@import template.md USER_NAME=John ENVIRONMENT=production
|
|
237
|
+
```
|
|
107
238
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
239
|
+
### Options Blocks
|
|
240
|
+
<pre><code>```opts :(document_opts)
|
|
241
|
+
user_must_approve: true
|
|
242
|
+
save_executed_script: true
|
|
243
|
+
menu_ux_row_format: 'DEFAULT %{name} = ${%{name}}'
|
|
244
|
+
```
|
|
245
|
+
</code></pre>
|
|
111
246
|
|
|
112
247
|
## Configuration
|
|
113
248
|
|
|
114
249
|
### Environment Variables
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
250
|
+
<pre><code>```bash
|
|
251
|
+
export MDE_SAVE_EXECUTED_SCRIPT=1
|
|
252
|
+
export MDE_USER_MUST_APPROVE=1
|
|
253
|
+
```
|
|
254
|
+
</code></pre>
|
|
119
255
|
|
|
120
256
|
### Configuration Files
|
|
257
|
+
<pre><code>```yaml
|
|
258
|
+
# .mde.yml
|
|
259
|
+
save_executed_script: true
|
|
260
|
+
user_must_approve: true
|
|
261
|
+
menu_with_inherited_lines: true
|
|
262
|
+
```
|
|
263
|
+
</code></pre>
|
|
121
264
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
### Program Arguments
|
|
127
|
-
|
|
128
|
-
* Configuration in command options, e.g. `mde --save-executed-script 1`
|
|
129
|
-
|
|
130
|
-
## Representing boolean values
|
|
131
|
-
|
|
132
|
-
Boolean values expressed as strings are interpreted as:
|
|
133
|
-
| String | Boolean |
|
|
134
|
-
| :---: | :---: |
|
|
135
|
-
| *empty string* | False |
|
|
136
|
-
| `0` | False |
|
|
137
|
-
| `1` | True |
|
|
138
|
-
| *anything else* | True |
|
|
139
|
-
|
|
140
|
-
E.g. `opt1=1` will set option `opt1` to True.
|
|
141
|
-
|
|
142
|
-
Boolean options configured with environment variables:
|
|
143
|
-
- Set to `1` or non-empty value to save executed scripts; empty or `0` to disable saving.
|
|
144
|
-
e.g. `export MDE_SAVE_EXECUTED_SCRIPT=1`
|
|
145
|
-
e.g. `export MDE_SAVE_EXECUTED_SCRIPT=`
|
|
146
|
-
- Specify variable on command line.
|
|
147
|
-
e.g. `MDE_SAVE_EXECUTED_SCRIPT=1 mde`
|
|
265
|
+
### Command Line Options
|
|
266
|
+
```bash
|
|
267
|
+
mde --save-executed-script 1 --user-must-approve 1 --config my-config.yml
|
|
268
|
+
```
|
|
148
269
|
|
|
149
270
|
## Tab Completion
|
|
150
271
|
|
|
@@ -152,7 +273,7 @@ Boolean options configured with environment variables:
|
|
|
152
273
|
|
|
153
274
|
Append a command to load the completion script to your shell configuration file. `mde` must be executable for the command to be composed correctly.
|
|
154
275
|
|
|
155
|
-
```bash
|
|
276
|
+
```bash
|
|
156
277
|
echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
|
|
157
278
|
```
|
|
158
279
|
|
|
@@ -179,29 +300,54 @@ In the table below, tab is indicated by `!`
|
|
|
179
300
|
| `mde --user-must-approve !` | `mde --user-must-approve .BOOL.`|
|
|
180
301
|
| `mde --user-must-approve .BOOL.!` | `mde --user-must-approve 1` |
|
|
181
302
|
|
|
182
|
-
## Example
|
|
303
|
+
## Example: Interactive Workflow
|
|
183
304
|
|
|
184
|
-
|
|
305
|
+
This example demonstrates a complete interactive workflow with UX blocks, dependencies, and cross-document navigation:
|
|
185
306
|
|
|
186
|
-
|
|
187
|
-
|
|
307
|
+
### Step 1: User Input
|
|
308
|
+
<pre><code>```ux :user-setup
|
|
309
|
+
name: USER_NAME
|
|
310
|
+
prompt: Enter your name
|
|
311
|
+
init: Guest
|
|
188
312
|
```
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
313
|
+
</code></pre>
|
|
314
|
+
|
|
315
|
+
<pre><code>```ux :environment
|
|
316
|
+
name: ENVIRONMENT
|
|
317
|
+
allow:
|
|
318
|
+
- development
|
|
319
|
+
- staging
|
|
320
|
+
- production
|
|
321
|
+
prompt: Select environment
|
|
192
322
|
```
|
|
323
|
+
</code></pre>
|
|
193
324
|
|
|
194
|
-
|
|
195
|
-
|
|
325
|
+
### Step 2: Automated Setup
|
|
326
|
+
Prompts the user for both values and generates output.
|
|
327
|
+
<pre><code>```bash :setup +user-setup +environment
|
|
328
|
+
echo "Setting up for user: ${USER_NAME}"
|
|
329
|
+
echo "Environment: ${ENVIRONMENT}"
|
|
196
330
|
```
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
331
|
+
</code></pre>
|
|
332
|
+
|
|
333
|
+
### Step 3: Conditional Logic
|
|
334
|
+
<pre><code>```bash :deploy +setup
|
|
335
|
+
if [ "${ENVIRONMENT}" = "production" ]; then
|
|
336
|
+
echo "Deploying to production with extra safety checks"
|
|
337
|
+
else
|
|
338
|
+
echo "Deploying to ${ENVIRONMENT}"
|
|
339
|
+
fi
|
|
200
340
|
```
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
341
|
+
</code></pre>
|
|
342
|
+
|
|
343
|
+
### Step 4: Cross-Document Navigation
|
|
344
|
+
<pre><code>```link
|
|
345
|
+
file: next-workflow.md
|
|
346
|
+
vars:
|
|
347
|
+
user: ${USER_NAME}
|
|
348
|
+
env: ${ENVIRONMENT}
|
|
204
349
|
```
|
|
350
|
+
</code></pre>
|
|
205
351
|
|
|
206
352
|
# Testing
|
|
207
353
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
|
|
3
|
+
load 'test_helper'
|
|
4
|
+
|
|
5
|
+
@test 'initial' {
|
|
6
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-shell-require-ux.md \
|
|
7
|
+
'require-a-UX-block__FULL_NAME='
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@test 'activated' {
|
|
11
|
+
# 2025-11-13 add a '.' block to force the display to update
|
|
12
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-shell-require-ux.md \
|
|
13
|
+
require-a-UX-block . \
|
|
14
|
+
'__require-a-UX-block_Mythical_Monkey_FULL_NAME=Mythical Monkey'
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
|
|
3
|
+
load 'test_helper'
|
|
4
|
+
|
|
5
|
+
@test 'initial' {
|
|
6
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require-context.md \
|
|
7
|
+
'Get the common name..._Entity: _ENTITY2: _UX1: _Common name: '
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@test 'activated' {
|
|
11
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require-context.md \
|
|
12
|
+
\[ux1\] \
|
|
13
|
+
'Get the common name..._Entity: _ENTITY2: Mythical Monkey_UX1: Mythical Monkey_Common name: Mythical Monkey'
|
|
14
|
+
}
|
|
@@ -5,5 +5,5 @@ load 'test_helper'
|
|
|
5
5
|
@test '' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-directive-parameter-symbols.md \
|
|
7
7
|
--blocks dname \
|
|
8
|
-
'Stem: U1_Species: Illacme
|
|
8
|
+
'Stem: U1_Species: Illacme tobini_Stem: U2_Species: Hydrodynastes bicinctus'
|
|
9
9
|
}
|
|
@@ -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/import-parameter-symbols.md \
|
|
7
|
-
'COMMON_NAME=Tapanuli
|
|
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
|
}
|
data/bats/options.bats
CHANGED
|
@@ -30,13 +30,13 @@ load 'test_helper'
|
|
|
30
30
|
@test 'Options - list 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
|
-
'load_colors load_colors2
|
|
33
|
+
'load_colors load_colors2 Unspecified1 Unknown1 Bash1 Edit-inherited-blocks History1 Link1 Load1 Opts1 Port1 Save1 Vars1'
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@test 'Options - list blocks, eval' {
|
|
37
37
|
BATS_OUTPUT_FILTER=A
|
|
38
38
|
spec_mde_args_expect --list-blocks-eval block.oname examples/colors.md --list-blocks \
|
|
39
|
-
'load_colors load_colors2
|
|
39
|
+
'load_colors load_colors2 Unspecified1 Unknown1 Bash1 Edit-inherited-blocks History1 Link1 Load1 Opts1 Port1 Save1 Vars1'
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
@test 'Options - how' {
|
data/demo/trap.demo1.gif
ADDED
|
Binary file
|
data/demo/trap.demo1.mp4
ADDED
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/ No blocks are evaluated at initialization.
|
|
2
|
+
/ When the shell block is activated, the UX block is required.
|
|
3
|
+
```bash :require-a-UX-block +[ux1]
|
|
4
|
+
ENTITY='Mythical Monkey'
|
|
5
|
+
```
|
|
6
|
+
/ Display variables set in the UX block.
|
|
7
|
+
${FIRST}
|
|
8
|
+
${LAST}
|
|
9
|
+
/ Parse and copy the name into variables.
|
|
10
|
+
```ux :[ux1]
|
|
11
|
+
echo:
|
|
12
|
+
FIRST: '${ENTITY%% *}'
|
|
13
|
+
LAST: '${ENTITY##* }'
|
|
14
|
+
FULL_NAME: '$ENTITY'
|
|
15
|
+
init: false
|
|
16
|
+
readonly: true
|
|
17
|
+
```
|
|
18
|
+
@import bats-document-configuration.md
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/ Neither block is evaluated at initialization.
|
|
2
|
+
/ When the first UX block is activated, it is evaluated.
|
|
3
|
+
/ The variable set in the first UX block is available to the second,
|
|
4
|
+
/ which is required by the first, resulting in its evaluation.
|
|
5
|
+
```ux :[ux1] +[ux2] +(ENTITY)
|
|
6
|
+
act: :echo
|
|
7
|
+
echo:
|
|
8
|
+
UX1: '$ENTITY'
|
|
9
|
+
format: |-
|
|
10
|
+
Get the common name...
|
|
11
|
+
init: false
|
|
12
|
+
```
|
|
13
|
+
/ The shell required code and the first evaluated UX block are the context
|
|
14
|
+
/ when the the `echo` expressions are being evaluated in the second UX block.
|
|
15
|
+
/ The first evaluated UX block is the context when the `format` value is being expanded.
|
|
16
|
+
```ux :[ux2]
|
|
17
|
+
act: :echo
|
|
18
|
+
echo:
|
|
19
|
+
UX2: '$UX1'
|
|
20
|
+
ENTITY2: '$ENTITY'
|
|
21
|
+
format: |-
|
|
22
|
+
Entity: ${ENTITY}
|
|
23
|
+
ENTITY2: ${ENTITY2}
|
|
24
|
+
UX1: ${UX1}
|
|
25
|
+
Common name: ${UX2}
|
|
26
|
+
init: false
|
|
27
|
+
readonly: true
|
|
28
|
+
```
|
|
29
|
+
```bash :(ENTITY)
|
|
30
|
+
ENTITY='Mythical Monkey'
|
|
31
|
+
```
|
|
32
|
+
@import bats-document-configuration.md
|