markdown_exec 1.8.5 → 1.8.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: 4e802d2af4a779aad7091b20ab189a4c324f15f53643880758b7aac76549ba49
4
- data.tar.gz: 2d6f910706bd10232f8bb87313364f671d3871e06382d57dd6248f07c4e497f2
3
+ metadata.gz: 83a04f06ad7f74d2557e1967ae424a8b5f8b08e9ddbbad10091ab6612f94c106
4
+ data.tar.gz: 54a9b79333781bb540ce1e37f686bf132d437c2ab5475c6cd64c40b3f821935e
5
5
  SHA512:
6
- metadata.gz: c0e4b6ff95bccd281e078eb934d3660c52c28530ae12694c81030b3254de468b24d1d93e2e4d68b4d1163be68de029750930f3de0c3034154b05afde6ac9b42a
7
- data.tar.gz: 85e260930e3d097e7028ae16cfeb7905fa702accd1fe2bb5b27fdb817d301be10259069be7c7e99f4af5258efbc7be5867d82834cee68bdc8d4e6485592f821e
6
+ metadata.gz: 4106f3dc27781398aee563bba15355b05f67a118170da36e9c1c51b776ec7549576ee162b090a33a3da278694438a66746d2f4c31384315929eca57558c5ca7a
7
+ data.tar.gz: d46fa757bcfbee2fbfdebee46050ff579d4cd050a3203c887db47a5de4cc275986308cd056ef264947f1d7f239b717a8617b2a51218594f85cd10b27d14156bf
data/.pryrc CHANGED
@@ -1,4 +1,3 @@
1
- binding.pry
2
1
  if defined?(PryByebug)
3
2
  Pry.config.pager = false
4
3
  Pry.commands.alias_command 'c', 'continue'
data/.rubocop.yml CHANGED
@@ -14,8 +14,6 @@ Layout/LineContinuationLeadingSpace:
14
14
  Enabled: false
15
15
 
16
16
  Layout/LineLength:
17
- # Max: 78
18
- # Max: 80
19
17
  Max: 96
20
18
 
21
19
  Lint/Debugger:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
+ ## [1.8.7] - 2023-12-31
2
+
1
3
  # Changelog
2
4
 
5
+ ### Added
6
+
7
+ - Option for block name that presents the menu.
8
+ - Options for decorating inherited lines in the menu.
9
+ - Options for parse and display of heading levels 1, 2, and 3.
10
+
11
+ ### Changed
12
+
13
+ - Bypass chrome blocks when collecting dependencies.
14
+
15
+ ## [1.8.6] - 2023-12-25
16
+
17
+ ### Added
18
+
19
+ - Default path for find command.
20
+
21
+ ### Changed
22
+
23
+ - Refactor command-line processing.
24
+
3
25
  ## [1.8.5] - 2023-12-22
4
26
 
5
27
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (1.8.5)
4
+ markdown_exec (1.8.7)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -13,7 +13,7 @@ __filedirs_all()
13
13
  }
14
14
 
15
15
  _mde_echo_version() {
16
- echo "1.8.5"
16
+ echo "1.8.7"
17
17
  }
18
18
 
19
19
  _mde() {
@@ -54,6 +54,8 @@ _mde() {
54
54
 
55
55
  -?) COMPREPLY="''"; return 0 ;;
56
56
 
57
+ --find-path) COMPREPLY="''"; return 0 ;;
58
+
57
59
  --how) COMPREPLY="''"; return 0 ;;
58
60
 
59
61
  -?) COMPREPLY="''"; return 0 ;;
@@ -92,7 +94,7 @@ _mde() {
92
94
  # present matching option names
93
95
  #
94
96
  if [[ ${cur} == -* ]] ; then
95
- 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" "--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")
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")
96
98
  COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
97
99
 
98
100
  return 0
@@ -133,6 +135,8 @@ _mde() {
133
135
 
134
136
  -?) COMPREPLY=".FIND."; return 0 ;;
135
137
 
138
+ --find-path) COMPREPLY=".FIND_PATH."; return 0 ;;
139
+
136
140
  --how) COMPREPLY=".HOW."; return 0 ;;
137
141
 
138
142
  -?) COMPREPLY=".HOW."; return 0 ;;
