marked-conductor 1.0.13 → 1.0.15

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.
data/html/created.rid CHANGED
@@ -1,4 +1,4 @@
1
- Fri, 24 May 2024 13:12:53 -0500
1
+ Sat, 25 May 2024 11:14:11 -0500
2
2
  README.rdoc Sun, 28 Apr 2024 13:21:34 -0500
3
3
  lib/conductor.rb Fri, 24 May 2024 12:23:17 -0500
4
4
  lib/conductor/array.rb Sat, 27 Apr 2024 11:54:28 -0500
@@ -7,9 +7,9 @@ lib/conductor/command.rb Sat, 27 Apr 2024 11:54:28 -0500
7
7
  lib/conductor/condition.rb Mon, 29 Apr 2024 09:19:15 -0500
8
8
  lib/conductor/config.rb Sat, 27 Apr 2024 11:54:28 -0500
9
9
  lib/conductor/env.rb Mon, 29 Apr 2024 09:28:21 -0500
10
- lib/conductor/filter.rb Fri, 24 May 2024 13:02:38 -0500
10
+ lib/conductor/filter.rb Sat, 25 May 2024 11:13:46 -0500
11
11
  lib/conductor/hash.rb Sat, 27 Apr 2024 11:54:28 -0500
12
12
  lib/conductor/script.rb Sun, 28 Apr 2024 16:21:49 -0500
13
- lib/conductor/string.rb Mon, 29 Apr 2024 09:46:03 -0500
14
- lib/conductor/version.rb Wed, 01 May 2024 13:06:29 -0500
13
+ lib/conductor/string.rb Sat, 25 May 2024 10:58:38 -0500
14
+ lib/conductor/version.rb Sat, 25 May 2024 06:41:33 -0500
15
15
  bin/conductor Fri, 24 May 2024 12:39:06 -0500
