examples/linked.md in markdown_exec-1.8.8 vs examples/linked.md in markdown_exec-1.8.9
- old
+ new
@@ -1,71 +1,101 @@
-Demonstrate setting a variable interactively for use in generated scripts.
+Demonstrate setting variable values interactively for use in generated scripts.
```opts :(document_options)
pause_after_script_execution: false
user_must_approve: false
```
-::: Set VARIABLE to "A"
-
-```link :set_to_A +(set_to_A)
-block: display_variable
+::: Set variable ALPHA in a Vars block
+For each environment variable named in block,
+ append an inherited line that assigns the variable the specified value.
+```vars :set_ALPHA_to_1_via_vars_block
+ALPHA: 1
```
-```bash :(set_to_A)
-VARIABLE=A
+::: Set variable ALPHA in a Link block
+For each environment variable in `vars`,
+ append an inherited line that assigns the variable the specified value.
+Subsequently, run the `display_variable_ALPHA` block.
+```link :set_ALPHA_to_2_via_link_block_and_display
+block: display_variable_ALPHA
+vars:
+ ALPHA: 2
```
-```link :set_to_A_eval +(set_to_A_eval)
-block: display_variable
-eval: true
+Make the code in the required block `(bash_set_to_3)` into inherited lines.
+Subsequently, run the `display_variable_ALPHA` block.
+```bash :(bash_set_to_3)
+ALPHA=3
```
-
-```bash :(set_to_A_eval)
-echo VARIABLE=A
+```link :set_ALPHA_to_3_via_required_block_and_display +(bash_set_to_3)
+block: display_variable_ALPHA
```
-::: Set VARIABLE to "B"
-
-```link :set_to_B +(set_to_B)
-block: display_variable
-```
-
-```bash :(set_to_B)
-VARIABLE=B
-```
-
-```link :set_to_B_eval +(set_to_B_eval)
-block: display_variable
+Evaluate the code in the required block `(bash_eval_set_to_4)` and
+ save (transformed) output into inherited lines.
+Subsequently, run the `display_variable_ALPHA` block.
+```link :set_ALPHA_to_4_via_evaluated_required_block_and_display +(bash_eval_set_to_4)
eval: true
+next_block: display_variable_ALPHA
```
-
-```bash :(set_to_B_eval)
-echo VARIABLE=B
+```bash :(bash_eval_set_to_4)
+echo 'ALPHA="4"'
```
-::: Display value of VARIABLE
-
-```bash :display_variable
+::: Display value of ALPHA
+```bash :display_variable_ALPHA
source bin/colorize_env_vars.sh
-echo The current value of environment variable VARIABLE is now:
-colorize_env_vars '' VARIABLE
+echo The current value of environment variable ALPHA is now:
+colorize_env_vars '' ALPHA
```
-```bash :(set_timestamp)
-echo 'yyyymmdd? (default: today UTC) '; read -r yyyymmdd; [[ -z $yyyymmdd ]] && yyyymmdd="$(date -u +%y%m%d)"
-echo "EC2_STACK_TS='$yyyymmdd'"
-```
-```link :request_input_and_inherit_output +(set_timestamp)
-exec: true
-```
-
::: Load file into inherited lines
Load (do not evaluate) and append to inherited lines.
```link :load1
load: examples/load1.sh
```
Load, evaluate, and append output to inherited lines.
```link :load2_eval
load: examples/load2.sh
eval: true
+```
+
+::: Save and Load
+Save inherited lines to a file.
+```link :save1
+save: tmp/save1.sh
+```
+Load inherited lines from a file.
+Subsequently, run the `display_variables` block.
+```link :load_saved
+load: tmp/save1.sh
+block: display_variables
+```
+Display variables ALPHA, var1, var2
+```bash :display_variables
+source bin/colorize_env_vars.sh
+colorize_env_vars '' ALPHA var1 var2
+```
+
+Execute a script requiring input from the user.
+Save the output setting TIMESTAMP into inherited lines.
+Subsequently, run the `display_TIMESTAMP` block.
+```bash :(input_timestamp)
+if [[ -z $TIMESTAMP ]]; then
+ default="$(date -u +%y%m%d)"
+ echo "yymmdd? (default: $default / today UTC) "
+ read -r TIMESTAMP
+ [[ -z $TIMESTAMP ]] && TIMESTAMP="$(date -u +%y%m%d)"
+fi
+```
+```bash :(inherit_timestamp)
+echo "TIMESTAMP=\"$TIMESTAMP\""
+```
+```link :set_timestamp +(input_timestamp) +(inherit_timestamp)
+exec: true
+block: display_TIMESTAMP
+```
+```bash :display_TIMESTAMP
+source bin/colorize_env_vars.sh
+colorize_env_vars '' TIMESTAMP
```