markdown_exec 3.3.0 → 3.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1b653c2db50fe8b7a8de3ea448a49d814b0210fd90090f06b829f30465dc313
4
- data.tar.gz: e48016ab6903bf7967c575fa5f3c84893bf2ffb7e35b5b00788a59b5de2257e5
3
+ metadata.gz: ec9a613148346890f4db46f3f5bdcade05b8e2221e92402c431fa9a359556e1e
4
+ data.tar.gz: 05d16eaf1ac5d433c8da62513da88159313e3b2898d36d7dfa0d71061c83a97b
5
5
  SHA512:
6
- metadata.gz: 8e34466abddbda4228bb45d6bfb75e18e3bf4f9fc664a38eaa89aed3d93aceb0b042463854f02a4c0bb9ccf51e2d03226247e2a5c247315d1bb65954b3635739
7
- data.tar.gz: 77bf12764fe5bf436d270a3d8c1763de469fae4fb6741714dedd1d400bb2e11d1fbeb2811cf062460fdd9cfe05ef2a32e9b6bd83b3e77e3f7f720d808a3472ed
6
+ metadata.gz: 9dcec89e521fc194eb329b36dc83068a11215186c5e3e5447485000a40c8e75f8bdabd10824af34b9ff90fee3f0899d5bb0f82f76f4ffa3a0a950d213585e6a5
7
+ data.tar.gz: 06b8fb5443b026e628fd60962bd9c7abbccd78824ea0d0b001f27b4608cc0cb147fff6fa00eac5de3712ed97f76d50296b35368675478992e06b28db06b29dfc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.4.0] - 2025-09-16
4
+
5
+ ### Added
6
+
7
+ - Accept line continuation for an import directive.
8
+ - Debug methods for block form and direct evaluation
9
+ - Color families indicate related functionality.
10
+
11
+ ### Changed
12
+
13
+ - Size table columns to fit.
14
+ - 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.
15
+
3
16
  ## [3.3.0] - 2025-09-02
4
17
 
5
18
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (3.3.0)
4
+ markdown_exec (3.4.0)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
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|
@@ -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/block-type-ux-auto.md \
7
- 'v1 = _v2 = _v3 = 12_v4 = 21_v5 = markdown_exec_v6 = 31'
7
+ 'v1 = _v2 = _v3 = 12_v4 = 21_v5 = markdown_exec__v6 = 31'
8
8
  }
@@ -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/block-type-ux-default.md \
7
- 'v1 = _v2 = 11_v3 = 12_v4 = 21_v5 = markdown_exec_v6 = 31'
7
+ 'v1 = _v2 = 11_v3 = 12_v4 = 21_v5 = markdown_exec__v6 = 31'
8
8
  }
@@ -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 | |_| Genus | |_| Family | |'
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 |_| -------- | ------------------- |_| Species | Pongo tapanuliensis |_| Genus | Pongo |_| Family | Hominidae |'
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 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'
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 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'
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=markdown_exec_ux3=markdown_exec_ux4=Xform: 'markdown'"
7
+ "ux0=_ux1=Unknown_ux2=markdown_exec__ux3=markdown_exec__ux4=Xform: 'markdown'"
8
8
  }
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test 'displays last key in hash' {
6
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-no-name.md \
7
+ 'OPERATION1=exec_OPERATION2=exec__'
8
+ }
@@ -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 |_ | ----------- | --------------------- | ------------------ |_ | Species | Pongo tapanuliensis | New species? |_ | Name: Genus | Value: Xform: 'Pongo' | Prompt: New genus? |_ | Family | Hominidae | Enter a value: |"
7
+ " | Variable | Value | Prompt |_ | ----------- | --------------------- | ---------------------- |_ | Species | Pongo tapanuliensis | New species? |_ | Name: Genus | Value: Xform: 'Pongo' | Prompt: New genus? |_ | Family | Hominidae | Enter a value: |"
8
8
  }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Transformed output of executed commands' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-transform.md \
7
- '_Execution output has a trailing newline._Var0=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 0a __With validate and transform, output has no newline._Var1=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :chomp, output has no newline._Var2=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :upcase, output is in upper case w/ newline._Var3=MARKDOWN_EXEC_ 4d 41 52 4b 44 4f 57 4e 5f 45 58 45 43 0a '
7
+ '_Execution output has a trailing newline._Var0=markdown_exec__ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 0a __With validate and transform, output has no newline._Var1=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :chomp, output has no newline._Var2=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :upcase, output is in upper case w/ newline._Var3=MARKDOWN_EXEC__ 4d 41 52 4b 44 4f 57 4e 5f 45 58 45 43 0a '
8
8
  }