@@ -1 +1 @@
1
- var search_data = {"index":{"searchIndex":["array","conductor","command","condition","config","env","script","falseclass","filter","hash","object","string","trueclass","add_comment()","add_mmd()","add_yaml()","args=()","args=()","bool?()","bool?()","bool?()","bool_to_symbol()","clean_condition()","conduct()","create_config()","date?()","delete_meta()","delete_mmd()","delete_yaml()","env()","execute_track()","has_comment?()","load_test_env()","meta?()","meta_insert_point()","meta_type()","new()","new()","new()","new()","new()","normalize_filter()","number?()","operator_to_symbol()","parse_condition()","path=()","path=()","process()","replace()","replace_all()","run()","run()","sample_config()","set_meta()","split_booleans()","split_condition()","stdin()","strip_meta()","strip_time()","symbolize_keys()","symbolize_keys()","symbolize_keys!()","symbolize_keys!()","test_condition()","test_meta()","test_operator()","test_pandoc()","test_string()","test_tree()","test_truthy()","test_type()","test_yaml()","time?()","to_bool()","to_bool!()","to_date()","to_day()","to_pattern()","to_rx()","to_s()","true?()","yaml?()","readme"],"longSearchIndex":["array","conductor","conductor::command","conductor::condition","conductor::config","conductor::env","conductor::script","falseclass","filter","hash","object","string","trueclass","string#add_comment()","string#add_mmd()","string#add_yaml()","conductor::command#args=()","conductor::script#args=()","falseclass#bool?()","string#bool?()","trueclass#bool?()","string#bool_to_symbol()","object#clean_condition()","conductor::conduct()","conductor#create_config()","string#date?()","string#delete_meta()","string#delete_mmd()","string#delete_yaml()","conductor::env::env()","conductor::execute_track()","string#has_comment?()","conductor::env::load_test_env()","string#meta?()","string#meta_insert_point()","string#meta_type()","conductor::command::new()","conductor::condition::new()","conductor::config::new()","conductor::script::new()","filter::new()","string#normalize_filter()","string#number?()","conductor::condition#operator_to_symbol()","conductor::condition#parse_condition()","conductor::command#path=()","conductor::script#path=()","filter#process()","string#replace()","string#replace_all()","conductor::command#run()","conductor::script#run()","conductor#sample_config()","string#set_meta()","conductor::condition#split_booleans()","conductor::condition#split_condition()","conductor::stdin()","string#strip_meta()","string#strip_time()","array#symbolize_keys()","hash#symbolize_keys()","array#symbolize_keys!()","hash#symbolize_keys!()","conductor::condition#test_condition()","conductor::condition#test_meta()","conductor::condition#test_operator()","conductor::condition#test_pandoc()","conductor::condition#test_string()","conductor::condition#test_tree()","conductor::condition#test_truthy()","conductor::condition#test_type()","conductor::condition#test_yaml()","string#time?()","string#to_bool()","string#to_bool!()","string#to_date()","string#to_day()","string#to_pattern()","string#to_rx()","conductor::env::to_s()","conductor::condition#true?()","string#yaml?()",""],"info":[["Array","","Array.html","",""],["Conductor","","Conductor.html","","<p>Main Conductor class\n"],["Conductor::Command","","Conductor/Command.html","","<p>Command runner\n"],["Conductor::Condition","","Conductor/Condition.html","",""],["Conductor::Config","","Conductor/Config.html","","<p>Configuration methods\n"],["Conductor::Env","","Conductor/Env.html","","<p>Environment variables\n"],["Conductor::Script","","Conductor/Script.html","","<p>Script runner\n"],["FalseClass","","FalseClass.html","","<p>False class\n"],["Filter","","Filter.html","","<p>String filtering\n"],["Hash","","Hash.html","",""],["Object","","Object.html","",""],["String","","String.html","","<p>String helpers\n<p>String helpers\n"],["TrueClass","","TrueClass.html","","<p>True class\n"],["add_comment","String","String.html#method-i-add_comment","(key, value)",""],["add_mmd","String","String.html#method-i-add_mmd","(key, value)",""],["add_yaml","String","String.html#method-i-add_yaml","(key, value)",""],["args=","Conductor::Command","Conductor/Command.html#method-i-args-3D","(array)",""],["args=","Conductor::Script","Conductor/Script.html#method-i-args-3D","(array)","<p>Set the args array\n<p>@param array The array\n"],["bool?","FalseClass","FalseClass.html#method-i-bool-3F","()",""],["bool?","String","String.html#method-i-bool-3F","()","<p>Test if a string is a boolean\n<p>@return [Boolean] test result\n"],["bool?","TrueClass","TrueClass.html#method-i-bool-3F","()",""],["bool_to_symbol","String","String.html#method-i-bool_to_symbol","()","<p>Convert a string boolean to symbol\n<p>@return [Symbol] symbolized version\n"],["clean_condition","Object","Object.html#method-i-clean_condition","(condition)","<p>Clean up conditions for output\n<p>@param condition The condition\n"],["conduct","Conductor","Conductor.html#method-c-conduct","(tracks, res = nil, condition = nil)","<p>Main function to parse conditions and\n\n<pre>execute actions. Executes recursively for\nsub-tracks.</pre>\n<p>@param …\n"],["create_config","Conductor","Conductor.html#method-i-create_config","(config_file)",""],["date?","String","String.html#method-i-date-3F","()","<p>Test a string to see if it’s a UTC date\n<p>@return [Boolean] test result\n"],["delete_meta","String","String.html#method-i-delete_meta","(key)",""],["delete_mmd","String","String.html#method-i-delete_mmd","(key)",""],["delete_yaml","String","String.html#method-i-delete_yaml","(key)",""],["env","Conductor::Env","Conductor/Env.html#method-c-env","()","<p>Define @env using Marked environment variables\n"],["execute_track","Conductor","Conductor.html#method-c-execute_track","(track)","<p>Execute commands/scripts in the track\n<p>@param track The track\n<p>@return Resulting STDOUT output …\n"],["has_comment?","String","String.html#method-i-has_comment-3F","(key)",""],["load_test_env","Conductor::Env","Conductor/Env.html#method-c-load_test_env","()","<p>Loads a test environment.\n"],["meta?","String","String.html#method-i-meta-3F","()","<p>Test if a string starts with MMD metadata\n<p>@return [Boolean] test result\n"],["meta_insert_point","String","String.html#method-i-meta_insert_point","()",""],["meta_type","String","String.html#method-i-meta_type","()",""],["new","Conductor::Command","Conductor/Command.html#method-c-new","(command)",""],["new","Conductor::Condition","Conductor/Condition.html#method-c-new","(condition)","<p>Initializes the given condition.\n<p>@param condition The condition\n"],["new","Conductor::Config","Conductor/Config.html#method-c-new","()",""],["new","Conductor::Script","Conductor/Script.html#method-c-new","(script)","<p>Initializes the given script.\n<p>@param script The script/path\n"],["new","Filter","Filter.html#method-c-new","(filter)",""],["normalize_filter","String","String.html#method-i-normalize_filter","()",""],["number?","String","String.html#method-i-number-3F","()","<p>Test if a string is a number\n<p>@return [Boolean] test result\n"],["operator_to_symbol","Conductor::Condition","Conductor/Condition.html#method-i-operator_to_symbol","(operator)",""],["parse_condition","Conductor::Condition","Conductor/Condition.html#method-i-parse_condition","()",""],["path=","Conductor::Command","Conductor/Command.html#method-i-path-3D","(path)",""],["path=","Conductor::Script","Conductor/Script.html#method-i-path-3D","(path)","<p>Set script path, automatically expands/tests\n<p>@param path The path\n"],["process","Filter","Filter.html#method-i-process","()",""],["replace","String","String.html#method-i-replace","(regex, pattern)",""],["replace_all","String","String.html#method-i-replace_all","(regex, pattern)",""],["run","Conductor::Command","Conductor/Command.html#method-i-run","()",""],["run","Conductor::Script","Conductor/Script.html#method-i-run","()","<p>Execute the script\n<p>@return [String] script results (STDOUT)\n"],["sample_config","Conductor","Conductor.html#method-i-sample_config","()",""],["set_meta","String","String.html#method-i-set_meta","(key, value, style: :comment)",""],["split_booleans","Conductor::Condition","Conductor/Condition.html#method-i-split_booleans","(condition)","<p>Splits booleans and tests components.\n<p>@param condition The condition to test\n<p>@return [Boolean] …\n"],["split_condition","Conductor::Condition","Conductor/Condition.html#method-i-split_condition","(condition)","<p>Splits a natural language condition.\n<p>@param condition The condition @return [Array] Value, value …\n"],["stdin","Conductor","Conductor.html#method-c-stdin","()",""],["strip_meta","String","String.html#method-i-strip_meta","()",""],["strip_time","String","String.html#method-i-strip_time","()","<p>Remove time from string\n<p>@return [String] string with time removed\n"],["symbolize_keys","Array","Array.html#method-i-symbolize_keys","()",""],["symbolize_keys","Hash","Hash.html#method-i-symbolize_keys","()",""],["symbolize_keys!","Array","Array.html#method-i-symbolize_keys-21","()",""],["symbolize_keys!","Hash","Hash.html#method-i-symbolize_keys-21","()",""],["test_condition","Conductor::Condition","Conductor/Condition.html#method-i-test_condition","(condition)",""],["test_meta","Conductor::Condition","Conductor/Condition.html#method-i-test_meta","(content, value, key, operator)","<p>Test for MultiMarkdown metadata,\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">optionally</span> <span class=\"ruby-identifier\">key</span> <span class=\"ruby-keyword\">and</span> <span class=\"ruby-identifier\">value</span>\n</pre>\n<p>@param content [String] The text content …\n"],["test_operator","Conductor::Condition","Conductor/Condition.html#method-i-test_operator","(value1, value2, operator)","<p>Test operators\n<p>@param value1 Value @param value2 Value to test @param operator …\n"],["test_pandoc","Conductor::Condition","Conductor/Condition.html#method-i-test_pandoc","(content, operator)",""],["test_string","Conductor::Condition","Conductor/Condition.html#method-i-test_string","(val1, val2, operator)","<p>Compare a string based on operator\n<p>@param val1 The string to test against @param val2 …\n"],["test_tree","Conductor::Condition","Conductor/Condition.html#method-i-test_tree","(origin, value, operator)","<p>Test for the existince of a\n\n<pre>file/directory in the parent tree</pre>\n<p>@param origin Starting directory …\n"],["test_truthy","Conductor::Condition","Conductor/Condition.html#method-i-test_truthy","(value1, value2, operator)","<p>Test “truthiness”\n<p>@param value1 Value to test against @param value2 Value to …\n"],["test_type","Conductor::Condition","Conductor/Condition.html#method-i-test_type","(val1, val2, operator)","<p>Test for type of value\n<p>@param val1 value @param val2 value to test against @param …\n"],["test_yaml","Conductor::Condition","Conductor/Condition.html#method-i-test_yaml","(content, value, key, operator)","<p>Test for presence of yaml, optionall for\n\n<pre>a key, optionally for a key&#39;s value</pre>\n<p>@param content Text …\n"],["time?","String","String.html#method-i-time-3F","()","<p>Test a string to see if it includes a time\n<p>@return [Boolean] test result\n"],["to_bool","String","String.html#method-i-to_bool","()","<p>Returns a bool representation of the string.\n<p>@return [Boolean] Bool representation of the object. …\n"],["to_bool!","String","String.html#method-i-to_bool-21","()","<p>Destructive version of #to_bool\n<p>@see #to_bool\n"],["to_date","String","String.html#method-i-to_date","()","<p>Convert a natural language string to a Date\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">object</span>\n</pre>\n<p>@return [Date] Resulting Date object\n"],["to_day","String","String.html#method-i-to_day","(time = :end)",""],["to_pattern","String","String.html#method-i-to_pattern","()",""],["to_rx","String","String.html#method-i-to_rx","()",""],["to_s","Conductor::Env","Conductor/Env.html#method-c-to_s","()","<p>env to string\n<p>@return [String] shell-compatible string representation of @env\n"],["true?","Conductor::Condition","Conductor/Condition.html#method-i-true-3F","()","<p>Tests condition\n<p>@return [Boolean] test result\n"],["yaml?","String","String.html#method-i-yaml-3F","()","<p>Test if string starts with YAML\n<p>@return [Boolean] test result\n"],["README","","README_rdoc.html","","<p>Marked Conductor\n<p>A command line tool that functions as a custom processor handler for Marked 2.\n"]]}}
1
+ var search_data = {"index":{"searchIndex":["array","conductor","command","condition","config","env","script","falseclass","filter","hash","object","string","trueclass","add_comment()","add_mmd()","add_yaml()","append()","args=()","args=()","bool?()","bool?()","bool?()","bool_to_symbol()","clean_condition()","conduct()","create_config()","date?()","delete_meta()","delete_mmd()","delete_yaml()","env()","execute_track()","first_h1()","first_h2()","get_title()","has_comment?()","insert_file()","insert_script()","insert_title()","insert_toc()","load_test_env()","meta?()","meta_insert_point()","meta_type()","new()","new()","new()","new()","new()","normalize_filter()","normalize_include_type()","normalize_position()","number?()","operator_to_symbol()","parse_condition()","path=()","path=()","process()","replace()","replace_all()","run()","run()","sample_config()","set_meta()","split_booleans()","split_condition()","stdin()","strip_meta()","strip_time()","symbolize_keys()","symbolize_keys()","symbolize_keys!()","symbolize_keys!()","test_condition()","test_meta()","test_operator()","test_pandoc()","test_string()","test_tree()","test_truthy()","test_type()","test_yaml()","time?()","title_from_slug()","titleize()","to_bool()","to_bool!()","to_date()","to_day()","to_pattern()","to_rx()","to_s()","true?()","yaml?()","readme"],"longSearchIndex":["array","conductor","conductor::command","conductor::condition","conductor::config","conductor::env","conductor::script","falseclass","filter","hash","object","string","trueclass","string#add_comment()","string#add_mmd()","string#add_yaml()","string#append()","conductor::command#args=()","conductor::script#args=()","falseclass#bool?()","string#bool?()","trueclass#bool?()","string#bool_to_symbol()","object#clean_condition()","conductor::conduct()","conductor#create_config()","string#date?()","string#delete_meta()","string#delete_mmd()","string#delete_yaml()","conductor::env::env()","conductor::execute_track()","string#first_h1()","string#first_h2()","string#get_title()","string#has_comment?()","string#insert_file()","string#insert_script()","string#insert_title()","string#insert_toc()","conductor::env::load_test_env()","string#meta?()","string#meta_insert_point()","string#meta_type()","conductor::command::new()","conductor::condition::new()","conductor::config::new()","conductor::script::new()","filter::new()","string#normalize_filter()","string#normalize_include_type()","string#normalize_position()","string#number?()","conductor::condition#operator_to_symbol()","conductor::condition#parse_condition()","conductor::command#path=()","conductor::script#path=()","filter#process()","string#replace()","string#replace_all()","conductor::command#run()","conductor::script#run()","conductor#sample_config()","string#set_meta()","conductor::condition#split_booleans()","conductor::condition#split_condition()","conductor::stdin()","string#strip_meta()","string#strip_time()","array#symbolize_keys()","hash#symbolize_keys()","array#symbolize_keys!()","hash#symbolize_keys!()","conductor::condition#test_condition()","conductor::condition#test_meta()","conductor::condition#test_operator()","conductor::condition#test_pandoc()","conductor::condition#test_string()","conductor::condition#test_tree()","conductor::condition#test_truthy()","conductor::condition#test_type()","conductor::condition#test_yaml()","string#time?()","string#title_from_slug()","string#titleize()","string#to_bool()","string#to_bool!()","string#to_date()","string#to_day()","string#to_pattern()","string#to_rx()","conductor::env::to_s()","conductor::condition#true?()","string#yaml?()",""],"info":[["Array","","Array.html","",""],["Conductor","","Conductor.html","","<p>Main Conductor class\n"],["Conductor::Command","","Conductor/Command.html","","<p>Command runner\n"],["Conductor::Condition","","Conductor/Condition.html","",""],["Conductor::Config","","Conductor/Config.html","","<p>Configuration methods\n"],["Conductor::Env","","Conductor/Env.html","","<p>Environment variables\n"],["Conductor::Script","","Conductor/Script.html","","<p>Script runner\n"],["FalseClass","","FalseClass.html","","<p>False class\n"],["Filter","","Filter.html","","<p>String filtering\n"],["Hash","","Hash.html","",""],["Object","","Object.html","",""],["String","","String.html","","<p>String helpers\n<p>String helpers\n"],["TrueClass","","TrueClass.html","","<p>True class\n"],["add_comment","String","String.html#method-i-add_comment","(key, value)",""],["add_mmd","String","String.html#method-i-add_mmd","(key, value)",""],["add_yaml","String","String.html#method-i-add_yaml","(key, value)",""],["append","String","String.html#method-i-append","(string)",""],["args=","Conductor::Command","Conductor/Command.html#method-i-args-3D","(array)",""],["args=","Conductor::Script","Conductor/Script.html#method-i-args-3D","(array)","<p>Set the args array\n<p>@param array The array\n"],["bool?","FalseClass","FalseClass.html#method-i-bool-3F","()",""],["bool?","String","String.html#method-i-bool-3F","()","<p>Test if a string is a boolean\n<p>@return [Boolean] test result\n"],["bool?","TrueClass","TrueClass.html#method-i-bool-3F","()",""],["bool_to_symbol","String","String.html#method-i-bool_to_symbol","()","<p>Convert a string boolean to symbol\n<p>@return [Symbol] symbolized version\n"],["clean_condition","Object","Object.html#method-i-clean_condition","(condition)","<p>Clean up conditions for output\n<p>@param condition The condition\n"],["conduct","Conductor","Conductor.html#method-c-conduct","(tracks, res = nil, condition = nil)","<p>Main function to parse conditions and\n\n<pre>execute actions. Executes recursively for\nsub-tracks.</pre>\n<p>@param …\n"],["create_config","Conductor","Conductor.html#method-i-create_config","(config_file)",""],["date?","String","String.html#method-i-date-3F","()","<p>Test a string to see if it’s a UTC date\n<p>@return [Boolean] test result\n"],["delete_meta","String","String.html#method-i-delete_meta","(key)",""],["delete_mmd","String","String.html#method-i-delete_mmd","(key)",""],["delete_yaml","String","String.html#method-i-delete_yaml","(key)",""],["env","Conductor::Env","Conductor/Env.html#method-c-env","()","<p>Define @env using Marked environment variables\n"],["execute_track","Conductor","Conductor.html#method-c-execute_track","(track)","<p>Execute commands/scripts in the track\n<p>@param track The track\n<p>@return Resulting STDOUT output …\n"],["first_h1","String","String.html#method-i-first_h1","()",""],["first_h2","String","String.html#method-i-first_h2","()",""],["get_title","String","String.html#method-i-get_title","()",""],["has_comment?","String","String.html#method-i-has_comment-3F","(key)",""],["insert_file","String","String.html#method-i-insert_file","(path, type = :file, position = :end)",""],["insert_script","String","String.html#method-i-insert_script","(path)",""],["insert_title","String","String.html#method-i-insert_title","()",""],["insert_toc","String","String.html#method-i-insert_toc","(max = nil, after = :h1)",""],["load_test_env","Conductor::Env","Conductor/Env.html#method-c-load_test_env","()","<p>Loads a test environment.\n"],["meta?","String","String.html#method-i-meta-3F","()","<p>Test if a string starts with MMD metadata\n<p>@return [Boolean] test result\n"],["meta_insert_point","String","String.html#method-i-meta_insert_point","()",""],["meta_type","String","String.html#method-i-meta_type","()",""],["new","Conductor::Command","Conductor/Command.html#method-c-new","(command)",""],["new","Conductor::Condition","Conductor/Condition.html#method-c-new","(condition)","<p>Initializes the given condition.\n<p>@param condition The condition\n"],["new","Conductor::Config","Conductor/Config.html#method-c-new","()",""],["new","Conductor::Script","Conductor/Script.html#method-c-new","(script)","<p>Initializes the given script.\n<p>@param script The script/path\n"],["new","Filter","Filter.html#method-c-new","(filter)",""],["normalize_filter","String","String.html#method-i-normalize_filter","()",""],["normalize_include_type","String","String.html#method-i-normalize_include_type","()",""],["normalize_position","String","String.html#method-i-normalize_position","()",""],["number?","String","String.html#method-i-number-3F","()","<p>Test if a string is a number\n<p>@return [Boolean] test result\n"],["operator_to_symbol","Conductor::Condition","Conductor/Condition.html#method-i-operator_to_symbol","(operator)",""],["parse_condition","Conductor::Condition","Conductor/Condition.html#method-i-parse_condition","()",""],["path=","Conductor::Command","Conductor/Command.html#method-i-path-3D","(path)",""],["path=","Conductor::Script","Conductor/Script.html#method-i-path-3D","(path)","<p>Set script path, automatically expands/tests\n<p>@param path The path\n"],["process","Filter","Filter.html#method-i-process","()",""],["replace","String","String.html#method-i-replace","(regex, pattern)",""],["replace_all","String","String.html#method-i-replace_all","(regex, pattern)",""],["run","Conductor::Command","Conductor/Command.html#method-i-run","()",""],["run","Conductor::Script","Conductor/Script.html#method-i-run","()","<p>Execute the script\n<p>@return [String] script results (STDOUT)\n"],["sample_config","Conductor","Conductor.html#method-i-sample_config","()",""],["set_meta","String","String.html#method-i-set_meta","(key, value, style: :comment)",""],["split_booleans","Conductor::Condition","Conductor/Condition.html#method-i-split_booleans","(condition)","<p>Splits booleans and tests components.\n<p>@param condition The condition to test\n<p>@return [Boolean] …\n"],["split_condition","Conductor::Condition","Conductor/Condition.html#method-i-split_condition","(condition)","<p>Splits a natural language condition.\n<p>@param condition The condition @return [Array] Value, value …\n"],["stdin","Conductor","Conductor.html#method-c-stdin","()",""],["strip_meta","String","String.html#method-i-strip_meta","()",""],["strip_time","String","String.html#method-i-strip_time","()","<p>Remove time from string\n<p>@return [String] string with time removed\n"],["symbolize_keys","Array","Array.html#method-i-symbolize_keys","()",""],["symbolize_keys","Hash","Hash.html#method-i-symbolize_keys","()",""],["symbolize_keys!","Array","Array.html#method-i-symbolize_keys-21","()",""],["symbolize_keys!","Hash","Hash.html#method-i-symbolize_keys-21","()",""],["test_condition","Conductor::Condition","Conductor/Condition.html#method-i-test_condition","(condition)",""],["test_meta","Conductor::Condition","Conductor/Condition.html#method-i-test_meta","(content, value, key, operator)","<p>Test for MultiMarkdown metadata,\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">optionally</span> <span class=\"ruby-identifier\">key</span> <span class=\"ruby-keyword\">and</span> <span class=\"ruby-identifier\">value</span>\n</pre>\n<p>@param content [String] The text content …\n"],["test_operator","Conductor::Condition","Conductor/Condition.html#method-i-test_operator","(value1, value2, operator)","<p>Test operators\n<p>@param value1 Value @param value2 Value to test @param operator …\n"],["test_pandoc","Conductor::Condition","Conductor/Condition.html#method-i-test_pandoc","(content, operator)",""],["test_string","Conductor::Condition","Conductor/Condition.html#method-i-test_string","(val1, val2, operator)","<p>Compare a string based on operator\n<p>@param val1 The string to test against @param val2 …\n"],["test_tree","Conductor::Condition","Conductor/Condition.html#method-i-test_tree","(origin, value, operator)","<p>Test for the existince of a\n\n<pre>file/directory in the parent tree</pre>\n<p>@param origin Starting directory …\n"],["test_truthy","Conductor::Condition","Conductor/Condition.html#method-i-test_truthy","(value1, value2, operator)","<p>Test “truthiness”\n<p>@param value1 Value to test against @param value2 Value to …\n"],["test_type","Conductor::Condition","Conductor/Condition.html#method-i-test_type","(val1, val2, operator)","<p>Test for type of value\n<p>@param val1 value @param val2 value to test against @param …\n"],["test_yaml","Conductor::Condition","Conductor/Condition.html#method-i-test_yaml","(content, value, key, operator)","<p>Test for presence of yaml, optionall for\n\n<pre>a key, optionally for a key&#39;s value</pre>\n<p>@param content Text …\n"],["time?","String","String.html#method-i-time-3F","()","<p>Test a string to see if it includes a time\n<p>@return [Boolean] test result\n"],["title_from_slug","String","String.html#method-i-title_from_slug","()",""],["titleize","String","String.html#method-i-titleize","()","<p>Titlecase a string\n<p>@return Titleized string\n"],["to_bool","String","String.html#method-i-to_bool","()","<p>Returns a bool representation of the string.\n<p>@return [Boolean] Bool representation of the object. …\n"],["to_bool!","String","String.html#method-i-to_bool-21","()","<p>Destructive version of #to_bool\n<p>@see #to_bool\n"],["to_date","String","String.html#method-i-to_date","()","<p>Convert a natural language string to a Date\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">object</span>\n</pre>\n<p>@return [Date] Resulting Date object\n"],["to_day","String","String.html#method-i-to_day","(time = :end)",""],["to_pattern","String","String.html#method-i-to_pattern","()",""],["to_rx","String","String.html#method-i-to_rx","()",""],["to_s","Conductor::Env","Conductor/Env.html#method-c-to_s","()","<p>env to string\n<p>@return [String] shell-compatible string representation of @env\n"],["true?","Conductor::Condition","Conductor/Condition.html#method-i-true-3F","()","<p>Tests condition\n<p>@return [Boolean] test result\n"],["yaml?","String","String.html#method-i-yaml-3F","()","<p>Test if string starts with YAML\n<p>@return [Boolean] test result\n"],["README","","README_rdoc.html","","<p>Marked Conductor\n<p>A command line tool that functions as a custom processor handler for Marked 2.\n"]]}}
Binary file
@@ -102,15 +102,20 @@
102
102
  &mdash;
103
103
  <span class="container">Conductor::Env</span>
104
104
 
105
+ <li class="method">
106
+ <a href="Conductor/Config.html#method-c-new">::new</a>
107
+ &mdash;
108
+ <span class="container">Conductor::Config</span>
109
+
105
110
  <li class="method">
106
111
  <a href="Conductor/Script.html#method-c-new">::new</a>
107
112
  &mdash;
108
113
  <span class="container">Conductor::Script</span>
109
114
 
110
115
  <li class="method">
111
- <a href="Conductor/Command.html#method-c-new">::new</a>
116
+ <a href="Filter.html#method-c-new">::new</a>
112
117
  &mdash;
113
- <span class="container">Conductor::Command</span>
118
+ <span class="container">Filter</span>
114
119
 
115
120
  <li class="method">
116
121
  <a href="Conductor/Condition.html#method-c-new">::new</a>
@@ -118,14 +123,9 @@
118
123
  <span class="container">Conductor::Condition</span>
119
124
 
120
125
  <li class="method">
121
- <a href="Filter.html#method-c-new">::new</a>
122
- &mdash;
123
- <span class="container">Filter</span>
124
-
125
- <li class="method">
126
- <a href="Conductor/Config.html#method-c-new">::new</a>
126
+ <a href="Conductor/Command.html#method-c-new">::new</a>
127
127
  &mdash;
128
- <span class="container">Conductor::Config</span>
128
+ <span class="container">Conductor::Command</span>
129
129
 
130
130
  <li class="method">
131
131
  <a href="Conductor.html#method-c-stdin">::stdin</a>
@@ -153,15 +153,20 @@
153
153
  <span class="container">String</span>
154
154
 
155
155
  <li class="method">
156
- <a href="Conductor/Command.html#method-i-args-3D">#args=</a>
156
+ <a href="String.html#method-i-append">#append</a>
157
157
  &mdash;
158
- <span class="container">Conductor::Command</span>
158
+ <span class="container">String</span>
159
159
 
160
160
  <li class="method">
161
161
  <a href="Conductor/Script.html#method-i-args-3D">#args=</a>
162
162
  &mdash;
163
163
  <span class="container">Conductor::Script</span>
164
164
 
165
+ <li class="method">
166
+ <a href="Conductor/Command.html#method-i-args-3D">#args=</a>
167
+ &mdash;
168
+ <span class="container">Conductor::Command</span>
169
+
165
170
  <li class="method">
166
171
  <a href="String.html#method-i-bool-3F">#bool?</a>
167
172
  &mdash;
@@ -212,11 +217,46 @@
212
217
  &mdash;
213
218
  <span class="container">String</span>
214
219
 
220
+ <li class="method">
221
+ <a href="String.html#method-i-first_h1">#first_h1</a>
222
+ &mdash;
223
+ <span class="container">String</span>
224
+
225
+ <li class="method">
226
+ <a href="String.html#method-i-first_h2">#first_h2</a>
227
+ &mdash;
228
+ <span class="container">String</span>
229
+
230
+ <li class="method">
231
+ <a href="String.html#method-i-get_title">#get_title</a>
232
+ &mdash;
233
+ <span class="container">String</span>
234
+
215
235
  <li class="method">
216
236
  <a href="String.html#method-i-has_comment-3F">#has_comment?</a>
217
237
  &mdash;
218
238
  <span class="container">String</span>
219
239
 
240
+ <li class="method">
241
+ <a href="String.html#method-i-insert_file">#insert_file</a>
242
+ &mdash;
243
+ <span class="container">String</span>
244
+
245
+ <li class="method">
246
+ <a href="String.html#method-i-insert_script">#insert_script</a>
247
+ &mdash;
248
+ <span class="container">String</span>
249
+
250
+ <li class="method">
251
+ <a href="String.html#method-i-insert_title">#insert_title</a>
252
+ &mdash;
253
+ <span class="container">String</span>
254
+
255
+ <li class="method">
256
+ <a href="String.html#method-i-insert_toc">#insert_toc</a>
257
+ &mdash;
258
+ <span class="container">String</span>
259
+
220
260
  <li class="method">
221
261
  <a href="String.html#method-i-meta-3F">#meta?</a>
222
262
  &mdash;
@@ -237,6 +277,16 @@
237
277
  &mdash;
238
278
  <span class="container">String</span>
239
279
 
280
+ <li class="method">
281
+ <a href="String.html#method-i-normalize_include_type">#normalize_include_type</a>
282
+ &mdash;
283
+ <span class="container">String</span>
284
+
285
+ <li class="method">
286
+ <a href="String.html#method-i-normalize_position">#normalize_position</a>
287
+ &mdash;
288
+ <span class="container">String</span>
289
+
240
290
  <li class="method">
241
291
  <a href="String.html#method-i-number-3F">#number?</a>
242
292
  &mdash;
@@ -253,14 +303,14 @@
253
303
  <span class="container">Conductor::Condition</span>
254
304
 
255
305
  <li class="method">
256
- <a href="Conductor/Command.html#method-i-path-3D">#path=</a>
306
+ <a href="Conductor/Script.html#method-i-path-3D">#path=</a>
257
307
  &mdash;
258
- <span class="container">Conductor::Command</span>
308
+ <span class="container">Conductor::Script</span>
259
309
 
260
310
  <li class="method">
261
- <a href="Conductor/Script.html#method-i-path-3D">#path=</a>
311
+ <a href="Conductor/Command.html#method-i-path-3D">#path=</a>
262
312
  &mdash;
263
- <span class="container">Conductor::Script</span>
313
+ <span class="container">Conductor::Command</span>
264
314
 
265
315
  <li class="method">
266
316
  <a href="Filter.html#method-i-process">#process</a>
@@ -278,14 +328,14 @@
278
328
  <span class="container">String</span>
279
329
 
280
330
  <li class="method">
281
- <a href="Conductor/Script.html#method-i-run">#run</a>
331
+ <a href="Conductor/Command.html#method-i-run">#run</a>
282
332
  &mdash;
283
- <span class="container">Conductor::Script</span>
333
+ <span class="container">Conductor::Command</span>
284
334
 
285
335
  <li class="method">
286
- <a href="Conductor/Command.html#method-i-run">#run</a>
336
+ <a href="Conductor/Script.html#method-i-run">#run</a>
287
337
  &mdash;
288
- <span class="container">Conductor::Command</span>
338
+ <span class="container">Conductor::Script</span>
289
339
 
290
340
  <li class="method">
291
341
  <a href="Conductor.html#method-i-sample_config">#sample_config</a>
@@ -387,6 +437,16 @@
387
437
  &mdash;
388
438
  <span class="container">String</span>
389
439
 
440
+ <li class="method">
441
+ <a href="String.html#method-i-title_from_slug">#title_from_slug</a>
442
+ &mdash;
443
+ <span class="container">String</span>
444
+
445
+ <li class="method">
446
+ <a href="String.html#method-i-titleize">#titleize</a>
447
+ &mdash;
448
+ <span class="container">String</span>
449
+
390
450
  <li class="method">
391
451
  <a href="String.html#method-i-to_bool">#to_bool</a>
392
452
  &mdash;
@@ -47,6 +47,140 @@ class ::String
47
47
  insert_point
48
48
  end
49
49
 
50
+ def first_h1
51
+ first = 0
52
+ split(/\n/).each_with_index do |line, idx|
53
+ if line =~ /^(# *\S|={2,} *$)/
54
+ first = idx
55
+ break
56
+ end
57
+ end
58
+ first
59
+ end
60
+
61
+ def first_h2
62
+ first = 0
63
+ split(/\n/).each_with_index do |line, idx|
64
+ if line =~ /^(## *\S|-{2,} *$)/
65
+ first = idx
66
+ break
67
+ end
68
+ end
69
+ first
70
+ end
71
+
72
+ def insert_toc(max = nil, after = :h1)
73
+ lines = split(/\n/)
74
+ max = max && max.to_i.positive? ? " max#{max}" : ""
75
+ line = case after.to_sym
76
+ when :h2
77
+ first_h2.positive? ? first_h2 + 1 : 0
78
+ when :h1
79
+ first_h1.positive? ? first_h1 + 1 : 0
80
+ else
81
+ 0
82
+ end
83
+
84
+ lines.insert(line, "\n<!--toc#{max}-->\n").join("\n")
85
+ end
86
+
87
+ def insert_file(path, type = :file, position = :end)
88
+ path.strip!
89
+
90
+ if path =~ %r{^[~/]}
91
+ path = File.expand_path(path)
92
+ elsif File.directory?(File.expand_path("~/.config/conductor/files"))
93
+ new_path = File.expand_path("~/.config/conductor/files/#{path}")
94
+ path = new_path if File.exist?(new_path)
95
+ end
96
+
97
+ out = case type
98
+ when :code
99
+ "<<(#{path})"
100
+ when :raw
101
+ "<<{#{path}}"
102
+ else
103
+ "<<[#{path}]"
104
+ end
105
+ out = "\n#{out}\n"
106
+
107
+ case position
108
+ when :start
109
+ "#{out}\n#{self}"
110
+ when :h1
111
+ split(/\n/).insert(first_h1 + 1, out).join("\n")
112
+ else
113
+ "#{self}\n#{out}"
114
+ end
115
+ end
116
+
117
+ def append(string)
118
+ "#{self}\n#{string}"
119
+ end
120
+
121
+ def insert_script(path)
122
+ path.strip!
123
+ path = "#{path}.js" unless path =~ /\.js$/
124
+
125
+ if path =~ %r{^[~/]}
126
+ path = File.expand_path(path)
127
+ else
128
+ new_path = if File.directory?(File.expand_path("~/.config/conductor/javascript"))
129
+ File.expand_path("~/.config/conductor/javascript/#{path}")
130
+ elsif File.directory?(File.expand_path("~/.config/conductor/javascripts"))
131
+ File.expand_path("~/.config/conductor/javascripts/#{path}")
132
+ else
133
+ File.expand_path("~/.config/conductor/scripts/#{path}")
134
+ end
135
+
136
+ path = new_path if File.exist?(new_path)
137
+ end
138
+
139
+ %(#{self}\n<script type="javascript" src="#{path}"></script>\n)
140
+ end
141
+
142
+ def title_from_slug
143
+ filename = File.basename(Conductor::Env.env[:filepath]).sub(/\.[a-z]+$/i, "")
144
+ filename.sub!(/-?\d{4}-\d{2}-\d{2}-?/, "")
145
+ filename.sub!(/\bdot\b/, ".")
146
+ filename.sub!(/ dash /, "-")
147
+ filename
148
+ end
149
+
150
+ def get_title
151
+ title = nil
152
+
153
+ case meta_type
154
+ when :yaml
155
+ m = match(/^---.*?\n(---|\.\.\.)/m)
156
+ yaml = YAML.load(m[0])
157
+ title = yaml["title"]
158
+ when :mmd
159
+ split(/\n/).each do |line|
160
+ if line =~ /^ *title: *(\S.*?)$/i
161
+ title = Regexp.last_match(1)
162
+ break
163
+ end
164
+ end
165
+ else
166
+ m = match(/title: (.*?)$/i)
167
+ title = m ? m[0] : nil
168
+ end
169
+
170
+ title ||= title_from_slug.titleize
171
+
172
+ title
173
+ end
174
+
175
+ def insert_title
176
+ title = get_title
177
+ lines = split(/\n/)
178
+ insert_point = meta_insert_point
179
+ insert_at = insert_point.positive? ? insert_point + 1 : 0
180
+ lines.insert(insert_at, "# #{title}\n")
181
+ lines.join("\n")
182
+ end
183
+
50
184
  def set_meta(key, value, style: :comment)
51
185
  case style
52
186
  when :yaml
@@ -143,7 +277,7 @@ class ::String
143
277
  end
144
278
 
145
279
  def to_pattern
146
- gsub(/\$(\d+)/, '\\\\\1').gsub(/(^["']|["']$)/, '')
280
+ gsub(/\$(\d+)/, '\\\\\1').gsub(/(^["']|["']$)/, "")
147
281
  end
148
282
  end
149
283
 
@@ -153,12 +287,40 @@ class Filter < String
153
287
 
154
288
  def initialize(filter)
155
289
  @filter, @params = filter.normalize_filter
290
+ super
156
291
  end
157
292
 
158
293
  def process
159
294
  content = Conductor.stdin
160
295
 
161
296
  case @filter
297
+ when /(insert|add|inject)title/
298
+ content.insert_title
299
+ when /(insert|add|inject)script/
300
+ content = content.append("\n\n<div>")
301
+ @params.each do |script|
302
+ content = content.insert_script(script)
303
+ end
304
+ "#{content}</div>"
305
+ when /(prepend|append|insert|inject)(raw|file|code)/
306
+ m = Regexp.last_match
307
+
308
+ position = if @params.count == 2
309
+ @params[1].normalize_position
310
+ else
311
+ m[1].normalize_position
312
+ end
313
+ content.insert_file(@params[0], m[2].normalize_include_type, position)
314
+ when /inserttoc/
315
+ max = @params.count.positive? ? @params[0] : nil
316
+
317
+ if @params.count == 2
318
+ after = @params[1] =~ /2/ ? :h2 : :h1
319
+ else
320
+ after = :start
321
+ end
322
+
323
+ content.insert_toc(max, after)
162
324
  when /(add|set)meta/
163
325
  unless @params.count == 2
164
326
  warn "Invalid filter parameters: #{@filter}(#{@params.join(",")})"
@@ -168,8 +330,8 @@ class Filter < String
168
330
  # needs to test for existing meta, setting key if exists, adding if not
169
331
  # should recognize yaml and mmd
170
332
  content.set_meta(@params[0], @params[1], style: content.meta_type)
171
- when /(strip|remove)meta/
172
- if @params
333
+ when /(strip|remove|delete)meta/
334
+ if @params&.count.positive?
173
335
  content.delete_meta(@params[0])
174
336
  else
175
337
  content.strip_meta
@@ -2,6 +2,37 @@
2
2
 
3
3
  # String helpers
4
4
  class ::String
5
+ ##
6
+ ## Titlecase a string
7
+ ##
8
+ ## @return Titleized string
9
+ ##
10
+ def titleize
11
+ split(/(\W)/).map(&:capitalize).join
12
+ end
13
+
14
+ def normalize_position
15
+ case self
16
+ when /^(be|s|t)/
17
+ :start
18
+ when /h1/
19
+ :h1
20
+ else
21
+ :end
22
+ end
23
+ end
24
+
25
+ def normalize_include_type
26
+ case self
27
+ when /^c/
28
+ :code
29
+ when /^r/
30
+ :raw
31
+ else
32
+ :file
33
+ end
34
+ end
35
+
5
36
  ##
6
37
  ## Convert a string boolean to symbol
7
38
  ##
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conductor
4
- VERSION = '1.0.13'
4
+ VERSION = '1.0.15'
5
5
  end
data/src/_README.md CHANGED
@@ -23,7 +23,7 @@ If you use Homebrew, you can run
23
23
 
24
24
  To use Conductor, you need to set up a configuration file in `~/.config/conductor/tracks.yaml`. Run `conductor` once to create the directory and an empty configuration. See [Configuration](#configuration) below for details on setting up your "tracks."
25
25
 
26
- Once configured, you can set up conductor as a Custom Processor in Marked. Run `which conductor | pbcopy` to get the full path to the binary and copy it, then open <b>Marked Preferences > Advanced</b> and select either Custom Processor or Custom Preprocessor (or both) and paste into the <b>Path:</b> field. You can select <i>Automatically enable for new windows</i> to have the processor enabled by default when opening documents.
26
+ Once configured, you can set up conductor as a Custom Processor in Marked. Run `which conductor | pbcopy` to get the full path to the binary and copy it, then open **Marked Preferences > Advanced** and select either Custom Processor or Custom Preprocessor (or both) and paste into the **Path:** field. You can select *Automatically enable for new windows* to have the processor enabled by default when opening documents.
27
27
 
28
28
  <!--JEKYLL {% img aligncenter /uploads/2024/04/marked-preferences-conductor.jpg 593 673 "marked-preferences-conductor.jpg" %}-->
29
29
  <!--GITHUB-->![Marked preferences](images/preferences.jpg)<!--END GITHUB-->
@@ -122,13 +122,49 @@ Conditions can be combined with AND or OR (must be uppercase) and simple parenth
122
122
 
123
123
  ### Actions
124
124
 
125
- The action can be either `script` or `command`.
125
+ The action can be `script`, `command`, or `filter`.
126
126
 
127
- Scripts are located in `~/.config/conductor/scripts/` and should be executable files that take input on STDIN (unless `$file` is specified in the `script` definition). If a script is defined starting with `~` or `/`, that will be interpreted as a full path to an alternate location.
127
+ **Scripts** are located in `~/.config/conductor/scripts/` and should be executable files that take input on STDIN (unless `$file` is specified in the `script` definition). If a script is defined starting with `~` or `/`, that will be interpreted as a full path to an alternate location.
128
128
 
129
- Commands are interpreted as shell commands. If a command exists in the `$PATH`, a full path will automatically be determined, so a command can be as simple as just `pandoc`. Add any arguments needed after the command.
129
+ > Example:
130
+ >
131
+ > script: github_pre
130
132
 
131
- Using `$file` as an argument to a script or command will bypass processing of STDIN input, and instead use the value of $MARKED_PATH to read the contents of the specified file.
133
+ **Commands** are interpreted as shell commands. If a command exists in the `$PATH`, a full path will automatically be determined, so a command can be as simple as just `pandoc`. Add any arguments needed after the command.
134
+
135
+ > Example:
136
+ >
137
+ > command: multimarkdown
138
+
139
+
140
+ > Using `$file` as an argument to a script or command will bypass processing of STDIN input, and instead use the value of $MARKED_PATH to read the contents of the specified file.
141
+
142
+ **Filters** are simple actions that can be run on the content without having to write a separate script for it. Available filters are:
143
+ | filter | description |
144
+ | :---- | :---------- |
145
+ | `setMeta(key, value)` | adds or updates a meta key, aware of YAML and MMD |
146
+ | `stripMeta` | strips all metadata (YAML or MMD) from the content |
147
+ | `deleteMeta(key)` | removes a specific key (YAML or MMD) |
148
+ | `setStyle(name)` | sets the Marked preview style to a preconfigured Style name |
149
+ | `replace(search, replace)` | performs a (single) search and replace on content |
150
+ | `replaceAll(search, replace)` | global version of `replaceAll`) |
151
+ | `insertTitle` | adds a title to the document, either from metadata or filename |
152
+ | `insertScript(path[,path])` | injects javascript(s) |
153
+ | `insertTOC(max, after)` | insert TOC (max=max levels, after=start, \*h1, or h2) |
154
+ | `prepend/appendFile(path)` | insert a file as Markdown at beginning or end of content |
155
+ | `prepend/appendRaw(path)` | insert a file as raw HTML at beginning or end of content |
156
+ | `prepend/appendCode(path)` | insert a file as a code block at beginning or end of content |
157
+
158
+ For `insertScript`, if path is just a filename it will look for a match in `~/.config/conductor/javascript` or `~/.config/conductor/scripts` and turn that into an absolute path if the file is found.
159
+
160
+ For `replace` and `replaceAll`: If *search* is surrounded with forward slashes followed by optional flags (*i* for case-insensitive, *m* to make dot match newlines), e.g. `/contribut(ing)?/i`, it will be interpreted as a regular expression. The *replace* value can include numeric capture groups, e.g. `Follow$2`.
161
+
162
+ > Example:
163
+ >
164
+ > filter: setStyle(github)
165
+
166
+
167
+ > Filters can be camel case (replaceAll) or snake case (replace_all), either will work, case insensitive.
132
168
 
133
169
  ## Custom Processors
134
170
 
data/test.md ADDED
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: hello there
3
+ date: 2024-05-25 08:00
4
+ ---
5
+
6
+ # This is a test
7
+
8
+ Here's a test file for you.
9
+
10
+ ## It's only a test
11
+
12
+ With a few paragraphs.
13
+
14
+ Just three.
data/test.sh CHANGED
@@ -1,12 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
- # ./test.sh PATH [pr[eo]]
3
+ # ./test.sh OPTIONS PATH
4
+ # test.sh -h for options
4
5
 
5
- OPTIND=1 # Reset in case getopts has been used previously in the shell.
6
-
7
- # Initialize our own variables:
8
- output_file=""
9
- verbose=0
6
+ OPTIND=1
10
7
 
11
8
  show_help() {
12
9
  echo "$(basename $0): Shortcut for testing conductor with a given file"
@@ -18,7 +15,7 @@ show_help() {
18
15
  echo " $0 [-p PHASE] [-o OUTPUT] FILE_PATH"
19
16
  }
20
17
 
21
- if [[ -d bin ]]; then
18
+ if [[ -f bin/conductor ]]; then
22
19
  CMD="./bin/conductor"
23
20
  else
24
21
  CMD="$(which conductor)"