markdown_exec 3.3.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 +27 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +8 -1
- data/README.md +262 -116
- data/Rakefile +2 -1
- data/bats/block-type-shell-require-ux.bats +15 -0
- data/bats/block-type-ux-auto.bats +1 -1
- data/bats/block-type-ux-default.bats +1 -1
- data/bats/block-type-ux-echo-hash.bats +2 -2
- data/bats/block-type-ux-exec-hash.bats +2 -2
- data/bats/block-type-ux-exec.bats +1 -1
- data/bats/block-type-ux-no-name.bats +8 -0
- data/bats/block-type-ux-require-context.bats +14 -0
- data/bats/block-type-ux-row-format.bats +1 -1
- data/bats/block-type-ux-transform.bats +1 -1
- data/bats/command-substitution-options.bats +2 -2
- data/bats/import-directive-line-continuation.bats +9 -0
- data/bats/import-directive-parameter-symbols.bats +1 -1
- data/bats/import-parameter-symbols.bats +1 -1
- data/bats/option-expansion.bats +1 -1
- data/bats/options.bats +2 -2
- data/bats/table-column-truncate.bats +1 -1
- data/bats/table.bats +1 -1
- data/bats/test_helper.bash +4 -3
- 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-no-name.md +17 -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/block-type-ux-row-format.md +1 -1
- data/docs/dev/import-directive-line-continuation.md +5 -0
- 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/docs/dev/table-column-truncate.md +1 -1
- data/examples/colors.md +31 -29
- data/lib/cached_nested_file_reader.rb +31 -51
- data/lib/command_result.rb +5 -5
- data/lib/constants.rb +3 -1
- data/lib/fcb.rb +22 -8
- data/lib/format_table.rb +22 -7
- data/lib/hash_delegator.rb +77 -33
- data/lib/link_history.rb +1 -1
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/menu.src.yml +47 -38
- data/lib/menu.yml +43 -34
- data/lib/parameter_expansion.rb +918 -0
- data/lib/parse_animation_to_tts.rb +4417 -0
- data/lib/resize_terminal.rb +19 -16
- data/lib/ww.rb +493 -15
- metadata +15 -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,32 @@
|
|
|
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
|
+
|
|
17
|
+
## [3.4.0] - 2025-09-16
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Accept line continuation for an import directive.
|
|
22
|
+
- Debug methods for block form and direct evaluation
|
|
23
|
+
- Color families indicate related functionality.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Size table columns to fit.
|
|
28
|
+
- Name key is not required for all UX blocks. Display the formatted string if specified. Display the last key in the echo or exec hash otherwise.
|
|
29
|
+
|
|
3
30
|
## [3.3.0] - 2025-09-02
|
|
4
31
|
|
|
5
32
|
### 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
|
|
data/Rakefile
CHANGED
|
@@ -146,7 +146,8 @@ task :minitest do
|
|
|
146
146
|
'./lib/saved_assets.rb --verbose',
|
|
147
147
|
'./lib/saved_files_matcher.rb --verbose',
|
|
148
148
|
'./lib/table_extractor.rb --verbose',
|
|
149
|
-
'./lib/text_analyzer.rb --verbose'
|
|
149
|
+
'./lib/text_analyzer.rb --verbose',
|
|
150
|
+
'./lib/ww.rb --verbose'
|
|
150
151
|
]
|
|
151
152
|
|
|
152
153
|
execute_with_error_handling(commands) do |command|
|
|
@@ -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
|
+
}
|
|
@@ -4,11 +4,11 @@ load 'test_helper'
|
|
|
4
4
|
|
|
5
5
|
@test 'an automatic block sets multiple variables' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo-hash.md \
|
|
7
|
-
'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ----- |_| Species |
|
|
7
|
+
'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ----- |_| Species | |_| Genus | |_| Family | |'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
@test 'an activated block sets multiple variables' {
|
|
11
11
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo-hash.md \
|
|
12
12
|
'Load Tapanuli Orangutan' \
|
|
13
|
-
'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value
|
|
13
|
+
'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ----------------------- |_| Species | Pongo tapanuliensis |_| Genus | Pongo |_| Family | Hominidae |'
|
|
14
14
|
}
|
|
@@ -4,12 +4,12 @@ load 'test_helper'
|
|
|
4
4
|
|
|
5
5
|
@test 'automatic' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec-hash.md \
|
|
7
|
-
'A single named variable is set automatically as the_output of the exec string._Common_Name=Yeti
|
|
7
|
+
'A single named variable is set automatically as the_output of the exec string._Common_Name=Yeti Crab__Common_Name=Yeti Crab_ Y e t i C r a b _ _ 59 65 74 69 20 43 72 61 62 0A__Multiple variables are set automatically as the_output of each exec string._One variable is temporary/not stored to inherited lines_but available for calculations within the block._Domain=ukaryota_____D=_Domain=ukaryota_ u k a r y o t a _ _ _ 75 6B 61 72 79 6F 74 61 0A 0A__A single named variable is set interactively as the_output of the exec string._Year_Discovered=_Year_Discovered=_$(hexdump_format "$Year_Discovered")__Multiple variables are set interactively as the_output of the exec string._Genus=_Species=_$(hexdump_format "$Species")_Genus=_$(hexdump_format "$Genus")__A single named variable is set automatically as the_first line of the output of the first element in the echo_hash._Kingdom=Animalia_Kingdom=Animalia_ A n i m a l i a_ 41 6E 69 6D 61 6C 69 61__A single named variable is set automatically as the_first line of the output of the first element in the exec_hash._Class=Malacostraca_Class=Malacostraca_ M a l a c o s t r a c a_ 4D 61 6C 61 63 6F 73 74 72 61 63 61'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
@test 'interactive' {
|
|
11
11
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec-hash.md \
|
|
12
12
|
'[Year_Discovered]' \
|
|
13
13
|
'[Genus]' \
|
|
14
|
-
'A single named variable is set automatically as the_output of the exec string._Common_Name=Yeti
|
|
14
|
+
'A single named variable is set automatically as the_output of the exec string._Common_Name=Yeti Crab__Common_Name=Yeti Crab_ Y e t i C r a b _ _ 59 65 74 69 20 43 72 61 62 0A__Multiple variables are set automatically as the_output of each exec string._One variable is temporary/not stored to inherited lines_but available for calculations within the block._Domain=ukaryota_____D=_Domain=ukaryota_ u k a r y o t a _ _ _ 75 6B 61 72 79 6F 74 61 0A 0A__A single named variable is set interactively as the_output of the exec string._Year_Discovered=2005__Year_Discovered=2005_ 2 0 0 5 _ _ 32 30 30 35 0A__Multiple variables are set interactively as the_output of the exec string._Genus=Kiwa___Species=Kiwa hirsuta_ K i w a h i r s u t a _ _ 4B 69 77 61 20 68 69 72 73 75 74 61 0A_Genus=Kiwa_ K i w a _ _ _ 4B 69 77 61 0A 0A__A single named variable is set automatically as the_first line of the output of the first element in the echo_hash._Kingdom=Animalia_Kingdom=Animalia_ A n i m a l i a_ 41 6E 69 6D 61 6C 69 61__A single named variable is set automatically as the_first line of the output of the first element in the exec_hash._Class=Malacostraca_Class=Malacostraca_ M a l a c o s t r a c a_ 4D 61 6C 61 63 6F 73 74 72 61 63 61'
|
|
15
15
|
}
|
|
@@ -4,5 +4,5 @@ load 'test_helper'
|
|
|
4
4
|
|
|
5
5
|
@test 'Output of executed commands as initial value' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec.md \
|
|
7
|
-
"ux0=_ux1=Unknown_ux2=
|
|
7
|
+
"ux0=_ux1=Unknown_ux2=markdown_exec__ux3=markdown_exec__ux4=Xform: 'markdown'"
|
|
8
8
|
}
|
|
@@ -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
|
+
}
|
|
@@ -4,5 +4,5 @@ load 'test_helper'
|
|
|
4
4
|
|
|
5
5
|
@test 'Row format merges with prior table' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-row-format.md \
|
|
7
|
-
" | Variable | Value | Prompt
|
|
7
|
+
" | Variable | Value | Prompt |_ | ----------- | --------------------- | ---------------------- |_ | Species | Pongo tapanuliensis | New species? |_ | Name: Genus | Value: Xform: 'Pongo' | Prompt: New genus? |_ | Family | Hominidae | Enter a value: |"
|
|
8
8
|
}
|