markdown_exec 3.0.8 → 3.1.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 +30 -0
- data/Gemfile.lock +1 -1
- data/bats/block-type-ux-required-variables.bats +0 -12
- data/bats/block-type-ux-sources.bats +0 -8
- data/bats/cli.bats +12 -0
- data/bats/import-with-text-substitution.bats +9 -0
- data/bats/load-vars-state-demo.bats +26 -0
- data/bats/options.bats +1 -1
- data/docs/dev/import-substitution-basic.md +5 -0
- data/docs/dev/import-substitution-compare.md +12 -0
- data/docs/dev/import-substitution-export.md +18 -0
- data/docs/dev/import-substitution-long.md +12 -0
- data/docs/dev/import-substitution-mixed.md +9 -0
- data/docs/dev/import-substitution-plant.md +11 -0
- data/docs/dev/import-substitution-quotes.md +7 -0
- data/docs/dev/import-substitution-research.md +11 -0
- data/docs/dev/import-substitution-simple.md +5 -0
- data/docs/dev/import-substitution-special.md +10 -0
- data/docs/dev/import-substitution-taxonomy.md +14 -0
- data/docs/dev/import-with-text-substitution.md +57 -0
- data/docs/dev/linked-file.md +3 -0
- data/docs/dev/load-mode-demo.md +163 -0
- data/docs/dev/requiring-blocks.md +1 -0
- data/examples/import_with_substitution_demo.md +48 -0
- data/examples/imports/mixed_template.md +33 -0
- data/examples/imports/organism_template.md +42 -0
- data/examples/imports/template_mustache.md +22 -0
- data/examples/imports/template_vars.md +22 -0
- data/examples/raw_replacement_demo.md +42 -0
- data/examples/recent_discoveries_demo.md +43 -0
- data/examples/template_syntax_demo.md +24 -0
- data/lib/cached_nested_file_reader.rb +174 -28
- data/lib/command_result.rb +3 -2
- data/lib/constants.rb +5 -0
- data/lib/evaluate_shell_expressions.rb +0 -1
- data/lib/exceptions.rb +10 -2
- data/lib/fcb.rb +20 -14
- data/lib/hash_delegator.rb +192 -125
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/mdoc.rb +2 -1
- data/lib/menu.src.yml +2 -1
- data/lib/menu.yml +2 -1
- data/lib/ww.rb +24 -0
- metadata +25 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 401f0583b9951f0cfd6259313d7120d2f5f7fbbb3c596110eeafe449f63b9ca7
|
4
|
+
data.tar.gz: 8c411e5c1f3ae394d76a2e0fbbc92aae009e31ba0e17b9fa29d30dabfd8b8e5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 896ac3441e10cac18bbccbe02913612f8a926a7108dd86a9b01d0dc8354d1da4f8ca58dcb8413f460072277802639be2bd4421efc83abced9e18ea9212505010
|
7
|
+
data.tar.gz: 4804a98ff4a6ff6a5d7ba7dc0739e6ec2d6b7a115dd7f6198955261bf1d07ed62e93c9d1180570e14f3d1e43e6a59a6ae587c21fbbd13d02491b79ad7ac92e1e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.1.0] - 2025-06-23
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Enhance import with text substitution.
|
8
|
+
- Load block modes (append, replace).
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Handle interrupt at UX edit prompt.
|
13
|
+
- Apply the force attribute (stated and default) in UX blocks.
|
14
|
+
|
15
|
+
## [3.0.9] - 2025-06-12
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Edited values are appended to inherited lines.
|
20
|
+
|
21
|
+
## [3.0.8] - 2025-06-11
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- Export code from UX blocks.
|
26
|
+
|
27
|
+
## [3.0.7] - 2025-06-10
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
- Fix False as the initial allow value.
|
32
|
+
|
3
33
|
## [3.0.6] - 2025-06-07
|
4
34
|
|
5
35
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -6,15 +6,3 @@ load 'test_helper'
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-required-variables.md \
|
7
7
|
'SPECIES='
|
8
8
|
}
|
9
|
-
|
10
|
-
# hangs
|
11
|
-
# Enter a value: []: #<Errno::EISDIR: Is a directory @ io_fillbuf - fd:12 test>
|
12
|
-
# ["/Users/fareed/Documents/dev/ruby/markdown_exec/lib/hash_delegator.rb:4650:in `gets'",
|
13
|
-
# "/Users/fareed/Documents/dev/ruby/markdown_exec/lib/hash_delegator.rb:4650:in `gets'",
|
14
|
-
# "/Users/fareed/Documents/dev/ruby/markdown_exec/lib/hash_delegator.rb:4650:in `block in ux_block_export_activated'",
|
15
|
-
#
|
16
|
-
#@test 'An undefined variable is a precondition - active' {
|
17
|
-
# spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-required-variables.md \
|
18
|
-
# test \
|
19
|
-
# 'A value must exist for: MISSING_VARIABLE_SPECIES='
|
20
|
-
#}
|
@@ -26,11 +26,3 @@ load 'test_helper'
|
|
26
26
|
'false_false_false_false_false_false'
|
27
27
|
}
|
28
28
|
|
29
|
-
# test trigger presents prompt
|
30
|
-
# test trigger presents allow list
|
31
|
-
# test validation limits input
|
32
|
-
# test transform formats output
|
33
|
-
# test format creates output
|
34
|
-
# test default, validation, prompt are displayed
|
35
|
-
|
36
|
-
# bin/bmde docs/dev/block-type-ux-sources.md --list-blocks-message init_source --list-blocks-type 3 --list-blocks
|
data/bats/cli.bats
CHANGED
@@ -36,6 +36,18 @@ load 'test_helper'
|
|
36
36
|
' ARG1: 37'
|
37
37
|
}
|
38
38
|
|
39
|
+
@test 'vars in link block are appended to inherited lines - local link' {
|
40
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/requiring-blocks.md \
|
41
|
+
'[link-local-block-with-vars]' \
|
42
|
+
'* Exit_# [link-local-block-with-vars]_ARG1="37"_block: echo-ARG1_ file: docs/dev/linked-file.md_ vars:_ ARG1: arg1-from-link-file_block: output_arguments_ vars:_ ARG1: 37_block: missing_ARG1=37_output_arguments'
|
43
|
+
}
|
44
|
+
|
45
|
+
@test 'vars in link block are appended to inherited lines - external file' {
|
46
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/requiring-blocks.md \
|
47
|
+
'[link-file-block-with-vars]' \
|
48
|
+
'* Exit_# [link-file-block-with-vars]_ARG1="arg1-from-link-file"_echo-ARG1'
|
49
|
+
}
|
50
|
+
|
39
51
|
# the last block is a link block, so menu is displayed
|
40
52
|
@test 'link block setting an environment variable requires a bash block' {
|
41
53
|
BATS_OUTPUT_FILTER=A
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
load 'test_helper'
|
4
|
+
|
5
|
+
@test 'enhanced @import functionality with text substitution' {
|
6
|
+
BATS_OUTPUT_FILTER=A
|
7
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-with-text-substitution.md \
|
8
|
+
'IMPORT SUBSTITUTION COMPREHENSIVE TEST__Tests enhanced @import ./functionality with text_substitution using biological entity data.__Basic Import (Backward Compatibility)__Basic import without parameters.__Content: Static biological reference data._Source: Living entities research database._Format: Markdown with embedded data. __Raw Replacement - Simple Parameters__Genus: Pongo_Family: Hominidae _Order: Primates__Classification hierarchy shows Pongo within Hominidae of_Primates.__Raw Replacement - Quoted Values__Common Name: Tapanuli Orangutan_Scientific Name: Pongo tapanuliensis_Discovery Location: Sumatra, Indonesia__Organism Tapanuli Orangutan (Pongo tapanuliensis) found_in Sumatra, Indonesia.__Note: Tapanuli Orangutan contains spaces, Pongo_tapanuliensis contains spaces, Sumatra, Indonesia_contains punctuation.__Raw Replacement - Mixed Parameters__Species: Psychedelic Frogfish (Histiophryne psychedelica)_Discovery: 2009_Depth Range: 15-65 meters_Habitat: Coral reefs__Marine organism Psychedelic Frogfish discovered in 2009._Lives at 15-65 meters in Coral reefs environment.__Test: 2009 is numeric, 15-65 meters contains units, Coral_reefs contains spaces.__Raw Replacement - Numbers and Special Characters__Organism: Yeti Crab_Year: 2005 _Depth: 2200 meters_Temperature: 2°C_Location: Easter Island microplate__Discovery data: Yeti Crab found 2005 at 2200 meters depth._Environment: 2°C water near Easter Island microplate.__Tests: Numbers (2005, 2200), special chars (2°C °C),_complex location.__Raw Replacement - Long Scientific Names__Classification of Ecuadorian Glassfrog:__Scientific Name: Hyalinobatrachium yaku_Genus: Hyalinobatrachium_Family: Centrolenidae_Order: Anura _Class: Amphibia__Full classification: Amphibia > Anura > Centrolenidae >_Hyalinobatrachium > Hyalinobatrachium yaku__Long names test: Hyalinobatrachium and Centrolenidae are_lengthy taxonomic terms._Species Hyalinobatrachium yaku demonstrates complex_scientific nomenclature.__Raw Replacement - Plant Data__Plant Species: Spiny Dandelion (Taraxacum japonicum)__Kingdom: Plantae_Phylum: Tracheophyta _Class: Magnoliopsida__Plant classification differs from animal taxonomy._Spiny Dandelion belongs to Plantae with phylum_Tracheophyta._Classification ends at Magnoliopsida level for this plant.__Test: Plant-specific taxonomic structure. __Raw Replacement - Multiple Species Comparison__Species Comparison:__Species A: Kiwa hirsuta (2005)_Species B: Phyllopteryx dewysea (2015)__Habitat A: Deep sea_Habitat B: Coastal waters__Discovery timeline: Kiwa hirsuta found 2005, Phyllopteryx_dewysea found 2015._Environment: Deep sea vs Coastal waters.__Test: Numbered parameters (Kiwa hirsuta/Phyllopteryx_dewysea) and temporal data.__Raw Replacement - Taxonomic Hierarchy__Complete Taxonomic Classification:__Domain: Eukaryota_Kingdom: Animalia_Phylum: Chordata_Class: Mammalia_Order: Primates_Family: Hominidae_Genus: Homo_Species: Homo luzonensis__Full hierarchy: Eukaryota > Animalia > Chordata >_Mammalia > Primates > Hominidae > Homo > Homo luzonensis__Test: Complete 8-level taxonomic classification with all_major ranks.__Raw Replacement - Research Data__Research Study:__Lead Researcher: Dr. Matthew Leach_Institution: California Academy of Sciences_Method: Genetic analysis_Sample Size: 47 specimens__Study conducted by Dr. Matthew Leach at California_Academy of Sciences._Used Genetic analysis with 47 total samples.__Test: Researcher names, institution names, methodology_terms, numeric data.__Export and Variables__Organism Data Export:__export Illacme tobini_NAME="Illacme tobini"_export 2016=2016_export 414=414_export California="California"_export Endemic="Endemic"__echo "Processing Illacme tobini from 2016"_echo "Characteristics: 414 legs"_echo "Location: California (Endemic)"__Variable assignment test: Illacme tobini has 414 legs,_found in California._Status: Endemic as of 2016 discovery.__Test: Shell exports, numeric values, status terms. __Expected output shows proper text substitution with word_boundary protection.'
|
9
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
load 'test_helper'
|
4
|
+
|
5
|
+
@test 'document initial state' {
|
6
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/load-vars-state-demo.md \
|
7
|
+
'var1 = line1_var3 = line6_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ LOAD BLOCK STATE MODIFICATION DEMO__This document demonstrates how a LOAD block can modify the inherited state that was initially set_by VARS blocks.__First, establish baseline variables using a VARS block:__Use a LOAD block to modify the initial state:__load-mode-default_load-mode-append_load-mode-replace'
|
8
|
+
}
|
9
|
+
|
10
|
+
@test 'load-mode-default' {
|
11
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/load-vars-state-demo.md \
|
12
|
+
load-mode-default \
|
13
|
+
'var1 = line1_var3 = line6_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ - : # line 1_ - : var1=line2_ - : # line 3_ - : var2=line4_ - : # line 5_ LOAD BLOCK STATE MODIFICATION DEMO__This document demonstrates how a LOAD block can modify the inherited state that was initially set_by VARS blocks.__First, establish baseline variables using a VARS block:__Use a LOAD block to modify the initial state:__load-mode-default_load-mode-append_load-mode-replace'
|
14
|
+
}
|
15
|
+
|
16
|
+
@test 'load-mode-append' {
|
17
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/load-vars-state-demo.md \
|
18
|
+
load-mode-append \
|
19
|
+
'var1 = line1_var3 = line6_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ - : # line 1_ - : var1=line2_ - : # line 3_ - : var2=line4_ - : # line 5_ LOAD BLOCK STATE MODIFICATION DEMO__This document demonstrates how a LOAD block can modify the inherited state that was initially set_by VARS blocks.__First, establish baseline variables using a VARS block:__Use a LOAD block to modify the initial state:__load-mode-default_load-mode-append_load-mode-replace'
|
20
|
+
}
|
21
|
+
|
22
|
+
@test 'load-mode-replace' {
|
23
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/load-vars-state-demo.md \
|
24
|
+
load-mode-replace \
|
25
|
+
'var1 = line1_var3 = line6_ inherited_lines_ - : var1="line1"_ - : var3="line6"_ inherited_lines_ - : # line 1_ - : var1=line2_ - : # line 3_ - : var2=line4_ - : # line 5_ LOAD BLOCK STATE MODIFICATION DEMO__This document demonstrates how a LOAD block can modify the inherited state that was initially set_by VARS blocks.__First, establish baseline variables using a VARS block:__Use a LOAD block to modify the initial state:__load-mode-default_load-mode-append_load-mode-replace'
|
26
|
+
}
|
data/bats/options.bats
CHANGED
@@ -19,7 +19,7 @@ load 'test_helper'
|
|
19
19
|
|
20
20
|
@test 'Options - find, find-path in directory names' {
|
21
21
|
run_mde_specs_md_args_expect_xansi --find-path ./docs --find search \
|
22
|
-
'Searching in: ./docs In directory names ./docs/research'
|
22
|
+
'Searching in: ./docs In directory names ./docs/research In file names ./docs/dev/import-substitution-research.md'
|
23
23
|
}
|
24
24
|
|
25
25
|
@test 'Options - find, find-path in file names' {
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Species Comparison:
|
2
|
+
|
3
|
+
Species A: SPECIES1 (YEAR1)
|
4
|
+
Species B: SPECIES2 (YEAR2)
|
5
|
+
|
6
|
+
Habitat A: HABITAT1
|
7
|
+
Habitat B: HABITAT2
|
8
|
+
|
9
|
+
Discovery timeline: SPECIES1 found YEAR1, SPECIES2 found YEAR2.
|
10
|
+
Environment: HABITAT1 vs HABITAT2.
|
11
|
+
|
12
|
+
Test: Numbered parameters (SPECIES1/SPECIES2) and temporal data.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Organism Data Export:
|
2
|
+
|
3
|
+
```bash
|
4
|
+
export ORGANISM_NAME="ORGANISM"
|
5
|
+
export DISCOVERY_YEAR=DISCOVERY_YEAR
|
6
|
+
export LEG_COUNT=LEG_COUNT
|
7
|
+
export LOCATION="LOCATION"
|
8
|
+
export STATUS="STATUS"
|
9
|
+
|
10
|
+
echo "Processing ORGANISM from DISCOVERY_YEAR"
|
11
|
+
echo "Characteristics: LEG_COUNT legs"
|
12
|
+
echo "Location: LOCATION (STATUS)"
|
13
|
+
```
|
14
|
+
|
15
|
+
Variable assignment test: ORGANISM has LEG_COUNT legs, found in LOCATION.
|
16
|
+
Status: STATUS as of DISCOVERY_YEAR discovery.
|
17
|
+
|
18
|
+
Test: Shell exports, numeric values, status terms.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Classification of COMMON_NAME:
|
2
|
+
|
3
|
+
Scientific Name: SPECIES
|
4
|
+
Genus: GENUS
|
5
|
+
Family: FAMILY
|
6
|
+
Order: ORDER
|
7
|
+
Class: CLASS
|
8
|
+
|
9
|
+
Full classification: CLASS > ORDER > FAMILY > GENUS > SPECIES
|
10
|
+
|
11
|
+
Long names test: GENUS and FAMILY are lengthy taxonomic terms.
|
12
|
+
Species SPECIES demonstrates complex scientific nomenclature.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Species: COMMON_NAME (SPECIES)
|
2
|
+
Discovery: YEAR_DISCOVERED
|
3
|
+
Depth Range: DEPTH
|
4
|
+
Habitat: HABITAT
|
5
|
+
|
6
|
+
Marine organism COMMON_NAME discovered in YEAR_DISCOVERED.
|
7
|
+
Lives at DEPTH in HABITAT environment.
|
8
|
+
|
9
|
+
Test: YEAR_DISCOVERED is numeric, DEPTH contains units, HABITAT contains spaces.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Plant Species: COMMON_NAME (SPECIES)
|
2
|
+
|
3
|
+
Kingdom: KINGDOM
|
4
|
+
Phylum: PHYLUM
|
5
|
+
Class: CLASS
|
6
|
+
|
7
|
+
Plant classification differs from animal taxonomy.
|
8
|
+
COMMON_NAME belongs to KINGDOM with phylum PHYLUM.
|
9
|
+
Classification ends at CLASS level for this plant.
|
10
|
+
|
11
|
+
Test: Plant-specific taxonomic structure.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Research Study:
|
2
|
+
|
3
|
+
Lead Researcher: RESEARCHER
|
4
|
+
Institution: INSTITUTION
|
5
|
+
Method: DISCOVERY_METHOD
|
6
|
+
Sample Size: SAMPLE_SIZE specimens
|
7
|
+
|
8
|
+
Study conducted by RESEARCHER at INSTITUTION.
|
9
|
+
Used DISCOVERY_METHOD with SAMPLE_SIZE total samples.
|
10
|
+
|
11
|
+
Test: Researcher names, institution names, methodology terms, numeric data.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Organism: COMMON_NAME
|
2
|
+
Year: YEAR_DISCOVERED
|
3
|
+
Depth: DEPTH meters
|
4
|
+
Temperature: TEMPERATURE
|
5
|
+
Location: LOCATION
|
6
|
+
|
7
|
+
Discovery data: COMMON_NAME found YEAR_DISCOVERED at DEPTH meters depth.
|
8
|
+
Environment: TEMPERATURE water near LOCATION.
|
9
|
+
|
10
|
+
Tests: Numbers (YEAR_DISCOVERED, DEPTH), special chars (TEMPERATURE °C), complex location.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Complete Taxonomic Classification:
|
2
|
+
|
3
|
+
Domain: DOMAIN
|
4
|
+
Kingdom: KINGDOM
|
5
|
+
Phylum: PHYLUM
|
6
|
+
Class: CLASS
|
7
|
+
Order: ORDER
|
8
|
+
Family: FAMILY
|
9
|
+
Genus: GENUS
|
10
|
+
Species: SPECIES
|
11
|
+
|
12
|
+
Full hierarchy: DOMAIN > KINGDOM > PHYLUM > CLASS > ORDER > FAMILY > GENUS > SPECIES
|
13
|
+
|
14
|
+
Test: Complete 8-level taxonomic classification with all major ranks.
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Import Substitution Comprehensive Test
|
2
|
+
|
3
|
+
Tests enhanced @import ./functionality with text substitution using biological entity data.
|
4
|
+
|
5
|
+
## Basic Import (Backward Compatibility)
|
6
|
+
|
7
|
+
@import ./import-substitution-basic.md
|
8
|
+
|
9
|
+
## Raw Replacement - Simple Parameters
|
10
|
+
|
11
|
+
@import ./import-substitution-simple.md GENUS=Pongo FAMILY=Hominidae ORDER=Primates
|
12
|
+
|
13
|
+
## Raw Replacement - Quoted Values
|
14
|
+
|
15
|
+
@import ./import-substitution-quotes.md COMMON_NAME="Tapanuli Orangutan" SPECIES="Pongo tapanuliensis" LOCATION="Sumatra, Indonesia"
|
16
|
+
|
17
|
+
## Raw Replacement - Mixed Parameters
|
18
|
+
|
19
|
+
@import ./import-substitution-mixed.md COMMON_NAME="Psychedelic Frogfish" SPECIES="Histiophryne psychedelica" YEAR_DISCOVERED=2009 DEPTH="15-65 meters" HABITAT="Coral reefs"
|
20
|
+
|
21
|
+
## Raw Replacement - Numbers and Special Characters
|
22
|
+
|
23
|
+
@import ./import-substitution-special.md COMMON_NAME="Yeti Crab" YEAR_DISCOVERED=2005 DEPTH=2200 TEMPERATURE="2°C" LOCATION="Easter Island microplate"
|
24
|
+
|
25
|
+
## Raw Replacement - Long Scientific Names
|
26
|
+
|
27
|
+
@import ./import-substitution-long.md COMMON_NAME="Ecuadorian Glassfrog" SPECIES="Hyalinobatrachium yaku" GENUS=Hyalinobatrachium FAMILY=Centrolenidae ORDER=Anura CLASS=Amphibia
|
28
|
+
|
29
|
+
## Raw Replacement - Plant Data
|
30
|
+
|
31
|
+
@import ./import-substitution-plant.md COMMON_NAME="Spiny Dandelion" SPECIES="Taraxacum japonicum" KINGDOM=Plantae PHYLUM=Tracheophyta CLASS=Magnoliopsida
|
32
|
+
|
33
|
+
## Raw Replacement - Multiple Species Comparison
|
34
|
+
|
35
|
+
@import ./import-substitution-compare.md SPECIES1="Kiwa hirsuta" SPECIES2="Phyllopteryx dewysea" YEAR1=2005 YEAR2=2015 HABITAT1="Deep sea" HABITAT2="Coastal waters"
|
36
|
+
|
37
|
+
## Raw Replacement - Taxonomic Hierarchy
|
38
|
+
|
39
|
+
@import ./import-substitution-taxonomy.md DOMAIN=Eukaryota KINGDOM=Animalia PHYLUM=Chordata CLASS=Mammalia ORDER=Primates FAMILY=Hominidae GENUS=Homo SPECIES="Homo luzonensis"
|
40
|
+
|
41
|
+
## Raw Replacement - Research Data
|
42
|
+
|
43
|
+
@import ./import-substitution-research.md RESEARCHER="Dr. Matthew Leach" INSTITUTION="California Academy of Sciences" DISCOVERY_METHOD="Genetic analysis" SAMPLE_SIZE=47
|
44
|
+
|
45
|
+
## Export and Variables
|
46
|
+
|
47
|
+
@import ./import-substitution-export.md ORGANISM="Illacme tobini" DISCOVERY_YEAR=2016 LEG_COUNT=414 LOCATION="California" STATUS="Endemic"
|
48
|
+
|
49
|
+
Expected output shows proper text substitution with word boundary protection.
|
50
|
+
@import ./bats-document-configuration.md
|
51
|
+
```opts :(document_opts)
|
52
|
+
heading1_center: false
|
53
|
+
heading2_center: false
|
54
|
+
menu_include_imported_blocks: true
|
55
|
+
menu_include_imported_notes: true
|
56
|
+
screen_width: 64
|
57
|
+
```
|
data/docs/dev/linked-file.md
CHANGED
@@ -0,0 +1,163 @@
|
|
1
|
+
# LOAD Block Mode Demonstration
|
2
|
+
|
3
|
+
This document demonstrates the difference between `mode: append` (default) and `mode: replace` for LOAD blocks.
|
4
|
+
|
5
|
+
## Setup: Create Initial Inherited Lines
|
6
|
+
|
7
|
+
First, let's establish some inherited lines that will be used to test the different modes:
|
8
|
+
|
9
|
+
```vars :setup_environment
|
10
|
+
PROJECT_NAME: load-mode-demo
|
11
|
+
VERSION: 1.0.0
|
12
|
+
AUTHOR: MDE Testing
|
13
|
+
```
|
14
|
+
|
15
|
+
```bash :create_initial_context
|
16
|
+
echo "# Initial Context"
|
17
|
+
echo "PROJECT: $PROJECT_NAME"
|
18
|
+
echo "VERSION: $VERSION"
|
19
|
+
echo "AUTHOR: $AUTHOR"
|
20
|
+
echo ""
|
21
|
+
echo "# These lines are inherited and available for LOAD operations"
|
22
|
+
```
|
23
|
+
|
24
|
+
## Test Files Setup
|
25
|
+
|
26
|
+
Create test files in document_configurations directory for loading:
|
27
|
+
|
28
|
+
```bash :create_test_files
|
29
|
+
mkdir -p document_configurations/load_demo
|
30
|
+
|
31
|
+
# Create append-demo.sh
|
32
|
+
cat > document_configurations/load_demo/append-demo.sh << 'EOF'
|
33
|
+
echo "=== Loaded via APPEND mode ==="
|
34
|
+
echo "This content will be ADDED to existing inherited lines"
|
35
|
+
echo "Original context should still be visible above"
|
36
|
+
echo "Loaded at: $(date)"
|
37
|
+
EOF
|
38
|
+
|
39
|
+
# Create replace-demo.sh
|
40
|
+
cat > document_configurations/load_demo/replace-demo.sh << 'EOF'
|
41
|
+
echo "=== Loaded via REPLACE mode ==="
|
42
|
+
echo "This content REPLACES all inherited lines"
|
43
|
+
echo "Original context should NOT be visible"
|
44
|
+
echo "Loaded at: $(date)"
|
45
|
+
echo "Only this loaded content should execute"
|
46
|
+
EOF
|
47
|
+
|
48
|
+
echo "Test files created successfully"
|
49
|
+
ls -la document_configurations/load_demo/
|
50
|
+
```
|
51
|
+
|
52
|
+
## Test 1: Default Mode (Append)
|
53
|
+
|
54
|
+
This LOAD block uses the default behavior where loaded content is **appended** to inherited lines:
|
55
|
+
|
56
|
+
```load :test_append_mode
|
57
|
+
directory: document_configurations/load_demo
|
58
|
+
filename_pattern: '^(?<name>.*)$'
|
59
|
+
glob: 'append-demo.sh'
|
60
|
+
view: '%{name}'
|
61
|
+
```
|
62
|
+
|
63
|
+
Expected behavior:
|
64
|
+
- The initial context (PROJECT, VERSION, AUTHOR) should execute first
|
65
|
+
- Then the loaded content from append-demo.sh should execute
|
66
|
+
- Both sets of lines are combined
|
67
|
+
|
68
|
+
## Test 2: Explicit Append Mode
|
69
|
+
|
70
|
+
This LOAD block explicitly specifies `mode: append` (same as default):
|
71
|
+
|
72
|
+
```load :test_explicit_append
|
73
|
+
directory: document_configurations/load_demo
|
74
|
+
filename_pattern: '^(?<name>.*)$'
|
75
|
+
glob: 'append-demo.sh'
|
76
|
+
view: '%{name}'
|
77
|
+
mode: append
|
78
|
+
```
|
79
|
+
|
80
|
+
Expected behavior: Same as Test 1 - inherited lines + loaded content
|
81
|
+
|
82
|
+
## Test 3: Replace Mode
|
83
|
+
|
84
|
+
This LOAD block uses `mode: replace` where loaded content **replaces** all inherited lines:
|
85
|
+
|
86
|
+
```load :test_replace_mode
|
87
|
+
directory: document_configurations/load_demo
|
88
|
+
filename_pattern: '^(?<name>.*)$'
|
89
|
+
glob: 'replace-demo.sh'
|
90
|
+
view: '%{name}'
|
91
|
+
mode: replace
|
92
|
+
```
|
93
|
+
|
94
|
+
Expected behavior:
|
95
|
+
- The initial context (PROJECT, VERSION, AUTHOR) should NOT execute
|
96
|
+
- Only the loaded content from replace-demo.sh should execute
|
97
|
+
- Inherited lines are completely replaced
|
98
|
+
|
99
|
+
## Test 4: Multiple Loads with Different Modes
|
100
|
+
|
101
|
+
First, load with append to build up context:
|
102
|
+
|
103
|
+
```load :build_context_append
|
104
|
+
directory: document_configurations/load_demo
|
105
|
+
filename_pattern: '^(?<name>.*)$'
|
106
|
+
glob: 'append-demo.sh'
|
107
|
+
view: '%{name}'
|
108
|
+
mode: append
|
109
|
+
```
|
110
|
+
|
111
|
+
Then load with replace to demonstrate clearing:
|
112
|
+
|
113
|
+
```load :clear_and_replace
|
114
|
+
directory: document_configurations/load_demo
|
115
|
+
filename_pattern: '^(?<name>.*)$'
|
116
|
+
glob: 'replace-demo.sh'
|
117
|
+
view: '%{name}'
|
118
|
+
mode: replace
|
119
|
+
```
|
120
|
+
|
121
|
+
Expected behavior:
|
122
|
+
- After first load: initial context + append-demo content
|
123
|
+
- After second load: only replace-demo content (everything else cleared)
|
124
|
+
|
125
|
+
## Verification Commands
|
126
|
+
|
127
|
+
Check what's in our inherited lines at different points:
|
128
|
+
|
129
|
+
```bash :check_inherited_state
|
130
|
+
echo "=== Current Inherited State ==="
|
131
|
+
echo "If you see initial setup variables, APPEND mode is working"
|
132
|
+
echo "If you only see loaded content, REPLACE mode is working"
|
133
|
+
echo ""
|
134
|
+
env | grep -E "(PROJECT_NAME|VERSION|AUTHOR)" || echo "No setup variables found - likely REPLACE mode was used"
|
135
|
+
```
|
136
|
+
|
137
|
+
## Use Cases for Each Mode
|
138
|
+
|
139
|
+
### Mode: Append (Default)
|
140
|
+
- **Use case**: Adding functionality to existing context
|
141
|
+
- **Example**: Loading utility functions while keeping current environment
|
142
|
+
- **Behavior**: Inherited lines + loaded content
|
143
|
+
|
144
|
+
### Mode: Replace
|
145
|
+
- **Use case**: Starting fresh with completely new context
|
146
|
+
- **Example**: Loading a different configuration that should not mix with current state
|
147
|
+
- **Behavior**: Only loaded content, inherited lines discarded
|
148
|
+
|
149
|
+
## Clean Up
|
150
|
+
|
151
|
+
```bash :cleanup
|
152
|
+
rm -rf document_configurations/load_demo
|
153
|
+
echo "Test files cleaned up"
|
154
|
+
```
|
155
|
+
|
156
|
+
## Implementation Notes
|
157
|
+
|
158
|
+
The `mode` parameter in LOAD blocks controls how the loaded content interacts with inherited lines:
|
159
|
+
|
160
|
+
- `mode: append` (default): `inherited_lines + loaded_content`
|
161
|
+
- `mode: replace`: `loaded_content` (inherited_lines ignored)
|
162
|
+
|
163
|
+
This is implemented in the `next_state_append_code` method which now accepts a mode parameter and conditionally includes inherited lines based on the mode value.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Import with Text Substitution Demo
|
2
|
+
|
3
|
+
This demonstrates the new enhanced `@import` functionality that supports text substitution parameters with **raw replacement** as the primary mode, using biological entity data.
|
4
|
+
|
5
|
+
## Primate Classification Examples
|
6
|
+
|
7
|
+
@import imports/organism_template.md COMMON_NAME="Tapanuli Orangutan" SPECIES="Pongo tapanuliensis" GENUS=Pongo FAMILY=Hominidae ORDER=Primates CLASS=Mammalia YEAR_DISCOVERED=2017
|
8
|
+
|
9
|
+
@import imports/organism_template.md COMMON_NAME="Homo luzonensis" SPECIES="Homo luzonensis" GENUS=Homo FAMILY=Hominidae ORDER=Primates CLASS=Mammalia YEAR_DISCOVERED=2019
|
10
|
+
|
11
|
+
## Marine Life Classification
|
12
|
+
|
13
|
+
@import imports/organism_template.md COMMON_NAME="Yeti Crab" SPECIES="Kiwa hirsuta" GENUS=Kiwa FAMILY=Kiwaidae ORDER=Decapoda CLASS=Malacostraca YEAR_DISCOVERED=2005
|
14
|
+
|
15
|
+
The imported template file uses **raw text placeholders** (just the key name) that get replaced with the biological data specified in the @import line.
|
16
|
+
|
17
|
+
## Primary Mode: Raw Replacement
|
18
|
+
|
19
|
+
By default, template placeholders are just the key names without any delimiters:
|
20
|
+
|
21
|
+
```
|
22
|
+
Common Name: COMMON_NAME
|
23
|
+
Species: SPECIES
|
24
|
+
Genus: GENUS
|
25
|
+
Family: FAMILY
|
26
|
+
```
|
27
|
+
|
28
|
+
Gets transformed to:
|
29
|
+
|
30
|
+
```
|
31
|
+
Common Name: Tapanuli Orangutan
|
32
|
+
Species: Pongo tapanuliensis
|
33
|
+
Genus: Pongo
|
34
|
+
Family: Hominidae
|
35
|
+
```
|
36
|
+
|
37
|
+
## Usage Examples
|
38
|
+
|
39
|
+
Here are different ways to specify biological data:
|
40
|
+
|
41
|
+
- Simple values: `@import imports/organism_template.md GENUS=Pongo CLASS=Mammalia`
|
42
|
+
- Quoted values with spaces: `@import imports/organism_template.md COMMON_NAME="Psychedelic Frogfish"`
|
43
|
+
- Multiple taxonomic parameters: `@import imports/organism_template.md SPECIES="Pongo tapanuliensis" GENUS=Pongo FAMILY=Hominidae`
|
44
|
+
- Mixed quoting: `@import imports/organism_template.md COMMON_NAME='Ruby Seadragon' SPECIES="Phyllopteryx dewysea" GENUS=Phyllopteryx`
|
45
|
+
|
46
|
+
## Optional: Template Delimiters
|
47
|
+
|
48
|
+
For cases where you need `${}` or `{{}}` style placeholders, you can use the template delimiter mode (requires code configuration).
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Research Report: COMMON_NAME
|
2
|
+
|
3
|
+
**Scientific Name:** SPECIES
|
4
|
+
**Discovery Year:** YEAR_DISCOVERED
|
5
|
+
|
6
|
+
## Summary
|
7
|
+
|
8
|
+
This research document covers COMMON_NAME (SPECIES), discovered in YEAR_DISCOVERED.
|
9
|
+
|
10
|
+
## Taxonomic Classification
|
11
|
+
|
12
|
+
- **Genus:** GENUS
|
13
|
+
- **Family:** FAMILY
|
14
|
+
- **Order:** ORDER
|
15
|
+
- **Class:** CLASS
|
16
|
+
|
17
|
+
```bash
|
18
|
+
# Generate biological data report
|
19
|
+
ORGANISM_NAME="COMMON_NAME"
|
20
|
+
SCIENTIFIC_NAME="SPECIES"
|
21
|
+
DISCOVERY_YEAR="YEAR_DISCOVERED"
|
22
|
+
TAXONOMIC_GENUS="GENUS"
|
23
|
+
TAXONOMIC_FAMILY="FAMILY"
|
24
|
+
TAXONOMIC_ORDER="ORDER"
|
25
|
+
TAXONOMIC_CLASS="CLASS"
|
26
|
+
|
27
|
+
echo "Generating research report for: $ORGANISM_NAME"
|
28
|
+
echo "Scientific classification: $SCIENTIFIC_NAME"
|
29
|
+
echo "Discovered in: $DISCOVERY_YEAR"
|
30
|
+
echo "Taxonomic hierarchy: $TAXONOMIC_CLASS > $TAXONOMIC_ORDER > $TAXONOMIC_FAMILY > $TAXONOMIC_GENUS"
|
31
|
+
```
|
32
|
+
|
33
|
+
Biological research template using **raw replacement** - all taxonomic placeholders are just the key names without delimiters.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# COMMON_NAME Classification
|
2
|
+
|
3
|
+
**Common Name:** COMMON_NAME
|
4
|
+
**Species:** SPECIES
|
5
|
+
**Genus:** GENUS
|
6
|
+
**Family:** FAMILY
|
7
|
+
**Order:** ORDER
|
8
|
+
**Class:** CLASS
|
9
|
+
**Year Discovered:** YEAR_DISCOVERED
|
10
|
+
|
11
|
+
## Taxonomic Classification
|
12
|
+
|
13
|
+
```bash
|
14
|
+
# Biological classification data
|
15
|
+
export COMMON_NAME="COMMON_NAME"
|
16
|
+
export SPECIES="SPECIES"
|
17
|
+
export GENUS="GENUS"
|
18
|
+
export FAMILY="FAMILY"
|
19
|
+
export ORDER="ORDER"
|
20
|
+
export CLASS="CLASS"
|
21
|
+
export YEAR_DISCOVERED="YEAR_DISCOVERED"
|
22
|
+
|
23
|
+
echo "Organism: COMMON_NAME"
|
24
|
+
echo "Scientific name: SPECIES"
|
25
|
+
echo "Discovered in: YEAR_DISCOVERED"
|
26
|
+
```
|
27
|
+
|
28
|
+
## Classification Hierarchy
|
29
|
+
|
30
|
+
```yaml
|
31
|
+
organism:
|
32
|
+
common_name: COMMON_NAME
|
33
|
+
scientific_name: SPECIES
|
34
|
+
taxonomy:
|
35
|
+
genus: GENUS
|
36
|
+
family: FAMILY
|
37
|
+
order: ORDER
|
38
|
+
class: CLASS
|
39
|
+
discovery_year: YEAR_DISCOVERED
|
40
|
+
```
|
41
|
+
|
42
|
+
Biological organism template using raw replacement for taxonomic data.
|