markdown_exec 1.8.9 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a81d96c57727583a17c019bcb0a8097c6d97633a7b5ee2b33e2d9a7e56a4c081
4
- data.tar.gz: 4c67c34577546161914e77be928867128e55d926c3419c2ab4c6cc521d051cae
3
+ metadata.gz: 9bab8478298e4304b710d35a6c5c0d931635678d038a4a16f4714f9347f38aa6
4
+ data.tar.gz: 2a57f5bc25681718a5c23ec313a8c8767209d1422431348e310d311524e5d66c
5
5
  SHA512:
6
- metadata.gz: 6e7ffb35e3b7cf4aa9fa03095519d28aa088367a8b91cbcf440b143f732510a43401e78b435a0ea73f03a6754e55897fa9800b121f9f767d64715d4d79f019b3
7
- data.tar.gz: a4f94c70dc8f58a7b6bf79a4baf063ef893173ccb26aa57f19a1ab485656ec469dcfa3f70555cb2bddddc55b8a3023576724d23dc30d2b16f444dbd732025b9f
6
+ metadata.gz: c6c4fcb0963a71d89968ff195bb963e31d4f887a7f97d524aeea29bcad5e359e698b89928d00f85cf6ad7cd99d768f2a7152a086fb32abf91e3477751b0979ba
7
+ data.tar.gz: 85631dcaa941169ae08527a2d2f185a82b5a296337aa78e2f50994f7cf2ecaa69966d4a647cafc7c772abd97f0ddc2fc7b2ff0ef298e30f6ff2f46d28eb12d12
data/.rubocop.yml CHANGED
@@ -13,7 +13,8 @@ Layout/LeadingCommentSpace:
13
13
  Layout/LineContinuationLeadingSpace:
14
14
  Enabled: false
15
15
 
16
- Layout/LineLength:
16
+ Layout/LineLength: # 2024-01-21 temp disable
17
+ Enabled: false
17
18
  Max: 96
18
19
 
19
20
  Lint/Debugger:
@@ -58,6 +59,9 @@ Security/YAMLLoad:
58
59
  Style/CommentedKeyword:
59
60
  Enabled: false
60
61
 
62
+ Style/Documentation: # 2024-01-21 temp disable
63
+ Enabled: false
64
+
61
65
  Style/DoubleNegation:
62
66
  Enabled: false
63
67
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.0] - 2024-02-07
4
+
5
+ ### Added
6
+
7
+ - Process format and glob to load, save script code.
8
+
9
+ - Provide ENV and batch variables to formatting function.
10
+
11
+ - Find files matching glob and present for user selection.
12
+
13
+ - Allow for entry of new file name when saving.
14
+
3
15
  ## [1.8.9] - 2024-01-20
4
16
 
5
17
  ### Added
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ gemspec
9
9
  gem 'clipboard'
10
10
  gem 'debug'
11
11
  gem 'erb'
12
- gem 'httparty' # 2024-01-01 for ChatGPI API
12
+ # gem 'httparty' # 2024-01-01 for ChatGPI API
13
13
  gem 'irb', '>= 1.8.0'
14
14
  gem 'mocha', require: false
15
15
  gem 'minitest', require: false
@@ -24,5 +24,6 @@ gem 'rubocop-minitest', require: false
24
24
  gem 'rubocop-rake', require: false
25
25
  gem 'rubocop-rspec', require: false
26
26
  gem 'shellwords'
27
- gem 'uri'
27
+ # gem 'tty-file'
28
+ gem 'uri', '0.12.2'
28
29
  gem 'yaml', '~> 0.2.1'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (1.8.9)
4
+ markdown_exec (2.0.0)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -47,9 +47,6 @@ GEM
47
47
  erb (4.0.3)
48
48
  cgi (>= 0.3.3)
49
49
  erubi (1.12.0)
50
- httparty (0.21.0)
51
- mini_mime (>= 1.0.0)
52
- multi_xml (>= 0.5.2)
53
50
  i18n (1.14.1)
54
51
  concurrent-ruby (~> 1.0)
55
52
  io-console (0.7.1)
@@ -63,11 +60,9 @@ GEM
63
60
  crass (~> 1.0.2)
64
61
  nokogiri (>= 1.12.0)
65
62
  method_source (1.0.0)
66
- mini_mime (1.1.5)
67
63
  minitest (5.20.0)
68
64
  mocha (2.1.0)