@@ -5,10 +5,10 @@ load 'test_helper'
5
5
  @test 'Operator $' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/command-substitution-options.md \
7
7
  'operator_$' \
8
- 'Command substitution__The current value of environment variable Common_Name_is displayed using two different operators._The command echo $SHLVL is executed via command_substitution, using two different operators.__| Operato | Variable Expansio | Command Substitutio |_| ------- | ----------------- | ------------------- |_| $ | Tapanuli Oranguta | Pongo tapanuliensis |_| @ | @{Common_Name} | @(echo $Species) |__Toggle between operators.__operator_$__operator_@'
8
+ 'Command substitution__The current value of environment variable Common_Name_is displayed using two different operators._The command echo $SHLVL is executed via command_substitution, using two different operators.__| Operator | Variable Expansion | Command Substitution |_| -------- | ------------------ | -------------------- |_| $ | Tapanuli Orangutan | Pongo tapanuliensis |_| @ | @{Common_Name} | @(echo $Species) |__Toggle between operators.__operator_$__operator_@'
9
9
  }
10
10
 
11
11
  @test 'Operator @' {
12
12
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/command-substitution-options.md \
13
- 'Command substitution__The current value of environment variable Common_Name_is displayed using two different operators._The command echo $SHLVL is executed via command_substitution, using two different operators.__| Operato | Variable Expansio | Command Substitutio |_| ------- | ----------------- | ------------------- |_| $ | ${Common_Name} | $(echo $Species) |_| @ | Tapanuli Oranguta | Pongo tapanuliensis |__Toggle between operators.__operator_$__operator_@'
13
+ 'Command substitution__The current value of environment variable Common_Name_is displayed using two different operators._The command echo $SHLVL is executed via command_substitution, using two different operators.__| Operator | Variable Expansion | Command Substitution |_| -------- | ------------------ | -------------------- |_| $ | ${Common_Name} | $(echo $Species) |_| @ | Tapanuli Orangutan | Pongo tapanuliensis |__Toggle between operators.__operator_$__operator_@'
14
14
  }
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test '' {
6
+ spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-directive-line-continuation.md \
7
+ --blocks dname \
8
+ 'Stem: U1_Species: Illacme tobini_Genus: Illacme'
9
+ }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test '' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/option-expansion.md \
7
- '_| Optio | Description | Value | Va | Def |_| ----- | -------------------------------- | ----- | -- | --- |_| scree | Screen width for document and in | 2 | 64 | 0 |_| table | | 5 | fa | tru |'
7
+ '_| Opti | Description | Valu | Va | Defau |_| ---- | ---------------------------- | ---- | -- | ----- |_| scre | Screen width for document an | 2 | 64 | 0 |_| tabl | | 5 | fa | true |'
8
8
  }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Tables - truncate columns' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/table-column-truncate.md \
7
- 'DEMONSTRATE TRUNCATION OF TEXT IN TABLE CELLS__| Common Name | Species | Genus | Family | Year Di |_| ------------ | ------------ | ----- | ------- | ------- |_| Tapanuli Ora | Pongo tapanu | Pongo | Hominid | 2017 |_| Psychedelic | Histiophryne | Histi | Antenna | 2009 |_| Ruby Seadrag | Phyllopteryx | Phyll | Syngnat | 2015 |_| Illacme tobi | Illacme tobi | Illac | Siphono | 2016 |_| Spiny Dandel | Taraxacum ja | Tarax | Asterac | 2022 |_'
7
+ 'DEMONSTRATE TRUNCATION OF TEXT IN TABLE CELLS__| Common Name | Species | Genus | Family | Year Discover |_| ------------------- | ------------------ | -------- | ----------- | ------------- |_| Tapanuli Orangutan | Pongo tapanuliensi | Pongo | Hominidae | 2017 |_| Psychedelic Frogfis | Histiophryne psych | Histioph | Antennariid | 2009 |_| Ruby Seadragon | Phyllopteryx dewys | Phyllopt | Syngnathida | 2015 |_| Illacme tobini (Mil | Illacme tobini | Illacme | Siphonorhin | 2016 |_| Spiny Dandelion | Taraxacum japonicu | Taraxacu | Asteraceae | 2022 |_'
8
8
  }
