marked-conductor 1.0.11 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -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&#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_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()","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"]]}}
Binary file
@@ -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>
@@ -104,11 +107,6 @@
104
107
  &mdash;
105
108
  <span class="container">Conductor::Script</span>
106
109
 
107
- <li class="method">
108
- <a href="Conductor/Config.html#method-c-new">::new</a>
109
- &mdash;
110
- <span class="container">Conductor::Config</span>
111
-
112
110
  <li class="method">
113
111
  <a href="Conductor/Command.html#method-c-new">::new</a>
114
112
  &mdash;
@@ -119,6 +117,16 @@
119
117
  &mdash;
120
118
  <span class="container">Conductor::Condition</span>
121
119
 
120
+ <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>
127
+ &mdash;
128
+ <span class="container">Conductor::Config</span>
129
+
122
130
  <li class="method">
123
131
  <a href="Conductor.html#method-c-stdin">::stdin</a>
124
132
  &mdash;
@@ -129,6 +137,21 @@
129
137
  &mdash;
130
138
  <span class="container">Conductor::Env</span>
131
139
 
140
+ <li class="method">
141
+ <a href="String.html#method-i-add_comment">#add_comment</a>
142
+ &mdash;
143
+ <span class="container">String</span>
144
+
145
+ <li class="method">
146
+ <a href="String.html#method-i-add_mmd">#add_mmd</a>
147
+ &mdash;
148
+ <span class="container">String</span>
149
+
150
+ <li class="method">
151
+ <a href="String.html#method-i-add_yaml">#add_yaml</a>
152
+ &mdash;
153
+ <span class="container">String</span>
154
+
132
155
  <li class="method">
133
156
  <a href="Conductor/Command.html#method-i-args-3D">#args=</a>
134
157
  &mdash;
@@ -145,14 +168,14 @@
145
168
  <span class="container">String</span>
146
169
 
147
170
  <li class="method">
148
- <a href="FalseClass.html#method-i-bool-3F">#bool?</a>
171
+ <a href="TrueClass.html#method-i-bool-3F">#bool?</a>
149
172
  &mdash;
150
- <span class="container">FalseClass</span>
173
+ <span class="container">TrueClass</span>
151
174
 
152
175
  <li class="method">
153
- <a href="TrueClass.html#method-i-bool-3F">#bool?</a>
176
+ <a href="FalseClass.html#method-i-bool-3F">#bool?</a>
154
177
  &mdash;
155
- <span class="container">TrueClass</span>
178
+ <span class="container">FalseClass</span>
156
179
 
157
180
  <li class="method">
158
181
  <a href="String.html#method-i-bool_to_symbol">#bool_to_symbol</a>
@@ -174,11 +197,46 @@
174
197
  &mdash;
175
198
  <span class="container">String</span>
176
199
 
200
+ <li class="method">
201
+ <a href="String.html#method-i-delete_meta">#delete_meta</a>
202
+ &mdash;
203
+ <span class="container">String</span>
204
+
205
+ <li class="method">
206
+ <a href="String.html#method-i-delete_mmd">#delete_mmd</a>
207
+ &mdash;
208
+ <span class="container">String</span>
209
+
210
+ <li class="method">
211
+ <a href="String.html#method-i-delete_yaml">#delete_yaml</a>
212
+ &mdash;
213
+ <span class="container">String</span>
214
+
215
+ <li class="method">
216
+ <a href="String.html#method-i-has_comment-3F">#has_comment?</a>
217
+ &mdash;
218
+ <span class="container">String</span>
219
+
177
220
  <li class="method">
178
221
  <a href="String.html#method-i-meta-3F">#meta?</a>
179
222
  &mdash;
180
223
  <span class="container">String</span>
181
224
 
225
+ <li class="method">
226
+ <a href="String.html#method-i-meta_insert_point">#meta_insert_point</a>
227
+ &mdash;
228
+ <span class="container">String</span>
229
+
230
+ <li class="method">
231
+ <a href="String.html#method-i-meta_type">#meta_type</a>
232
+ &mdash;
233
+ <span class="container">String</span>
234
+
235
+ <li class="method">
236
+ <a href="String.html#method-i-normalize_filter">#normalize_filter</a>
237
+ &mdash;
238
+ <span class="container">String</span>
239
+
182
240
  <li class="method">
183
241
  <a href="String.html#method-i-number-3F">#number?</a>
184
242
  &mdash;
@@ -204,6 +262,21 @@
204
262
  &mdash;
205
263
  <span class="container">Conductor::Script</span>
206
264
 