69
65
  ruby2_keywords (>= 0.0.5)
70
- multi_xml (0.6.0)
71
66
  nokogiri (1.15.4-arm64-darwin)
72
67
  racc (~> 1.4)
73
68
  open3 (0.1.2)
@@ -187,7 +182,6 @@ DEPENDENCIES
187
182
  clipboard
188
183
  debug
189
184
  erb
190
- httparty
191
185
  irb (>= 1.8.0)
192
186
  markdown_exec!
193
187
  minitest
@@ -203,7 +197,7 @@ DEPENDENCIES
203
197
  rubocop-rake
204
198
  rubocop-rspec
205
199
  shellwords
206
- uri
200
+ uri (= 0.12.2)
207
201
  yaml (~> 0.2.1)
208
202
 
209
203
  BUNDLED WITH
@@ -13,7 +13,7 @@ __filedirs_all()
13
13
  }
14
14
 
15
15
  _mde_echo_version() {
16
- echo "1.8.9"
16
+ echo "2.0.0"
17
17
  }
18
18
 
19
19
  _mde() {
@@ -40,6 +40,10 @@ _mde() {
40
40
 
41
41
  --dump-blocks-in-file) COMPREPLY="0"; return 0 ;;
42
42
 
43
+ --dump-dump-inherited-block_names) COMPREPLY="0"; return 0 ;;
44
+
45
+ --dump-dump-inherited-dependencies) COMPREPLY="0"; return 0 ;;
46
+
43
47
  --dump-dump-inherited-lines) COMPREPLY="0"; return 0 ;;
44
48
 
45
49
  --dump-menu-blocks) COMPREPLY="0"; return 0 ;;
@@ -94,7 +98,7 @@ _mde() {
94
98
  # present matching option names
95
99
  #
96
100
  if [[ ${cur} == -* ]] ; then
97
- opts=("--block-name" "--config" "--debug" "--dump-dump-delegate-object" "--dump-blocks-in-file" "--dump-dump-inherited-lines" "--dump-menu-blocks" "--dump-selected-block" "--exit" "--filename" "--find" "--find-path" "--help" "--how" "--list-blocks" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--pwd" "--run-last-script" "--save-executed-script" "--save-execution-output" "--saved-script-folder" "--saved-stdout-folder" "--select-recent-output" "--select-recent-script" "--tab-completions" "--user-must-approve" "--version" "--display-level")
101
+ opts=("--block-name" "--config" "--debug" "--dump-dump-delegate-object" "--dump-blocks-in-file" "--dump-dump-inherited-block_names" "--dump-dump-inherited-dependencies" "--dump-dump-inherited-lines" "--dump-menu-blocks" "--dump-selected-block" "--exit" "--filename" "--find" "--find-path" "--help" "--how" "--list-blocks" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--pwd" "--run-last-script" "--save-executed-script" "--save-execution-output" "--saved-script-folder" "--saved-stdout-folder" "--select-recent-output" "--select-recent-script" "--tab-completions" "--user-must-approve" "--version" "--display-level")
98
102
  COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
99
103
 
100
104
  return 0
@@ -121,6 +125,10 @@ _mde() {
121
125
 
122
126
  --dump-blocks-in-file) COMPREPLY=".BOOL."; return 0 ;;
123
127
 
128
+ --dump-dump-inherited-block_names) COMPREPLY=".BOOL."; return 0 ;;
129
+
130
+ --dump-dump-inherited-dependencies) COMPREPLY=".BOOL."; return 0 ;;
131
+
124
132
  --dump-dump-inherited-lines) COMPREPLY=".BOOL."; return 0 ;;
125
133
 
126
134
  --dump-menu-blocks) COMPREPLY=".BOOL."; return 0 ;;
