marked-conductor 1.0.12 → 1.0.14
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +41 -7
- data/bin/conductor +8 -0
- data/html/Conductor.html +10 -2
- data/html/Filter.html +243 -0
- data/html/Object.html +1 -1
- data/html/String.html +671 -12
- data/html/created.rid +6 -5
- data/html/index.html +1 -0
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/table_of_contents.html +132 -9
- data/lib/conductor/filter.rb +272 -0
- data/lib/conductor/string.rb +9 -0
- data/lib/conductor/version.rb +1 -1
- data/lib/conductor.rb +1 -0
- data/src/_README.md +41 -7
- data/test.sh +83 -0
- metadata +5 -2
data/html/created.rid
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
|
1
|
+
Sat, 25 May 2024 06:41:22 -0500
|
2
2
|
README.rdoc Sun, 28 Apr 2024 13:21:34 -0500
|
3
|
-
lib/conductor.rb
|
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
|
5
5
|
lib/conductor/boolean.rb Thu, 25 Apr 2024 14:25:59 -0500
|
6
6
|
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 Sat, 25 May 2024 06:38:24 -0500
|
10
11
|
lib/conductor/hash.rb Sat, 27 Apr 2024 11:54:28 -0500
|
11
12
|
lib/conductor/script.rb Sun, 28 Apr 2024 16:21:49 -0500
|
12
|
-
lib/conductor/string.rb
|
13
|
-
lib/conductor/version.rb
|
14
|
-
bin/conductor
|
13
|
+
lib/conductor/string.rb Sat, 25 May 2024 06:20:54 -0500
|
14
|
+
lib/conductor/version.rb Fri, 24 May 2024 13:13:06 -0500
|
15
|
+
bin/conductor Fri, 24 May 2024 12:39:06 -0500
|
data/html/index.html
CHANGED
@@ -78,6 +78,7 @@
|
|
78
78
|
<li><code><a href="./Conductor/Script.html">Script</a></code>
|
79
79
|
</ul></details>
|
80
80
|
<li><code><a href="./FalseClass.html">FalseClass</a></code>
|
81
|
+
<li><code><a href="./Filter.html">Filter</a></code>
|
81
82
|
<li><code><a href="./Hash.html">Hash</a></code>
|
82
83
|
<li><code><a href="./Object.html">Object</a></code>
|
83
84
|
<li><code><a href="./String.html">String</a></code>
|
data/html/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["array","conductor","command","condition","config","env","script","falseclass","hash","object","string","trueclass","args=()","args=()","bool?()","bool?()","bool?()","bool_to_symbol()","clean_condition()","conduct()","create_config()","date?()","env()","execute_track()","load_test_env()","meta?()","new()","new()","new()","new()","number?()","operator_to_symbol()","parse_condition()","path=()","path=()","run()","run()","sample_config()","split_booleans()","split_condition()","stdin()","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_s()","true?()","yaml?()","readme"],"longSearchIndex":["array","conductor","conductor::command","conductor::condition","conductor::config","conductor::env","conductor::script","falseclass","hash","object","string","trueclass","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?()","conductor::env::env()","conductor::execute_track()","conductor::env::load_test_env()","string#meta?()","conductor::command::new()","conductor::condition::new()","conductor::config::new()","conductor::script::new()","string#number?()","conductor::condition#operator_to_symbol()","conductor::condition#parse_condition()","conductor::command#path=()","conductor::script#path=()","conductor::command#run()","conductor::script#run()","conductor#sample_config()","conductor::condition#split_booleans()","conductor::condition#split_condition()","conductor::stdin()","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()","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"],["Hash","","Hash.html","",""],["Object","","Object.html","",""],["String","","String.html","","<p>String helpers\n"],["TrueClass","","TrueClass.html","","<p>True class\n"],["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"],["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"],["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"],["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"],["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"],["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","()",""],["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_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'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_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()","get_title()","has_comment?()","insert_script()","insert_title()","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?()","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#get_title()","string#has_comment?()","string#insert_script()","string#insert_title()","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#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"],["get_title","String","String.html#method-i-get_title","()",""],["has_comment?","String","String.html#method-i-has_comment-3F","(key)",""],["insert_script","String","String.html#method-i-insert_script","(path)",""],["insert_title","String","String.html#method-i-insert_title","()",""],["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'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"]]}}
|
data/html/js/search_index.js.gz
CHANGED
Binary file
|
data/html/table_of_contents.html
CHANGED
@@ -62,6 +62,9 @@
|
|
62
62
|
<li class="class">
|
63
63
|
<a href="FalseClass.html">FalseClass</a>
|
64
64
|
</li>
|
65
|
+
<li class="class">
|
66
|
+
<a href="Filter.html">Filter</a>
|
67
|
+
</li>
|
65
68
|
<li class="class">
|
66
69
|
<a href="Hash.html">Hash</a>
|
67
70
|
</li>
|
@@ -99,11 +102,6 @@
|
|
99
102
|
—
|
100
103
|
<span class="container">Conductor::Env</span>
|
101
104
|
|
102
|
-
<li class="method">
|
103
|
-
<a href="Conductor/Script.html#method-c-new">::new</a>
|
104
|
-
—
|
105
|
-
<span class="container">Conductor::Script</span>
|
106
|
-
|
107
105
|
<li class="method">
|
108
106
|
<a href="Conductor/Config.html#method-c-new">::new</a>
|
109
107
|
—
|
@@ -119,6 +117,16 @@
|
|
119
117
|
—
|
120
118
|
<span class="container">Conductor::Condition</span>
|
121
119
|
|
120
|
+
<li class="method">
|
121
|
+
<a href="Conductor/Script.html#method-c-new">::new</a>
|
122
|
+
—
|
123
|
+
<span class="container">Conductor::Script</span>
|
124
|
+
|
125
|
+
<li class="method">
|
126
|
+
<a href="Filter.html#method-c-new">::new</a>
|
127
|
+
—
|
128
|
+
<span class="container">Filter</span>
|
129
|
+
|
122
130
|
<li class="method">
|
123
131
|
<a href="Conductor.html#method-c-stdin">::stdin</a>
|
124
132
|
—
|
@@ -130,15 +138,35 @@
|
|
130
138
|
<span class="container">Conductor::Env</span>
|
131
139
|
|
132
140
|
<li class="method">
|
133
|
-
<a href="
|
141
|
+
<a href="String.html#method-i-add_comment">#add_comment</a>
|
134
142
|
—
|
135
|
-
<span class="container">
|
143
|
+
<span class="container">String</span>
|
144
|
+
|
145
|
+
<li class="method">
|
146
|
+
<a href="String.html#method-i-add_mmd">#add_mmd</a>
|
147
|
+
—
|
148
|
+
<span class="container">String</span>
|
149
|
+
|
150
|
+
<li class="method">
|
151
|
+
<a href="String.html#method-i-add_yaml">#add_yaml</a>
|
152
|
+
—
|
153
|
+
<span class="container">String</span>
|
154
|
+
|
155
|
+
<li class="method">
|
156
|
+
<a href="String.html#method-i-append">#append</a>
|
157
|
+
—
|
158
|
+
<span class="container">String</span>
|
136
159
|
|
137
160
|
<li class="method">
|
138
161
|
<a href="Conductor/Script.html#method-i-args-3D">#args=</a>
|
139
162
|
—
|
140
163
|
<span class="container">Conductor::Script</span>
|
141
164
|
|
165
|
+
<li class="method">
|
166
|
+
<a href="Conductor/Command.html#method-i-args-3D">#args=</a>
|
167
|
+
—
|
168
|
+
<span class="container">Conductor::Command</span>
|
169
|
+
|
142
170
|
<li class="method">
|
143
171
|
<a href="String.html#method-i-bool-3F">#bool?</a>
|
144
172
|
—
|
@@ -174,11 +202,61 @@
|
|
174
202
|
—
|
175
203
|
<span class="container">String</span>
|
176
204
|
|
205
|
+
<li class="method">
|
206
|
+
<a href="String.html#method-i-delete_meta">#delete_meta</a>
|
207
|
+
—
|
208
|
+
<span class="container">String</span>
|
209
|
+
|
210
|
+
<li class="method">
|
211
|
+
<a href="String.html#method-i-delete_mmd">#delete_mmd</a>
|
212
|
+
—
|
213
|
+
<span class="container">String</span>
|
214
|
+
|
215
|
+
<li class="method">
|
216
|
+
<a href="String.html#method-i-delete_yaml">#delete_yaml</a>
|
217
|
+
—
|
218
|
+
<span class="container">String</span>
|
219
|
+
|
220
|
+
<li class="method">
|
221
|
+
<a href="String.html#method-i-get_title">#get_title</a>
|
222
|
+
—
|
223
|
+
<span class="container">String</span>
|
224
|
+
|
225
|
+
<li class="method">
|
226
|
+
<a href="String.html#method-i-has_comment-3F">#has_comment?</a>
|
227
|
+
—
|
228
|
+
<span class="container">String</span>
|
229
|
+
|
230
|
+
<li class="method">
|
231
|
+
<a href="String.html#method-i-insert_script">#insert_script</a>
|
232
|
+
—
|
233
|
+
<span class="container">String</span>
|
234
|
+
|
235
|
+
<li class="method">
|
236
|
+
<a href="String.html#method-i-insert_title">#insert_title</a>
|
237
|
+
—
|
238
|
+
<span class="container">String</span>
|
239
|
+
|
177
240
|
<li class="method">
|
178
241
|
<a href="String.html#method-i-meta-3F">#meta?</a>
|
179
242
|
—
|
180
243
|
<span class="container">String</span>
|
181
244
|
|
245
|
+
<li class="method">
|
246
|
+
<a href="String.html#method-i-meta_insert_point">#meta_insert_point</a>
|
247
|
+
—
|
248
|
+
<span class="container">String</span>
|
249
|
+
|
250
|
+
<li class="method">
|
251
|
+
<a href="String.html#method-i-meta_type">#meta_type</a>
|
252
|
+
—
|
253
|
+
<span class="container">String</span>
|
254
|
+
|
255
|
+
<li class="method">
|
256
|
+
<a href="String.html#method-i-normalize_filter">#normalize_filter</a>
|
257
|
+
—
|
258
|
+
<span class="container">String</span>
|
259
|
+
|
182
260
|
<li class="method">
|
183
261
|
<a href="String.html#method-i-number-3F">#number?</a>
|
184
262
|
—
|
@@ -205,20 +283,40 @@
|
|
205
283
|
<span class="container">Conductor::Script</span>
|
206
284
|
|
207
285
|
<li class="method">
|
208
|
-
<a href="
|
286
|
+
<a href="Filter.html#method-i-process">#process</a>
|
209
287
|
—
|
210
|
-
<span class="container">
|
288
|
+
<span class="container">Filter</span>
|
289
|
+
|
290
|
+
<li class="method">
|
291
|
+
<a href="String.html#method-i-replace">#replace</a>
|
292
|
+
—
|
293
|
+
<span class="container">String</span>
|
294
|
+
|
295
|
+
<li class="method">
|
296
|
+
<a href="String.html#method-i-replace_all">#replace_all</a>
|
297
|
+
—
|
298
|
+
<span class="container">String</span>
|
211
299
|
|
212
300
|
<li class="method">
|
213
301
|
<a href="Conductor/Command.html#method-i-run">#run</a>
|
214
302
|
—
|
215
303
|
<span class="container">Conductor::Command</span>
|
216
304
|
|
305
|
+
<li class="method">
|
306
|
+
<a href="Conductor/Script.html#method-i-run">#run</a>
|
307
|
+
—
|
308
|
+
<span class="container">Conductor::Script</span>
|
309
|
+
|
217
310
|
<li class="method">
|
218
311
|
<a href="Conductor.html#method-i-sample_config">#sample_config</a>
|
219
312
|
—
|
220
313
|
<span class="container">Conductor</span>
|
221
314
|
|
315
|
+
<li class="method">
|
316
|
+
<a href="String.html#method-i-set_meta">#set_meta</a>
|
317
|
+
—
|
318
|
+
<span class="container">String</span>
|
319
|
+
|
222
320
|
<li class="method">
|
223
321
|
<a href="Conductor/Condition.html#method-i-split_booleans">#split_booleans</a>
|
224
322
|
—
|
@@ -229,6 +327,11 @@
|
|
229
327
|
—
|
230
328
|
<span class="container">Conductor::Condition</span>
|
231
329
|
|
330
|
+
<li class="method">
|
331
|
+
<a href="String.html#method-i-strip_meta">#strip_meta</a>
|
332
|
+
—
|
333
|
+
<span class="container">String</span>
|
334
|
+
|
232
335
|
<li class="method">
|
233
336
|
<a href="String.html#method-i-strip_time">#strip_time</a>
|
234
337
|
—
|
@@ -304,6 +407,16 @@
|
|
304
407
|
—
|
305
408
|
<span class="container">String</span>
|
306
409
|
|
410
|
+
<li class="method">
|
411
|
+
<a href="String.html#method-i-title_from_slug">#title_from_slug</a>
|
412
|
+
—
|
413
|
+
<span class="container">String</span>
|
414
|
+
|
415
|
+
<li class="method">
|
416
|
+
<a href="String.html#method-i-titleize">#titleize</a>
|
417
|
+
—
|
418
|
+
<span class="container">String</span>
|
419
|
+
|
307
420
|
<li class="method">
|
308
421
|
<a href="String.html#method-i-to_bool">#to_bool</a>
|
309
422
|
—
|
@@ -324,6 +437,16 @@
|
|
324
437
|
—
|
325
438
|
<span class="container">String</span>
|
326
439
|
|
440
|
+
<li class="method">
|
441
|
+
<a href="String.html#method-i-to_pattern">#to_pattern</a>
|
442
|
+
—
|
443
|
+
<span class="container">String</span>
|
444
|
+
|
445
|
+
<li class="method">
|
446
|
+
<a href="String.html#method-i-to_rx">#to_rx</a>
|
447
|
+
—
|
448
|
+
<span class="container">String</span>
|
449
|
+
|
327
450
|
<li class="method">
|
328
451
|
<a href="Conductor/Condition.html#method-i-true-3F">#true?</a>
|
329
452
|
—
|
@@ -0,0 +1,272 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# String helpers
|
4
|
+
class ::String
|
5
|
+
def normalize_filter
|
6
|
+
parts = match(/(?<filter>[\w_]+)(?:\((?<paren>.*?)\))?$/i)
|
7
|
+
filter = parts["filter"].downcase.gsub(/_/, "")
|
8
|
+
params = parts["paren"]&.split(/ *, */)
|
9
|
+
[filter, params]
|
10
|
+
end
|
11
|
+
|
12
|
+
def meta_type
|
13
|
+
lines = split(/\n/)
|
14
|
+
case lines[0]
|
15
|
+
when /^--- *$/
|
16
|
+
:yaml
|
17
|
+
when /^ *[ \w]+: +\S+/
|
18
|
+
:mmd
|
19
|
+
else
|
20
|
+
:none
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def meta_insert_point
|
25
|
+
insert_point = 0
|
26
|
+
|
27
|
+
case meta_type
|
28
|
+
when :yaml
|
29
|
+
lines = split(/\n/)
|
30
|
+
lines.shift
|
31
|
+
lines.each_with_index do |line, idx|
|
32
|
+
next unless line =~ /^(...|---) *$/
|
33
|
+
|
34
|
+
insert_point = idx + 1
|
35
|
+
break
|
36
|
+
end
|
37
|
+
when :mmd
|
38
|
+
lines = split(/\n/)
|
39
|
+
lines.each_with_index do |line, idx|
|
40
|
+
next if line =~ /^ *[ \w]+: +\S+/
|
41
|
+
|
42
|
+
insert_point = idx
|
43
|
+
break
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
insert_point
|
48
|
+
end
|
49
|
+
|
50
|
+
def append(string)
|
51
|
+
"#{self}\n#{string}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def insert_script(path)
|
55
|
+
path.strip!
|
56
|
+
path = "#{path}.js" unless path =~ /\.js$/
|
57
|
+
|
58
|
+
if path =~ %r{^[~/]}
|
59
|
+
path = File.expand_path(path)
|
60
|
+
else
|
61
|
+
new_path = if File.directory?(File.expand_path("~/.config/conductor/javascript"))
|
62
|
+
File.expand_path("~/.config/conductor/javascript/#{path}")
|
63
|
+
elsif File.directory?(File.expand_path("~/.config/conductor/javascripts"))
|
64
|
+
File.expand_path("~/.config/conductor/javascripts/#{path}")
|
65
|
+
else
|
66
|
+
File.expand_path("~/.config/conductor/scripts/#{path}")
|
67
|
+
end
|
68
|
+
|
69
|
+
path = new_path if File.exist?(new_path)
|
70
|
+
end
|
71
|
+
|
72
|
+
%(#{self}\n<script type="javascript" src="#{path}"></script>\n)
|
73
|
+
end
|
74
|
+
|
75
|
+
def title_from_slug
|
76
|
+
filename = File.basename(Conductor::Env.env[:filepath]).sub(/\.[a-z]+$/i, "")
|
77
|
+
filename.sub!(/-?\d{4}-\d{2}-\d{2}-?/, "")
|
78
|
+
filename.sub!(/\bdot\b/, ".")
|
79
|
+
filename.sub!(/ dash /, "-")
|
80
|
+
filename
|
81
|
+
end
|
82
|
+
|
83
|
+
def get_title
|
84
|
+
title = nil
|
85
|
+
|
86
|
+
case meta_type
|
87
|
+
when :yaml
|
88
|
+
m = match(/^---.*?\n(---|\.\.\.)/m)
|
89
|
+
yaml = YAML.load(m[0])
|
90
|
+
title = yaml["title"]
|
91
|
+
when :mmd
|
92
|
+
split(/\n/).each do |line|
|
93
|
+
if line =~ /^ *title: *(\S.*?)$/i
|
94
|
+
title = Regexp.last_match(1)
|
95
|
+
break
|
96
|
+
end
|
97
|
+
end
|
98
|
+
else
|
99
|
+
m = match(/title: (.*?)$/i)
|
100
|
+
title = m ? m[0] : nil
|
101
|
+
end
|
102
|
+
|
103
|
+
title ||= title_from_slug.titleize
|
104
|
+
|
105
|
+
title
|
106
|
+
end
|
107
|
+
|
108
|
+
def insert_title
|
109
|
+
title = get_title
|
110
|
+
lines = split(/\n/)
|
111
|
+
insert_point = meta_insert_point
|
112
|
+
insert_at = insert_point.positive? ? insert_point + 1 : 0
|
113
|
+
lines.insert(insert_at, "# #{title}\n")
|
114
|
+
lines.join("\n")
|
115
|
+
end
|
116
|
+
|
117
|
+
def set_meta(key, value, style: :comment)
|
118
|
+
case style
|
119
|
+
when :yaml
|
120
|
+
add_yaml(key, value)
|
121
|
+
when :mmd
|
122
|
+
add_mmd(key, value)
|
123
|
+
else # comment or none
|
124
|
+
add_comment(key, value)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def add_yaml(key, value)
|
129
|
+
sub(/^---.*?\n(---|\.\.\.)/m) do
|
130
|
+
m = Regexp.last_match
|
131
|
+
yaml = YAML.load(m[0])
|
132
|
+
yaml[key] = value
|
133
|
+
"#{YAML.dump(yaml)}\n---\n"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def delete_yaml(key)
|
138
|
+
sub(/^---.*?\n(---|\.\.\.)/m) do
|
139
|
+
m = Regexp.last_match
|
140
|
+
yaml = YAML.load(m[0])
|
141
|
+
yaml.delete(key)
|
142
|
+
"#{YAML.dump(yaml)}\n---\n"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def add_mmd(key, value)
|
147
|
+
if match(/(\A|\n) *#{key}: *\S+/i)
|
148
|
+
sub(/^ *#{key}:.*?\n/i, "#{key}: #{value}\n")
|
149
|
+
else
|
150
|
+
lines = split(/\n/)
|
151
|
+
lines.insert(meta_insert_point, "#{key}: #{value}")
|
152
|
+
lines.join("\n")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def delete_mmd(key)
|
157
|
+
sub(/^ *#{key}:.*?\n/i, "")
|
158
|
+
end
|
159
|
+
|
160
|
+
def has_comment?(key)
|
161
|
+
match(/^<!--.*?#{key}: \S.*?-->/m)
|
162
|
+
end
|
163
|
+
|
164
|
+
def add_comment(key, value)
|
165
|
+
if has_comment?(key)
|
166
|
+
sub(/ *#{key}: .*?$/, "#{key}: #{value}")
|
167
|
+
else
|
168
|
+
lines = split(/\n/)
|
169
|
+
lines.insert(meta_insert_point, "<!--\n#{key}: #{value}\n-->")
|
170
|
+
lines.join("\n")
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def delete_meta(key)
|
175
|
+
case meta_type
|
176
|
+
when :yaml
|
177
|
+
delete_yaml(key)
|
178
|
+
when :mmd
|
179
|
+
delete_mmd(key)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def strip_meta
|
184
|
+
case meta_type
|
185
|
+
when :yaml
|
186
|
+
sub(/^---.*?(---|...)/m, "")
|
187
|
+
when :mmd
|
188
|
+
lines = split(/\n/)
|
189
|
+
lines[meta_insert_point..]
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def replace_all(regex, pattern)
|
194
|
+
gsub(regex.to_rx, pattern.to_pattern)
|
195
|
+
end
|
196
|
+
|
197
|
+
def replace(regex, pattern)
|
198
|
+
sub(regex.to_rx, pattern.to_pattern)
|
199
|
+
end
|
200
|
+
|
201
|
+
def to_rx
|
202
|
+
if self =~ %r{^/(.*?)/([im]+)?$}
|
203
|
+
m = Regexp.last_match
|
204
|
+
regex = m[1]
|
205
|
+
flags = m[2]
|
206
|
+
Regexp.new(regex, flags)
|
207
|
+
else
|
208
|
+
Regexp.new(Regexp.escape(self))
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def to_pattern
|
213
|
+
gsub(/\$(\d+)/, '\\\\\1').gsub(/(^["']|["']$)/, "")
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# String filtering
|
218
|
+
class Filter < String
|
219
|
+
attr_reader :filter, :params
|
220
|
+
|
221
|
+
def initialize(filter)
|
222
|
+
@filter, @params = filter.normalize_filter
|
223
|
+
super
|
224
|
+
end
|
225
|
+
|
226
|
+
def process
|
227
|
+
content = Conductor.stdin
|
228
|
+
|
229
|
+
case @filter
|
230
|
+
when /(insert|add|inject)title/
|
231
|
+
content.insert_title
|
232
|
+
when /(insert|add|inject)script/
|
233
|
+
content = content.append("\n\n<div>")
|
234
|
+
@params.each do |script|
|
235
|
+
content = content.insert_script(script)
|
236
|
+
end
|
237
|
+
"#{content}</div>"
|
238
|
+
when /(add|set)meta/
|
239
|
+
unless @params.count == 2
|
240
|
+
warn "Invalid filter parameters: #{@filter}(#{@params.join(",")})"
|
241
|
+
return content
|
242
|
+
end
|
243
|
+
|
244
|
+
# needs to test for existing meta, setting key if exists, adding if not
|
245
|
+
# should recognize yaml and mmd
|
246
|
+
content.set_meta(@params[0], @params[1], style: content.meta_type)
|
247
|
+
when /(strip|remove)meta/
|
248
|
+
if @params
|
249
|
+
content.delete_meta(@params[0])
|
250
|
+
else
|
251
|
+
content.strip_meta
|
252
|
+
end
|
253
|
+
when /setstyle/
|
254
|
+
# Should check for existing style first
|
255
|
+
content.set_meta("marked style", @params[0], style: :comment)
|
256
|
+
when /replaceall/
|
257
|
+
unless @params.count == 2
|
258
|
+
warn "Invalid filter parameters: #{@filter}(#{@params.join(",")})"
|
259
|
+
return content
|
260
|
+
end
|
261
|
+
|
262
|
+
content.replace_all(@params[0], @params[1])
|
263
|
+
when /replace$/
|
264
|
+
unless @params.count == 2
|
265
|
+
warn "Invalid filter parameters: #{@filter}(#{@params.join(",")})"
|
266
|
+
return content
|
267
|
+
end
|
268
|
+
|
269
|
+
content.replace(@params[0], @params[1])
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
data/lib/conductor/string.rb
CHANGED
data/lib/conductor/version.rb
CHANGED
data/lib/conductor.rb
CHANGED
@@ -14,6 +14,7 @@ require_relative "conductor/hash"
|
|
14
14
|
require_relative "conductor/array"
|
15
15
|
require_relative "conductor/boolean"
|
16
16
|
require_relative "conductor/string"
|
17
|
+
require_relative "conductor/filter"
|
17
18
|
require_relative "conductor/script"
|
18
19
|
require_relative "conductor/command"
|
19
20
|
require_relative "conductor/condition"
|