markdown_exec 1.3.3.5 → 1.3.7

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: 6c3c3615fdab637a5df4f5616d9c07f277e499f1f8de3a5fa70dda72ae2cb0b3
4
- data.tar.gz: b7cb1a2abfeaf114f25aac530d316aa181ca1464af5426e5b1f0b5aaa3538320
3
+ metadata.gz: f4a8eee857b22f6ce92a03144f7eb68a2c8298e8888f0b538ff2bfb710aeb790
4
+ data.tar.gz: 651842b64a4ec92610d8f4ea00e002ffeaba952838d9142eb7da845edd2c7594
5
5
  SHA512:
6
- metadata.gz: 2bf8576d03115f6d769e961091d5a33bfc65fafdca8f2f282895230836670fb741a34a94beac49dc1008faa6ea293b3f882721b56f69fcbb697e4c011143ab7a
7
- data.tar.gz: a53fecba24f39b4e5234164e4eada14a95b8c078111d50572c9094f5171671f3d79efc20065caaf67a1b7bce2f774c9cb52bb5c1bbbf8855678d317a3561bbef
6
+ metadata.gz: afc863af78e1b75eec616e855625d1d5e8cae8a750bc51377c7110a8ed630d82a215242b2a09f8a49fdd549be7b57e96567c3b6bc384b61313feffa404600516
7
+ data.tar.gz: 41cd17fff38d663fd9b052496ec1f37d40ac8df2929d28f2ffd2e0b7fee5c002a982f4ed01618e82aa4c51dc71b85032d3772d8667727f63ec75a7795ccfe1dc
data/.rubocop.yml CHANGED
@@ -77,6 +77,9 @@ Style/MultilineBlockChain:
77
77
  Style/SlicingWithRange:
78
78
  Enabled: false
79
79
 
80
+ Style/SpecialGlobalVars:
81
+ Enabled: false
82
+
80
83
  Style/StringLiterals:
81
84
  Enabled: true
82
85
  EnforcedStyle: single_quotes
data/CHANGELOG.md CHANGED
@@ -1,279 +1,27 @@
1
1
  # Changelog
2
2
 
3
- ## [ToDo]
4
- `reek lib/markdown_exec.rb --config .reek`
3
+ ## [1.3.6] - 2023-10-15
5
4
 
6
- - user settings
7
- - hidden w , w/o () in names
8
- - fix regexp in pathnames
9
-
10
- - tree display
11
-
12
- - [ ] mde options, user prompt, in md file or included file
13
-
14
- - [ ] include blocks from local md file
15
-
16
- - execute? yes/no/save/clipboard + record/edit/history
17
-
18
- - [ ] list, view saved output
19
-
20
- - completion
21
- - [ ] include blocks in md file
22
-
23
- - [ ] ruby gem data model
24
-
25
- - [ ] extract yaml block into stdout
26
- - [ ] extract json block into stdout
27
-
28
- - [ ] import yaml, json data into environment
29
-
30
- - [ ] yq filter with imported or named yaml, json data
31
-
32
- - [ ] yaml dump of options w/ detail
5
+ ### Added
33
6
 