@@ -178,4 +186,4 @@ _mde() {
178
186
 
179
187
  complete -o filenames -o nospace -F _mde mde
180
188
  # _mde_echo_version
181
- # echo "Updated: 2024-01-20 19:29:56 UTC"
189
+ # echo "Updated: 2024-02-08 17:51:16 UTC"
data/examples/colors.md CHANGED
@@ -4,23 +4,45 @@
4
4
 
5
5
  <https://en.wikipedia.org/wiki/Complementary_colors#/media/File:RGB_color_wheel.svg>
6
6
 
7
- ff0000 red - exception text
8
- ff7f00 orange - warning text
9
- ffff00 yellow - notification text
10
- 7fff00 chartreuse green - output frame
11
- 00ff00 green - prompt
12
- 00ff7f spring green - input frame
13
- 00ffff cyan - menu text
14
- 007fff azure - menu frame
15
- 0000ff blue
16
- 7f00ff violet - opts frame
17
- ff00ff magenta - opts text
18
- ff007f rose - exception frame
7
+ / ff0000 red - exception text
8
+ / ff7f00 orange - warning text
9
+ / ffff00 yellow - notification text
10
+ / 7fff00 chartreuse green - output frame
11
+ / 00ff00 green - prompt
12
+ / 00ff7f spring green - input frame
13
+ / 00ffff cyan - menu text
14
+ / 007fff azure - menu frame
15
+ / 0000ff blue
16
+ / 7f00ff violet - opts frame
17
+ / ff00ff magenta - opts text
18
+ / ff007f rose - exception frame
19
19
 
20
20
  ```opts :(document_options)
21
21
  ```
22
22
 
23
23
  ```opts :load_colors
24
+ exception_color_detail: fg_rgbh_1f_00_7f
25
+ exception_color_name: fg_rgbh_1f_00_00
26
+ execution_report_preview_frame_color: fg_rgbh_7f_1f_00
27
+ menu_bash_color: fg_rgbh_00_c0_c0
28
+ menu_chrome_color: fg_rgbh_40_c0_c0
29
+ menu_divider_color: fg_rgbh_80_d0_c0
30
+ menu_link_color: fg_rgbh_e0_e0_20
31
+ menu_note_color: fg_rgbh_b0_b0_b0
32
+ menu_opts_color: fg_rgbh_1f_00_1f
33
+ menu_opts_set_color: fg_rgbh_7f_00_1f
34
+ menu_task_color: fg_rgbh_1f_1f_1f
35
+ menu_vars_color: fg_rgbh_1f_a0_1f
36
+ menu_vars_set_color: fg_rgbh_00_1f_1f
37
+ output_execution_label_name_color: fg_rgbh_00_1f_00
38
+ output_execution_label_value_color: fg_rgbh_00_1f_00
39
+ prompt_color_after_script_execution: fg_rgbh_00_1f_00
40
+ script_execution_frame_color: fg_rgbh_00_1f_7f
41
+ script_preview_frame_color: fg_rgbh_7f_1f_00
42
+ warning_color: fg_rgbh_1f_7f_00
43
+ ```
44
+
45
+ ```opts :load_colors2
24
46
  exception_color_detail: fg_rgbh_ff_00_7f
25
47
  exception_color_name: fg_rgbh_ff_00_00
26
48
  execution_report_preview_frame_color: fg_rgbh_7f_ff_00
@@ -57,10 +79,10 @@ warning_color: fg_rgbh_ff_7f_00
57
79
  ```
58
80
  [ ] Task1
59
81
 
60
- blue; fg_rgbh_00_00_FF
61
- green; fg_rgbh_00_FF_00
62
- indigo; fg_rgbh_4B_00_82
63
- orange; fg_rgbh_FF_7F_00
64
- red; fg_rgbh_FF_00_00
65
- violet; fg_rgbh_94_00_D3
66
- yellow; fg_rgbh_FF_FF_00
82
+ / blue; fg_rgbh_00_00_FF
83
+ / green; fg_rgbh_00_FF_00
84
+ / indigo; fg_rgbh_4B_00_82
85
+ / orange; fg_rgbh_FF_7F_00
86
+ / red; fg_rgbh_FF_00_00
87
+ / violet; fg_rgbh_94_00_D3
88
+ / yellow; fg_rgbh_FF_FF_00
@@ -0,0 +1,8 @@
1
+ This document demonstrates the automatic loading of options in a block with a reserved name.
2
+
3
+ ```opts :(document_options)
4
+ menu_divider_format: "=> %{line} == %{line} <="
5
+ ```
6
+
7
+ The divider below is named "Divider #1". Notice the "(document_options)" block sets the "menu_divider_format" option to duplicate the divider name when it is displayed.
8
+ ::: Divider #1
@@ -1,10 +1,7 @@
1
- ```bash :a
2
- 01
1
+ Executing either of these blocks outputs the same two lines.
2
+ ```bash :duplicate_name
3
+ echo from duplicate name, block 1
3
4
  ```
4
- ```bash :a
5
- 02
5
+ ```bash :duplicate_name
6
+ echo from duplicate name, block 2
6
7
  ```
7
- ```bash :a
8
- 03
9
- ```
10
-
data/examples/import0.md CHANGED
@@ -1,10 +1,8 @@
1
- This is Page 0
1
+ This is Page 0. It serves to demonstrate how options control the display of imported blocks and notes.
2
2
 
3
- @import import1.md
3
+ ::: "import1.md" is imported here.
4
4
 
5
- ```opts :(document_options)
6
- user_must_approve: true
7
- ```
5
+ @import import1.md
8
6
 
9
7
  ::: Page 0 code blocks
10
8
 
data/examples/import1.md CHANGED
@@ -1,4 +1,4 @@
1
- This is Page 1
1
+ This is Page 1. It is imported by Page 0.
2
2
 
3
3
  ::: Page 1 code blocks
4
4
 
data/examples/include.md CHANGED
@@ -1,19 +1,25 @@
1
- ```bash :(one)
2
- echo block "one"
1
+ This document demonstrates blocks requiring other blocks.
2
+
3
+ Block "(Winter)" is hidden.
4
+ ```bash :(Winter)
5
+ echo It is now Winter
3
6
  ```
4
7
 
5
- ```bash :two +(one)
6
- echo block "two" requires one
8
+ Block "Spring" is visible. It requires "(Winter)".
9
+ ```bash :Spring +(Winter)
10
+ echo It is now Spring
7
11
  ```
8
12
 
9
- ```bash :(three) +two +(one)
10
- echo block "three" requires two and one
13
+ Block "(Summer)" is hidden. It requires "(Winter)" and "Spring"
14
+ ```bash :(Summer) +Spring +(Winter)
15
+ echo It is now Summer
11
16
  ```
12
17
 
13
- ```bash :four +(three)
14
- echo block "four" requires three
18
+ Block "Fall" is visible. It requires "(Summer)" which itself requires the rest.
19
+ ```bash :Fall +(Summer)
20
+ echo It is now Fall
15
21
  ```
16
22
 
17
- ```bash :trigger_unmet_dependency +(unmet)
18
- echo block "five" requires an unmet dependency
23
+ Block "Sunsear" is visible. It requires "Frostfall" which does not exist and triggers an unmet dependency error.
24
+ ```bash :Sunsear +Frostfall
19
25
  ```
data/examples/indent.md CHANGED
@@ -1,3 +1,5 @@
1
+ This document demonstrates content is indented to match the source.
2
+
1
3
  This is a concise guide for using Bash commands to find and list recent files in a Linux system. The commands are safe to use and can help you quickly locate recently modified or accessed files.
2
4
 
3
5
  1. **List Recently Modified Files**:
data/examples/index.md ADDED
@@ -0,0 +1,68 @@
1
+ v2024-02-06
2
+
3
+ ```link
4
+ file: examples/colors.md
5
+ ```
6
+ ```link
7
+ file: examples/document_options.md
8
+ ```
9
+ ```link
10
+ file: examples/duplicate_block.md
11
+ ```
12
+ ```link
13
+ file: examples/import0.md
14
+ ```
15
+ ```link
16
+ file: examples/import1.md
17
+ ```
18
+ ```link
19
+ file: examples/include.md
20
+ ```
21
+ ```link
22
+ file: examples/indent.md
23
+ ```
24
+ ```link
25
+ file: examples/linked.md
26
+ ```
27
+ ```link
28
+ file: examples/linked1.md
29
+ ```
30
+ ```link
31
+ file: examples/linked2.md
32
+ ```
33
+ ```link
34
+ file: examples/linked3.md
35
+ ```
36
+ ```link
37
+ file: examples/llm.md
38
+ ```
39
+ ```link
40
+ file: examples/load1.sh
41
+ ```
42
+ ```link
43
+ file: examples/load2.sh
44
+ ```
45
+ ```link
46
+ file: examples/nickname.md
47
+ ```
48
+ ```link
49
+ file: examples/opts.md
50
+ ```
51
+ ```link
52
+ file: examples/pass-through.md
53
+ ```
54
+ ```link
55
+ file: examples/plant.md
56
+ ```
57
+ ```link
58
+ file: examples/port.md
59
+ ```
60
+ ```link
61
+ file: examples/title.md
62
+ ```
63
+ ```link
64
+ file: examples/vars.md
65
+ ```
66
+ ```link
67
+ file: examples/wrap.md
68
+ ```
data/examples/linked.md CHANGED
@@ -5,6 +5,11 @@ pause_after_script_execution: false
5
5
  user_must_approve: false
6
6
  ```
7
7
 
8
+ ```link :link_with_vars_with_spaces
9
+ vars:
10
+ test: "1 2 3"
11
+ ```
12
+
8
13
  ::: Set variable ALPHA in a Vars block
9
14
  For each environment variable named in block,
10
15
  append an inherited line that assigns the variable the specified value.
@@ -99,3 +104,29 @@ block: display_TIMESTAMP
99
104
  source bin/colorize_env_vars.sh
100
105
  colorize_env_vars '' TIMESTAMP
101
106
  ```
107
+
108
+ ::: Load file matching glob pattern into inherited lines
109
+ Load (do not evaluate) and append to inherited lines.
110
+ ```link :load_glob_load1*
111
+ load: examples/load1*.sh
112
+ ```
113
+ ```link :load_glob_load*
114
+ load: examples/load*.sh
115
+ ```
116
+ ```link :load_glob_fail
117
+ load: examples/fail*
118
+ ```
119
+ ```link :load_glob_with_format
120
+ load: "%{home}/examples/load*.sh"
121
+ ```
122
+
123
+ ```link :save_glob_load*
124
+ save: examples/*.sh
125
+ ```
126
+
127
+ ```link :save_glob_*
128
+ save: examples/*.sh
129
+ ```
130
+ ```link :load_glob_*
131
+ load: examples/*.sh
132
+ ```
data/examples/llm.md ADDED
@@ -0,0 +1,54 @@
1
+ 1. show practical examples for three important Bash commands.
2
+ 2. the commands must rely only on resources created and deleted in the example
3
+
4
+ Let's create practical examples for three important Bash commands where all resources are created and deleted within the examples. The commands we'll use are `touch` (to create a file), `echo` (to write to a file), and `rm` (to delete a file).
5
+
6
+ ### 1. `touch` - Create an Empty File
7
+
8
+ **Purpose**: `touch` is used to create an empty file or update the timestamp of an existing file.
9
+
10
+ **Example**: Create an empty file named `example.txt`.
11
+
12
+ ```bash
13
+ touch example.txt
14
+ ```
15
+
16
+ ### 2. `echo` - Write to a File
17
+
18
+ **Purpose**: `echo` is used to display a line of text. Combined with redirection, it can write text to a file.
19
+
20
+ **Example**: Write "Hello, world!" to `example.txt`.
21
+
22
+ ```bash
23
+ echo "Hello, world!" > example.txt
24
+ ```
25
+
26
+ ### 3. `rm` - Remove a File
27
+
28
+ **Purpose**: `rm` is used to remove files or directories.
29
+
30
+ **Example**: Delete the `example.txt` file.
31
+
32
+ ```bash
33
+ rm example.txt
34
+ ```
35
+
36
+ **Combined Script**: To see all these commands in action, you can create a script that executes them sequentially:
37
+
38
+ ```bash
39
+ #!/bin/bash
40
+
41
+ # Create an empty file
42
+ touch example.txt
43
+
44
+ # Write text to the file
45
+ echo "Hello, world!" > example.txt
46
+
47
+ # Display the file content
48
+ cat example.txt
49
+
50
+ # Remove the file
51
+ rm example.txt
52
+ ```
53
+
54
+ **Note**: After this script runs, `example.txt` is created, written to, displayed, and then deleted, ensuring that no external resources are used or left behind.
data/lib/find_files.rb CHANGED
@@ -22,7 +22,7 @@
22
22
  # Example:
23
23
  # find_files('version.rb', ['lib/**', 'spec'])
24
24
  # # This might return file paths like ['lib/markdown_exec/version.rb', 'spec/version_spec.rb'].
25
- def find_files(pattern, paths)
25
+ def find_files(pattern, paths = ['', Dir.pwd])
26
26
  matched_files = []
27
27
 
28
28
  paths.each do |path_with_wildcard|
@@ -65,7 +65,6 @@ class TestFindFiles < Minitest::Test
65
65
  expected_files = [
66
66
  'lib/cli.rb',
67
67
  'lib/colorize.rb',
68
- 'lib/dev/llm.rb',
69
68
  'lib/dev/watchfile.sh',
70
69
  'lib/markdown_exec.rb',
71
70
  'lib/markdown_exec/version.rb'