@@ -174,4 +178,4 @@ _mde() {
174
178
 
175
179
  complete -o filenames -o nospace -F _mde mde
176
180
  # _mde_echo_version
177
- # echo "Updated: 2023-12-22 22:55:35 UTC"
181
+ # echo "Updated: 2023-12-31 17:23:18 UTC"
data/examples/linked.md CHANGED
@@ -1,6 +1,7 @@
1
1
  Demonstrate setting a variable interactively for use in generated scripts.
2
2
 
3
3
  ```opts :(document_options)
4
+ dump_inherited_lines: true
4
5
  pause_after_script_execution: false
5
6
  user_must_approve: false
6
7
  ```
@@ -15,6 +16,15 @@ block: display_variable
15
16
  VARIABLE=A
16
17
  ```
17
18
 
19
+ ```link :set_to_A_eval +(set_to_A_eval)
20
+ block: display_variable
21
+ eval: true
22
+ ```
23
+
24
+ ```bash :(set_to_A_eval)
25
+ echo VARIABLE=A
26
+ ```
27
+
18
28
  ::: Set VARIABLE to "B"
19
29
 
20
30
  ```link :set_to_B +(set_to_B)
@@ -25,6 +35,15 @@ block: display_variable
25
35
  VARIABLE=B
26
36
  ```
27
37
 
38
+ ```link :set_to_B_eval +(set_to_B_eval)
39
+ block: display_variable
40
+ eval: true
41
+ ```
42
+
43
+ ```bash :(set_to_B_eval)
44
+ echo VARIABLE=B
45
+ ```
46
+
28
47
  ::: Display value of VARIABLE
29
48
 
30
49
  ```bash :display_variable
data/examples/linked1.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Demo document linking
2
2
 
3
+ ```opts :(document_options)
4
+ dump_inherited_lines: true
5
+ pause_after_script_execution: false
6
+ user_must_approve: false
7
+ ```
8
+
3
9
  ::: * This is document 1 *
4
10
  ::: This document links to a matching document to demonstrate navigation between documents.
5
11
 
@@ -15,6 +21,10 @@ colorize_env_vars 'vars for page3' PAGE3_VAR_VIA_INHERIT page3_var_via_environme
15
21
  PAGE2_VAR_VIA_INHERIT=for_page2_from_page1_via_inherited_code_blocks
16
22
  ```
17
23
 
24
+ ```link :linked2 +(vars2)
25
+ file: examples/linked2.md
26
+ ```
27
+
18
28
  ```link :(linked2) +(vars2)
19
29
  file: examples/linked2.md
20
30
  ```
data/examples/linked2.md CHANGED
@@ -20,6 +20,10 @@ colorize_env_vars 'vars for page3' PAGE3_VAR_VIA_INHERIT page3_var_via_environme
20
20
  PAGE3_VAR_VIA_INHERIT=for_page3_from_page2_via_inherited_code_blocks
21
21
  ```
22
22
 
23
+ ```link :linked3 +(vars3)
24
+ file: examples/linked3.md
25
+ ```
26
+
23
27
  ```link :(linked3) +(vars3)
24
28
  file: examples/linked3.md
25
29
  ```
data/examples/opts.md CHANGED
@@ -1,14 +1,18 @@
1
1
  # Demo configuring options
2
+ ## H2
3
+ ### H3
2
4
 
3
5
  ::: These Opts blocks set the color of a couple of menu options to demonstrate the live update of options.
4
6
 
5
- ```opts :opts1
7
+ ```opts
8
+ # color scheme 1
6
9
  menu_divider_color: yellow
7
10
  menu_note_match: "^ *(?<line>.+?) *$"
8
11
  menu_task_color: fg_rgb_255_63_255
9
12
  ```
10
13
 
11
- ```opts :opts2
14
+ ```opts
15
+ # color scheme 2
12
16
  menu_divider_color: red
13
17
  menu_note_color: yellow
14
18
  menu_note_match: "^\\+ +(?<line>.+?) *$"
@@ -27,3 +31,21 @@ note 1
27
31
  note 2 ends with /
28
32
  / note 3 starts with /
29
33
  note 4
34
+
35
+ ::: These options toggle the dump of debug information.
36
+
37
+ ```opts
38
+ dump_blocks_in_file: true # Dump BlocksInFile (stage 1)
39
+ dump_delegate_object: true # Dump @delegate_object
40
+ dump_inherited_lines: true # Dump inherited lines
41
+ dump_menu_blocks: true # Dump MenuBlocks (stage 2)
42
+ dump_selected_block: true # Dump selected block
43
+ ```
44
+
45
+ ```opts
46
+ dump_blocks_in_file: false # Dump BlocksInFile (stage 1)
47
+ dump_delegate_object: false # Dump @delegate_object
48
+ dump_inherited_lines: false # Dump inherited lines
49
+ dump_menu_blocks: false # Dump MenuBlocks (stage 2)
50
+ dump_selected_block: false # Dump selected block
51
+ ```
@@ -21,11 +21,7 @@ class AnsiFormatter
21
21
  (data&.map do |item|
22
22
  scan_and_process_multiple_substrings(item, highlight, plain_color_sym,
23
23
  highlight_color_sym).join
24
- # color_sym = highlight.include?(item) ? highlight_color_sym : c
25
- # string_send_color(item, color_sym)
26
- end || []) #.join
27
- # formatted_deps
28
- # "#{line_prefix}#{string_send_color(label, highlight_color_sym)}#{line_postfix}\n" + formatted_deps.join("\n")
24
+ end || [])
29
25
  end
30
26
 
31
27
  # Function to scan a string and process its segments based on multiple substrings
@@ -6,15 +6,9 @@
6
6
  # version 2023-10-03
7
7
 
8
8
  require 'fileutils'
9
+ require_relative 'constants'
9
10
  require_relative 'exceptions'
10
11
 
11
- # a struct to hold the data for a single line
12
- NestedLine = Struct.new(:text, :depth) do
13
- def to_s
14
- text
15
- end
16
- end
17
-
18
12
  ##
19
13
  # The CachedNestedFileReader class provides functionality to read file lines with the ability
20
14
  # to process '#import filename' directives. When such a directive is encountered in a file,
data/lib/constants.rb CHANGED
@@ -3,12 +3,20 @@
3
3
 
4
4
  # encoding=utf-8
5
5
 
6
+ require_relative 'block_types'
7
+
6
8
  class ExecutionStreams
7
9
  StdErr = :stderr
8
10
  StdIn = :stdin
9
11
  StdOut = :stdout
10
12
  end
11
13
 
14
+ IndexedLine = Struct.new(:index, :line) do
15
+ def to_s
16
+ line
17
+ end
18
+ end
19
+
12
20
  class LoadFile
13
21
  Load = true
14
22
  Reuse = false
@@ -34,6 +42,13 @@ class MenuState
34
42
  EXIT = :exit
35
43
  end
36
44
 
45
+ # a struct to hold the data for a single line
46
+ NestedLine = Struct.new(:text, :depth) do
47
+ def to_s
48
+ text
49
+ end
50
+ end
51
+
37
52
  # selected block and subsequent menu state
38
53
  #
39
54
  SelectedBlockMenuState = Struct.new(:block, :state)
@@ -44,3 +59,5 @@ SHELL_COLOR_OPTIONS = {
44
59
  BlockType::OPTS => :menu_opts_color,
45
60
  BlockType::VARS => :menu_vars_color
46
61
  }.freeze
62
+
63
+ ### Struct.new(:state, :block)
@@ -4,6 +4,7 @@
4
4
  # encoding=utf-8
5
5
 
6
6
  require 'find'
7
+ require_relative 'constants'
7
8
 
8
9
  def format_and_highlight_hash(
9
10
  data,
@@ -89,12 +90,6 @@ def format_and_highlight_lines(
89
90
  highlight_color_sym)}#{line_postfix}\n" + formatted_deps.join("\n")
90
91
  end
91
92
 
92
- IndexedLine = Struct.new(:index, :line) do
93
- def to_s
94
- line
95
- end
96
- end
97
-
98
93
  # Class DirectorySearcher
99
94
  # This class provides methods to search for a specified pattern
100
95
  # in directory names, file names, and contents of files within given paths.
data/lib/filter.rb CHANGED
@@ -93,9 +93,7 @@ module MarkdownExec
93
93
  !!(shell =~ /#{options[:select_by_shell_regex]}/)
94
94
  end
95
95
 
96
- unless shell.present? && options[:exclude_by_shell_regex].present?
97
- return
98
- end
96
+ return unless shell.present? && options[:exclude_by_shell_regex].present?
99
97
 
100
98
  filters[:shell_exclude] =
101
99
  !!(shell =~ /#{options[:exclude_by_shell_regex]}/)
@@ -178,6 +176,20 @@ module MarkdownExec
178
176
  options[pattern].present? && fcb[:oname] =~ /#{options[pattern]}/
179
177
  end
180
178
  end
179
+
180
+ # Yields to the provided block with specified parameters if certain conditions are met.
181
+ # The method checks if a block is given, if the selected_messages include :blocks,
182
+ # and if the fcb_select? method returns true for the given fcb.
183
+ #
184
+ # @param fcb [Object] The object to be evaluated and potentially passed to the block.
185
+ # @param selected_messages [Array<Symbol>] A collection of message types, one of which must be :blocks.
186
+ # @param block [Block] A block to be called if conditions are met.
187
+ def self.yield_to_block_if_applicable(fcb, selected_messages, configuration = {}, &block)
188
+ if block_given? && selected_messages.include?(:blocks) &&
189
+ fcb_select?(configuration, fcb)
190
+ block.call :blocks, fcb
191
+ end
192
+ end
181
193
  end
182
194
  end
183
195