34
- - [ ] re-exec last script v re-run named block in last script
35
- - [ ] repeat to reload last doc and block
36
- - [ ] option to log blended, timeline; stdin, stdout, stderr; labels: prefix and blocks
37
- - [ ] ren logged_stdout_filename_prefix to saved_stdout_filename_prefix
38
- - [ ] ignore '#' in fenced code blocks
39
-
40
- - [ ] write named block, can be included
41
- - [ ] file type per block type
42
- - [ ] file name per block name or specified in quotes ("")
43
- - [ ] overwrite-rules for writing blocks
44
- - [ ] erase-rules for written blocks
45
- - [ ] files to create named at top of script to execute; written prior to start of script
46
-
47
- - [ ] tab completion example ascii demo
48
-
49
- - [ ] parameters or (env vars) in menu
50
- - [ ] config menu or read env vars
51
- - [ ] enable/disable script, output saving per file
52
- - [ ] keep values between runs so same env vars are not prompted
53
-
54
- - [ ] option to list full menu
55
-
56
- - [ ] task confirmation block option or bash template, env names
57
-
58
- - [ ] configuration block `mde_config` anywhere in file
59
- - [ ] configuration block `mde_config` anywhere in folder config file
60
- ```yaml :(mde_config)```
61
- - [x] fix execution stdin, stdout to allow for ask function
62
- - [ ] fix execution stdin, stdout to allow for tty-prompt
63
- - [ ] accept stdin as filename `-`
64
- - [ ] fix
65
- $ bin/mde
66
- Choose a file: * Exit
67
- No blocks found.
68
- Choose a block: * Exit
69
-
70
- - [ ] accept `!` shell execute command at prompt
71
- - [ ] menu response: re-exec last saved script (like mde --select-recent-script)
72
-
73
- - [ ] process shebang in markdown
74
- - [ ] ignore shebang in markdown in rest of processing
75
- - [! ] search for document in path
76
- - [! ] search for document in custom path
77
- - [ ] doc use of `#!/usr/bin/env mde`
78
- - [ ] command to export each command to file, menu for list
79
-
80
- - [ ] option blocks to exclude by shell
81
-
82
- - #+BEGIN_SRC sh :results silent
83
- #+END_SRC
84
-
85
- - [ ] requires extra CRs after ctrl-C of earlier script?
86
-
87
- - [! ] silent for `mde file block -q 0`
88
- - [! ] define for block: env var name, prompt if missing, default value
89
- - [! ] display env vars in menu
90
- - [! ] mde md -- --arg1 --arg2
91
-
92
- - [! ] display tasks (regex) similar to current `:::`
93
- diff done, tbd, important, progress, note, timestamp
94
-
95
- - [! ] redo block selection logic in
96
- def self.fcb_select?(options, fcb)
97
- used for selecting for 1) menu, 2) script composition, 3) list?
98
- layers 1) block name in cli, 2) required blocks, 3) hidden, 4) selected, 5) excluded, 6) also per shell name
99
- - [ ] opt to add block name as comment in bash script
100
- - [ ] marker in file separating VARS from CODE in bash script
101
- [ ] VARS, CODE section separately sourceable/executable
102
- - [ ] config to hide unnamed bash blocks
103
- - [ ] default to No after Save of script
104
-
105
- - [ ] block into file; template
106
-
107
- - [! ] option to use most recent named block if dupiclate, currently appends same-name blocks but lists twice in menu
108
-
109
- - [! ] improve error when imported file is not found
110
-
111
- - [ ] decorations for import block
112
- prefix line(s)
113
- inline replacements
114
- suffix line(s)
115
-
116
- ```ruby
117
- ##
118
- # Replace substrings in an input string based on a regular expression pattern
119
- # with named capture groups. The replacements are formatted using a provided
120
- # format string. Additional context can be provided to supplement or override
121
- # the named captures in the format string.
122
- #
123
- # @param input_str [String] The input string to process.
124
- # @param regex [Regexp] The regular expression pattern with named capture groups.
125
- # @param format_str [String] The format string for sprintf.
126
- # @param context [Hash] Additional context to supplement or override named captures.
127
- #
128
- # @return [String] The processed string after replacements.
129
- #
130
- # def gsub_format(input_str, regex, format_str, context: {})
131
- # input_str.gsub(regex) do
132
- # captures_hash = $~.names.each_with_object({}) do |name, hash|
133
- # hash[name.to_sym] = $~[name]
134
- # end
135
-
136
- # ### add import file name, line number, line, to captures_hash, chain
137
- # # $~ (MatchData) - MatchData object created from the match; thread-local and frame-local. - English - $LAST_MATCH_INFO.
138
- # # $& (Matched Substring) - The matched string. - English - $MATCH.
139
- # # $` (Pre-Match Substring) - The string to the left of the match. - English - $PREMATCH.
140
- # # $' (Post-Match Substring) - The string to the right of the match. - English - $POSTMATCH.
141
- # # $+ (Last Matched Group) - The last group matched. - English - $LAST_PAREN_MATCH.
142
-
143
- # sprintf(format_str, context.merge(captures_hash))
144
- # end
145
- # end
146
-
147
- class Regexp
148
- def gsub_format(input_str, format_str, context: {})
149
- input_str.gsub(self) do
150
- captures_hash = $~.names.each_with_object({}) do |name, hash|
151
- hash[name.to_sym] = $~[name]
152
- end
153
-
154
- # ### add import file name, line number, line, to captures_hash, chain
155
- # # $~ (MatchData) - MatchData object created from the match; thread-local and frame-local. - English - $LAST_MATCH_INFO.
156
- # # $& (Matched Substring) - The matched string. - English - $MATCH.
157
- # # $` (Pre-Match Substring) - The string to the left of the match. - English - $PREMATCH.
158
- # # $' (Post-Match Substring) - The string to the right of the match. - English - $POSTMATCH.
159
- # # $+ (Last Matched Group) - The last group matched. - English - $LAST_PAREN_MATCH.
160
-
161
- # # Add file name, line number, line to captures_hash
162
- # captures_hash[:file_name] = $~.pre_match.split("\n").last
163
- # captures_hash[:line_number] = $~.pre_match.count("\n") + 1
164
- # captures_hash[:line] = $&
165
-
166
- sprintf(format_str, context.merge(captures_hash))
167
- end
168
- end
169
- end
170
-
171
- # # Example usage:
172
- # str = "123 example"
173
- # re = /(?<foo>\d+) (?<bar>\w+)/
174
- # fmt = "%<foo>d : %<bar>s"
175
- # new_str = gsub_format(str, re, fmt)
176
- # puts new_str # Outputs: 123 : example
177
-
178
- require 'minitest/autorun'
179
- require_relative 'path_to_your_file' # Make sure to replace this with the path to the file containing the function
180
-
181
- class ReplaceWithFormatTest < Minitest::Test
182
- def test_basic_replacement
183
- input_str = "123 example"
184
- re = /(?<foo>\d+) (?<bar>\w+)/
185
- fmt = "%<foo>d : %<bar>s"
186
-
187
- result = gsub_format(input_str, re, fmt)
188
-
189
- assert_equal "123 : example", result
190
- end
191
-
192
- def test_no_match
193
- input_str = "This is a test."
194
- re = /(?<foo>\d+) (?<bar>\w+)/
195
- fmt = "%<foo>d : %<bar>s"
196
-
197
- result = gsub_format(input_str, re, fmt)
198
-
199
- assert_equal "This is a test.", result
200
- end
201
-
202
- def test_multiple_matches
203
- input_str = "123 example, 456 test"
204
- re = /(?<foo>\d+) (?<bar>\w+)/
205
- fmt = "[%<foo>d %<bar>s]"
206
-
207
- result = gsub_format(input_str, re, fmt)
208
-
209
- assert_equal "[123 example], [456 test]", result
210
- end
211
-
212
- def test_different_named_captures
213
- input_str = "Jane is 25 years old."
214
- re = /(?<name>\w+) is (?<age>\d+)/
215
- fmt = "%<name>s's age is %<age>d"
216
-
217
- result = gsub_format(input_str, re, fmt)
218
-
219
- assert_equal "Jane's age is 25", result
220
- end
221
-
222
- def test_with_context
223
- input_str = "Jane is 25 years old."
224
- re = /(?<name>\w+) is (?<age>\d+)/
225
- fmt = "%<name>s's age is %<age>d and she lives in %<city>s"
226
-
227
- result = gsub_format(input_str, re, fmt, context: { city: "New York" })
228
-
229
- assert_equal "Jane's age is 25 and she lives in New York", result
230
- end
231
- end
232
-
233
- require 'minitest/autorun'
234
- require_relative 'path_to_your_file' # Ensure this path is correct
235
-
236
- class RegexpGsubFormatTest < Minitest::Test
237
- def test_basic_replacement
238
- input_str = "123 example"
239
- re = /(?<foo>\d+) (?<bar>\w+)/
240
- fmt = "%<foo>d : %<bar>s"
241
-
242
- result = re.gsub_format(input_str, fmt)
243
-
244
- assert_equal "123 : example", result
245
- end
246
-
247
- # ... [other tests remain mostly unchanged, just updating the method call]
248
-
249
- def test_with_context
250
- input_str = "Jane is 25 years old."
251
- re = /(?<name>\w+) is (?<age>\d+)/
252
- fmt = "%<name>s's age is %<age>d and she lives in %<city>s"
253
-
254
- result = re.gsub_format(input_str, fmt, context: { city: "New York" })
255
-
256
- assert_equal "Jane's age is 25 and she lives in New York", result
257
- end
258
- end
259
-
260
- ```
7
+ - Option to inhibit display of menu decorations/chrome
8
+ - Options for tasks
261
9
 
262
10
  ## [1.3.5] - 2023-10-05
263
11
 
264
12
  ### Changed
265
13
 
266
- - Fix display of menu dividers.
14
+ - Fix display of menu dividers
267
15
 
268
16
  ## [1.3.3] - 2023-10-03
269
17
 
270
18
  ### Added
271
19
 
272
- - Nest scripts by using an `import` directive.
20
+ - Nest scripts by using an `import` directive
273
21
 
274
22
  ### Changed
275
23
 
276
- - Convert constants for block selection into options.
24
+ - Convert constants for block selection into options
277
25
 
278
26
  ## [1.3.2] - 2022-11-12
279
27
 
@@ -307,8 +55,8 @@ end
307
55
  eg `export fruit_summary=$(yq e '[.fruit.name,.fruit.price]' fruit.yml)`
308
56
  for invocation `%(summarize_fruits <fruit.yml >fruit_summary)`
309
57
  and transformation `[.fruit.name,.fruit.price]`
310
- - Option to extract document text and display it as disabled items in-line with the blocks in the selection menu.
311
- Add options for constants used in parsing.
58
+ - Option to extract document text and display it as disabled items in-line with the blocks in the selection menu
59
+ Add options for constants used in parsing
312
60
  - [x] yaml processing
313
61
  - ```yaml :(make_fruit_file) >fruit.yml```
314
62
  write to: fruit.yml
@@ -323,7 +71,7 @@ end
323
71
  ### Changed
324
72
 
325
73
  - Refactoring
326
- - Run-time menu in YAML file.
74
+ - Run-time menu in YAML file
327
75
  - Tap module initialization
328
76
 
329
77
  ## [1.2.0] - 2022-06-11
@@ -333,8 +81,8 @@ end
333
81
  - Options
334
82
  - Display document name in block selection menu
335
83
  - Display headings (levels 1,2,3) in block selection menu
336
- - Trap Ctrl-C (SIGTERM) while script is executing.
337
- Completes MDE processes such as saving output and reporting results.
84
+ - Trap Ctrl-C (SIGTERM) while script is executing
85
+ Completes MDE processes such as saving output and reporting results
338
86
 
339
87
  ### Changed
340
88
 
@@ -344,11 +92,11 @@ end
344
92
 
345
93
  ### Added
346
94
 
347
- - Post-install instructions to add tab completions permanently to the shell.
95
+ - Post-install instructions to add tab completions permanently to the shell
348
96
 
349
97
  ### Changed
350
98
 
351
- - Improve handling of threads ending while executing scripts.
99
+ - Improve handling of threads ending while executing scripts
352
100
 
353
101
  ## [1.1.0] - 2022-05-21
354
102
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (1.3.3.5)
4
+ markdown_exec (1.3.7)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)