data/bats/table.bats CHANGED
@@ -4,7 +4,7 @@ load 'test_helper'
4
4
 
5
5
  @test 'Tables - indented' {
6
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 Discover |_| ------------------ | ---------------------- | ---------- | ----------- | ------------- |_| Tapanuli Orangutan | Pongo tapanuliensis | Pongo | Hominidae | 2017 |_| Psychedelic Frogfi | Histiophryne psychedel | Histiophry | Antennariid | 2009 |_| Ruby Seadragon | Phyllopteryx dewysea | Phyllopter | Syngnathida | 2015 |__ Table indented with two spaces._ Left-justified columns._ | Common Name | Species | Genus | Family | Year Discovere |_ | ------------------------- | ------------- | ------ | -------------- | -------------- |_ | Illacme tobini (Millipede | Illacme tobin | Illacm | Siphonorhinida | 2016 |__ Table indented with one tab._ Right-justified columns._ | Common Name | Species | Genus | Family | Year Discovered |_ | --------------- | ------------------- | --------- | ---------- | --------------- |_ | Spiny Dandelion | Taraxacum japonicum | Taraxacum | Asteraceae | 2022 |'
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 Frogfi | Histiophryne psychedeli | Histiophryn | Antennariida | 2009 |_| Ruby Seadragon | Phyllopteryx dewysea | Phylloptery | 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
8
  }
9
9
 
10
10
  @test 'Tables - invalid' {
@@ -7,6 +7,7 @@ EXIT_MENU=__Exit # name of menu Exit option
7
7
  # • expected byte (0xHEX) and printable character (or “.”)
8
8
  # • actual byte (0xHEX) and printable character (or “.”)
9
9
  compare_bytes () {
10
+ readonly line_count=16
10
11
  set +e
11
12
  local mode="$1"; shift
12
13
  if [[ "$mode" == "--file" ]]; then
@@ -19,13 +20,13 @@ compare_bytes () {
19
20
  # feed the two strings into cmp via process-substitution
20
21
  cmp --verbose <(printf '%s' "$live") <(printf '%s' "$expect")
21
22
  fi |
22
- head -n 3 |
23
+ head -n $line_count |
23
24
  gawk '{
24
25
  live = strtonum(0 $2)
25
26
  expect = strtonum(0 $3)
26
27
  offset = $1 - 1
27
- printf "Offset 0x%X (%4d): output \"%c\" 0x%02X (%3d) vs expect \"%c\" 0x%02X (%3d)\n", \
28
- offset, offset, live, live, live, expect, expect, expect
28
+ printf "Offset 0x%X (%4d): expect \"%c\" 0x%02X (%3d) vs output \"%c\" 0x%02X (%3d)\n", \
29
+ offset, offset, expect, expect, expect, live, live, live
29
30
  }'
30
31
  set -e
31
32
  }
@@ -0,0 +1,17 @@
1
+ / This automatic block sets multiple variables and displays the first variable.
2
+ ```ux
3
+ echo:
4
+ BASENAME1: "$(basename `pwd`)"
5
+ DOCUMENTS1: "${BASENAME1%%_*}"
6
+ OPERATION1: "${BASENAME1##*_}"
7
+ ```
8
+ ```ux
9
+ exec:
10
+ BASENAME2: >-
11
+ basename `pwd`
12
+ DOCUMENTS2: >-
13
+ echo "${BASENAME2%%_*}"
14
+ OPERATION2: >-
15
+ echo "${BASENAME2##*_}"
16
+ ```
17
+ @import bats-document-configuration.md
@@ -40,7 +40,7 @@ name: Family
40
40
  @import bats-document-configuration.md
41
41
  ```opts :(document_opts)
42
42
  menu_ux_row_format: '| %{name}| ${%{name}}| %{prompt}'
43
- screen_width: 72
43
+ screen_width: 76
44
44
  table_center: true
45
45
  ux_auto_load_force_default: true
46
46
  ```
@@ -0,0 +1,6 @@
1
+ @import ./import/parameter-symbols.md \
2
+ __PS_STEM_SPECIES:q='Illacme tobini' \
3
+ __PS_STEM_GENUS:q=Illacme \
4
+ PS_STEM=U1
5
+ Genus: ${__U1_GENUS}
6
+ @import bats-document-configuration.md
@@ -12,6 +12,6 @@
12
12
  @import bats-document-configuration.md
13
13
  ```opts :(document_opts)
14
14
  heading1_center: false
15
- screen_width: 60
15
+ screen_width: 90
16
16
  table_center: false
17
17
  ```
@@ -89,10 +89,22 @@ class CachedNestedFileReader
89
89
 
90
90
  directory_path = File.dirname(filename)
91
91
  processed_lines = []
92
- File.readlines(filename, chomp: true).each.with_index do |line, ind|
92
+ continued_line = nil # continued import directive
93
+ File.readlines(filename, chomp: true).each.with_index do |segment, ind|
93
94
  wwt :readline, 'depth:', depth, 'filename:', filename, 'ind:', ind,
94
- 'line:', line
95
- if Regexp.new(@import_directive_line_pattern) =~ line
95
+ 'segment:', segment
96
+
97
+ if continued_line || (Regexp.new(@import_directive_line_pattern) =~ segment)
98
+
99
+ line = (continued_line || '') + segment
100
+ # if segment ends in a continuation, prepend to next line
101
+ if line.end_with?('\\')
102
+ continued_line = line.chomp('\\')
103
+ next
104
+ end
105
+
106
+ continued_line = nil
107
+ Regexp.new(@import_directive_line_pattern) =~ line
96
108
  name_strip = $~[:name].strip
97
109
  params_string = $~[:params] || ''
98
110
  import_indention = indention + $~[:indention]
@@ -101,9 +113,9 @@ class CachedNestedFileReader
101
113
  import_substitutions, add_code = parse_import_params(params_string)
102
114
  if add_code
103
115
  # strings as NestedLines
104
- add_lines = add_code.map.with_index do |line, ind2|
116
+ add_lines = add_code.map.with_index do |line2, ind2|
105
117
  nested_line = NestedLine.new(
106
- line,
118
+ line2,
107
119
  depth + 1,
108
120
  import_indention,
109
121
  filename,
@@ -161,7 +173,7 @@ class CachedNestedFileReader
161
173
  processed_lines += processed_imported_lines
162
174
  else
163
175
  # Apply substitutions to the current line
164
- substituted_line = apply_line_substitutions(line, substitutions,
176
+ substituted_line = apply_line_substitutions(segment, substitutions,
165
177
  use_template_delimiters)
166
178
  nested_line = NestedLine.new(substituted_line, depth, indention,
167
179
  filename, ind)
data/lib/fcb.rb CHANGED
@@ -7,15 +7,23 @@ require_relative 'namer'
7
7
  BT_UX_FLD_REQUIRED = 'required'
8
8
  def parse_yaml_of_ux_block(
9
9
  data,
10
- menu_format: nil,
11
10
  prompt: nil,
12
11
  validate: nil
13
12
  )
14
- export = data['export']
15
- export = data if export.nil?
16
- name = export['name']
13
+ export = data if (export = data['export']).nil?
17
14
 
18
- raise "Name is missing in UX block: #{data.inspect}" unless name.present?
15
+ # a single variable name is required to display a single value
16
+ menu_format = export['format'] || export['menu_format']
17
+ name = export['name']
18
+ # if name is missing, use the last key in the echo or exec hashes
19
+ if !name&.present?
20
+ name = if export['echo'].is_a? Hash
21
+ export['echo'].keys.last
22
+ elsif export['exec'].is_a? Hash
23
+ export['exec'].keys.last
24
+ end
25
+ end
26
+ raise "Name is missing in UX block: #{data.inspect}" unless name.present? || menu_format.present?
19
27
 
20
28
  OpenStruct.new(
21
29
  act: export['act'],
@@ -25,7 +33,7 @@ def parse_yaml_of_ux_block(
25
33
  exec: export['exec'],
26
34
  force: export['force'],
27
35
  init: export['init'],
28
- menu_format: export['format'] || export['menu_format'], # || menu_format,####
36
+ menu_format: menu_format,
29
37
  name: name,
30
38
  prompt: export['prompt'] || prompt,
31
39
  readonly: export['readonly'].nil? ? false : export['readonly'],
@@ -394,7 +402,7 @@ module MarkdownExec
394
402
  if symbol_or_hash.is_a? Hash
395
403
  # default to the first symbol
396
404
  symbol = symbol_or_hash.first.last
397
- symbol_or_hash.keys.each do |key|
405
+ symbol_or_hash.each_key do |key|
398
406
  if key == true
399
407
  symbol = symbol_or_hash[key]
400
408
  break
data/lib/format_table.rb CHANGED
@@ -142,10 +142,10 @@ module MarkdownTableFormatter
142
142
 
143
143
  def format_table__hs(
144
144
  column_count:,
145
+ decorate: nil,
145
146
  lines:,
147
+ max_table_width: nil,
146
148
  table:,
147
- decorate: nil,
148
- table_width: nil,
149
149
  truncate: true
150
150
  )
151
151
  unless column_count.positive?
@@ -162,13 +162,26 @@ module MarkdownTableFormatter
162
162
  alignment_indicators, column_widths =
163
163
  calculate_column_alignment_and_widths(rows, column_count)
164
164
 
165
- unless table_width.nil?
166
- sum_column_widths = column_widths.sum + ((column_count * 3) + 5)
167
- if sum_column_widths > table_width
168
- ratio = table_width.to_f / sum_column_widths
165
+ unless max_table_width.nil?
166
+ # each column has a frame width of 3 characters
167
+ # border and space before and after each and 1 final border
168
+ borders_width = (column_count * 3) + 1
169
+
170
+ full_column_table_width = column_widths.sum + borders_width
171
+
172
+ if full_column_table_width > max_table_width
173
+ text_width_sum = full_column_table_width - borders_width
174
+ available_text_width = max_table_width - borders_width
175
+ ratio = available_text_width.to_f / text_width_sum
176
+
177
+ # distribute the width across the columns
169
178
  column_widths.each_with_index do |width, i|
170
179
  column_widths[i] = (width * ratio).to_i
171
180
  end
181
+
182
+ # the last column fills the remaining width
183
+ column_widths[column_widths.count - 1] =
184
+ available_text_width - column_widths.sum + column_widths.last
172
185
  end
173
186
  end
174
187
 
@@ -238,6 +251,7 @@ end
238
251
  return if $PROGRAM_NAME != __FILE__
239
252
 
240
253
  require 'minitest/autorun'
254
+ require_relative 'ww'
241
255
 
242
256
  class TestMarkdownTableFormatter < Minitest::Test
243
257
  def setup
@@ -377,7 +391,8 @@ class TestFormatTable < Minitest::Test
377
391
  # "| A | B | C ",
378
392
  # "| 1 | 2 | 3 "
379
393
  # ]
380
- # assert_equal expected, MarkdownTableFormatter.format_table(lines, column_count)
394
+ # assert_equal expected,
395
+ # MarkdownTableFormatter.format_table(lines, column_count)
381
396
  # end
382
397
 
383
398
  def test_empty_input
@@ -325,8 +325,8 @@ module HashDelegatorSelf
325
325
  separator_line: delegate_object[:table_separator_line_color]
326
326
  },
327
327
  lines: lines,
328
+ max_table_width: screen_width_for_table,
328
329
  table: table,
329
- table_width: screen_width_for_table,
330
330
  truncate: $table_cell_truncate
331
331
  )
332
332
 
@@ -8,5 +8,5 @@ module MarkdownExec
8
8
  BIN_NAME = 'mde'
9
9
  GEM_NAME = 'markdown_exec'
10
10
  TAP_DEBUG = 'MDE_DEBUG'
11
- VERSION = '3.3.0'
11
+ VERSION = '3.4.0'
12
12
  end