265
+ <li class="method">
266
+ <a href="Filter.html#method-i-process">#process</a>
267
+ &mdash;
268
+ <span class="container">Filter</span>
269
+
270
+ <li class="method">
271
+ <a href="String.html#method-i-replace">#replace</a>
272
+ &mdash;
273
+ <span class="container">String</span>
274
+
275
+ <li class="method">
276
+ <a href="String.html#method-i-replace_all">#replace_all</a>
277
+ &mdash;
278
+ <span class="container">String</span>
279
+
207
280
  <li class="method">
208
281
  <a href="Conductor/Script.html#method-i-run">#run</a>
209
282
  &mdash;
@@ -219,6 +292,11 @@
219
292
  &mdash;
220
293
  <span class="container">Conductor</span>
221
294
 
295
+ <li class="method">
296
+ <a href="String.html#method-i-set_meta">#set_meta</a>
297
+ &mdash;
298
+ <span class="container">String</span>
299
+
222
300
  <li class="method">
223
301
  <a href="Conductor/Condition.html#method-i-split_booleans">#split_booleans</a>
224
302
  &mdash;
@@ -230,20 +308,25 @@
230
308
  <span class="container">Conductor::Condition</span>
231
309
 
232
310
  <li class="method">
233
- <a href="String.html#method-i-strip_time">#strip_time</a>
311
+ <a href="String.html#method-i-strip_meta">#strip_meta</a>
234
312
  &mdash;
235
313
  <span class="container">String</span>
236
314
 
237
315
  <li class="method">
238
- <a href="Array.html#method-i-symbolize_keys">#symbolize_keys</a>
316
+ <a href="String.html#method-i-strip_time">#strip_time</a>
239
317
  &mdash;
240
- <span class="container">Array</span>
318
+ <span class="container">String</span>
241
319
 
242
320
  <li class="method">
243
321
  <a href="Hash.html#method-i-symbolize_keys">#symbolize_keys</a>
244
322
  &mdash;
245
323
  <span class="container">Hash</span>
246
324
 
325
+ <li class="method">
326
+ <a href="Array.html#method-i-symbolize_keys">#symbolize_keys</a>
327
+ &mdash;
328
+ <span class="container">Array</span>
329
+
247
330
  <li class="method">
248
331
  <a href="Array.html#method-i-symbolize_keys-21">#symbolize_keys!</a>
249
332
  &mdash;
@@ -324,6 +407,16 @@
324
407
  &mdash;
325
408
  <span class="container">String</span>
326
409
 
410
+ <li class="method">
411
+ <a href="String.html#method-i-to_pattern">#to_pattern</a>
412
+ &mdash;
413
+ <span class="container">String</span>
414
+
415
+ <li class="method">
416
+ <a href="String.html#method-i-to_rx">#to_rx</a>
417
+ &mdash;
418
+ <span class="container">String</span>
419
+
327
420
  <li class="method">
328
421
  <a href="Conductor/Condition.html#method-i-true-3F">#true?</a>
329
422
  &mdash;
@@ -0,0 +1,196 @@
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 set_meta(key, value, style: :comment)
51
+ case style
52
+ when :yaml
53
+ add_yaml(key, value)
54
+ when :mmd
55
+ add_mmd(key, value)
56
+ else # comment or none
57
+ add_comment(key, value)
58
+ end
59
+ end
60
+
61
+ def add_yaml(key, value)
62
+ sub(/^---.*?\n(---|\.\.\.)/m) do
63
+ m = Regexp.last_match
64
+ yaml = YAML.load(m[0])
65
+ yaml[key] = value
66
+ "#{YAML.dump(yaml)}\n---\n"
67
+ end
68
+ end
69
+
70
+ def delete_yaml(key)
71
+ sub(/^---.*?\n(---|\.\.\.)/m) do
72
+ m = Regexp.last_match
73
+ yaml = YAML.load(m[0])
74
+ yaml.delete(key)
75
+ "#{YAML.dump(yaml)}\n---\n"
76
+ end
77
+ end
78
+
79
+ def add_mmd(key, value)
80
+ if match(/(\A|\n) *#{key}: *\S+/i)
81
+ sub(/^ *#{key}:.*?\n/i, "#{key}: #{value}\n")
82
+ else
83
+ lines = split(/\n/)
84
+ lines.insert(meta_insert_point, "#{key}: #{value}")
85
+ lines.join("\n")
86
+ end
87
+ end
88
+
89
+ def delete_mmd(key)
90
+ sub(/^ *#{key}:.*?\n/i, "")
91
+ end
92
+
93
+ def has_comment?(key)
94
+ match(/^<!--.*?#{key}: \S.*?-->/m)
95
+ end
96
+
97
+ def add_comment(key, value)
98
+ if has_comment?(key)
99
+ sub(/ *#{key}: .*?$/, "#{key}: #{value}")
100
+ else
101
+ lines = split(/\n/)
102
+ lines.insert(meta_insert_point, "<!--\n#{key}: #{value}\n-->")
103
+ lines.join("\n")
104
+ end
105
+ end
106
+
107
+ def delete_meta(key)
108
+ case meta_type
109
+ when :yaml
110
+ delete_yaml(key)
111
+ when :mmd
112
+ delete_mmd(key)
113
+ end
114
+ end
115
+
116
+ def strip_meta
117
+ case meta_type
118
+ when :yaml
119
+ sub(/^---.*?(---|...)/m, "")
120
+ when :mmd
121
+ lines = split(/\n/)
122
+ lines[meta_insert_point..]
123
+ end
124
+ end
125
+
126
+ def replace_all(regex, pattern)
127
+ gsub(regex.to_rx, pattern.to_pattern)
128
+ end
129
+
130
+ def replace(regex, pattern)
131
+ sub(regex.to_rx, pattern.to_pattern)
132
+ end
133
+
134
+ def to_rx
135
+ if self =~ %r{^/(.*?)/([im]+)?$}
136
+ m = Regexp.last_match
137
+ regex = m[1]
138
+ flags = m[2]
139
+ Regexp.new(regex, flags)
140
+ else
141
+ Regexp.new(Regexp.escape(self))
142
+ end
143
+ end
144
+
145
+ def to_pattern
146
+ gsub(/\$(\d+)/, '\\\\\1').gsub(/(^["']|["']$)/, '')
147
+ end
148
+ end
149
+
150
+ # String filtering
151
+ class Filter < String
152
+ attr_reader :filter, :params
153
+
154
+ def initialize(filter)
155
+ @filter, @params = filter.normalize_filter
156
+ end
157
+
158
+ def process
159
+ content = Conductor.stdin
160
+
161
+ case @filter
162
+ when /(add|set)meta/
163
+ unless @params.count == 2
164
+ warn "Invalid filter parameters: #{@filter}(#{@params.join(",")})"
165
+ return content
166
+ end
167
+
168
+ # needs to test for existing meta, setting key if exists, adding if not
169
+ # should recognize yaml and mmd
170
+ content.set_meta(@params[0], @params[1], style: content.meta_type)
171
+ when /(strip|remove)meta/
172
+ if @params
173
+ content.delete_meta(@params[0])
174
+ else
175
+ content.strip_meta
176
+ end
177
+ when /setstyle/
178
+ # Should check for existing style first
179
+ content.set_meta("marked style", @params[0], style: :comment)
180
+ when /replaceall/
181
+ unless @params.count == 2
182
+ warn "Invalid filter parameters: #{@filter}(#{@params.join(",")})"
183
+ return content
184
+ end
185
+
186
+ content.replace_all(@params[0], @params[1])
187
+ when /replace$/
188
+ unless @params.count == 2
189
+ warn "Invalid filter parameters: #{@filter}(#{@params.join(",")})"
190
+ return content
191
+ end
192
+
193
+ content.replace(@params[0], @params[1])
194
+ end
195
+ end
196
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conductor
4
- VERSION = '1.0.11'
4
+ VERSION = '1.0.13'
5
5
  end
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"
@@ -25,7 +26,7 @@ module Conductor
25
26
 
26
27
  def stdin
27
28
  warn "input on STDIN required" unless $stdin.stat.size.positive? || $stdin.fcntl(Fcntl::F_GETFL, 0).zero?
28
- @stdin ||= $stdin.read.strip.force_encoding("utf-8")
29
+ @stdin ||= $stdin.read.force_encoding("utf-8")
29
30
  end
30
31
  end
31
32
  end
data/src/_README.md CHANGED
@@ -142,8 +142,8 @@ A script run by Conductor already knows it has the right type of file with the e
142
142
  ## Tips
143
143
 
144
144
  - Config file must be valid YAML. Any value containing colons, brackets, or other special characters should be quoted, e.g. (`condition: "text contains my:text"`)
145
- - You can see what condition matched in Marked by opening <b>Help->Show Custom Processor Log</b> and checking the STDERR output.
146
- - To run [a custom processor for Bear](https://brettterpstra.com/2023/10/08/marked-and-bear/), use the condition `"text contains <!-- source: bear.app -->"`
145
+ - You can see what condition matched in Marked by opening **Help->Show Custom Processor Log** and checking the STDERR output.
146
+ - To run [a custom processor for Bear](https://brettterpstra.com/2023/10/08/marked-and-bear/), use the condition `"text contains <!-- source: bear.app -->"`. You might consider running a commonmark CLI with Bear to support more of its syntax.
147
147
  - To run a custom processor for Obsidian, use the condition `tree contains .obsidian`
148
148
 
149
149
  ## Testing
@@ -154,6 +154,8 @@ In Marked's Custom Processor Log, you can see both the STDOUT output and the STD
154
154
 
155
155
  ### From the command line
156
156
 
157
+ > There's a script included in the repo called [test.sh](https://github.com/ttscoff/marked-conductor/blob/main/test.sh) that will take a file path as an argument and set all of the environment variables for testing. Run `test.sh -h` for usage instructions.
158
+
157
159
  In order to test from the command line, you'll need certain environment variables set. This can be done by exporting the following variables with your own definitions, or by running conductor with all of the variables preceding the command, e.g. `$ MARKED_ORIGIN=/path/to/markdown_file.md [...] conductor`.
158
160
 
159
161
  The following need to be defined. Some can be left as empty or to defaults, such as `MARKED_INCLUDES` and `MARKED_OUTLINE`, but all need to be set to something.
data/test.sh ADDED
@@ -0,0 +1,83 @@
1
+ #!/bin/bash
2
+
3
+ # ./test.sh PATH [pr[eo]]
4
+
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
10
+
11
+ show_help() {
12
+ echo "$(basename $0): Shortcut for testing conductor with a given file"
13
+ echo "Options:"
14
+ echo " -p [pre|pro] (run as preprocessor(*) or processor)"
15
+ echo " -o [err|out] (output stderr, stdout, both(*))"
16
+ echo " -d (debug, only show stderr)"
17
+ echo "Usage:"
18
+ echo " $0 [-p PHASE] [-o OUTPUT] FILE_PATH"
19
+ }
20
+
21
+ if [[ -d bin ]]; then
22
+ CMD="./bin/conductor"
23
+ else
24
+ CMD="$(which conductor)"
25
+ fi
26
+
27
+ PHASE="PREPROCESS"
28
+ STD="BOTH"
29
+
30
+ while getopts "h?p:o:d" opt; do
31
+ case "$opt" in
32
+ h|\?)
33
+ show_help
34
+ exit 0
35
+ ;;
36
+ p) PHASE=$OPTARG
37
+ ;;
38
+ o) STD=$OPTARG
39
+ ;;
40
+ d)
41
+ STD="ERR"
42
+ ;;
43
+ esac
44
+ done
45
+
46
+ shift $((OPTIND-1))
47
+
48
+ [ "${1:-}" = "--" ] && shift
49
+
50
+ if [[ -z $1 ]]; then
51
+ show_help
52
+ exit 1
53
+ fi
54
+
55
+ FILE=$(realpath $1)
56
+ FILENAME=$(basename -- "$FILE")
57
+ EXTENSION="${FILENAME##*.}"
58
+ PHASE=$(echo $PHASE | tr [a-z] [A-Z])
59
+ STD=$(echo $STD | tr [a-z] [A-Z])
60
+
61
+ if [[ $PHASE =~ ^PRE ]]; then
62
+ PHASE="PREPROCESS"
63
+ else
64
+ PHASE="PROCESS"
65
+ fi
66
+
67
+ export OUTLINE="NONE"
68
+ export MARKED_ORIGIN="$FILE"
69
+ export MARKED_EXT="$EXTENSION"
70
+ export MARKED_CSS_PATH="/Applications/Marked 2.app/Contents/Resources/swiss.css"
71
+ export PATH="$PATH:$(dirname "$FILE")"
72
+ export MARKED_PATH="$FILE"
73
+ export MARKED_INCLUDES=""
74
+ export MARKED_PHASE="$PHASE"
75
+
76
+ if [[ $STD =~ ^(STD)?E ]]; then
77
+ command cat "$FILE" | $CMD 1>/dev/null
78
+ elif [[ $STD =~ ^(STD)?O ]]; then
79
+ command cat "$FILE" | $CMD 2>/dev/null
80
+ else
81
+ command cat "$FILE" | $CMD
82
+ fi
83
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marked-conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-29 00:00:00.000000000 Z
11
+ date: 2024-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -269,12 +269,14 @@ files:
269
269
  - lib/conductor/condition.rb
270
270
  - lib/conductor/config.rb
271
271
  - lib/conductor/env.rb
272
+ - lib/conductor/filter.rb
272
273
  - lib/conductor/hash.rb
273
274
  - lib/conductor/script.rb
274
275
  - lib/conductor/string.rb
275
276
  - lib/conductor/version.rb
276
277
  - marked-conductor.gemspec
277
278
  - src/_README.md
279
+ - test.sh
278
280
  homepage: https://github.com/ttscoff/marked-conductor
279
281
  licenses:
280
282
  - MIT