marked-conductor 1.0.15 → 1.0.16
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 +9 -0
- data/README.md +12 -3
- data/html/Array.html +1 -1
- data/html/Conductor/Command.html +1 -1
- data/html/Conductor/Condition.html +1 -1
- data/html/Conductor/Config.html +1 -1
- data/html/Conductor/Env.html +1 -1
- data/html/Conductor/Script.html +1 -1
- data/html/Conductor.html +2 -2
- data/html/FalseClass.html +1 -1
- data/html/Filter.html +8 -3
- data/html/Hash.html +1 -1
- data/html/Object.html +1 -1
- data/html/README_rdoc.html +1 -1
- data/html/String.html +96 -20
- data/html/TrueClass.html +1 -1
- data/html/created.rid +5 -4
- data/html/index.html +5 -1
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +53 -17
- data/lib/conductor/filter.rb +41 -0
- data/lib/conductor/version.rb +1 -1
- data/lib/conductor/yui-compressor.rb +230 -0
- data/lib/conductor.rb +1 -0
- data/src/_README.md +12 -3
- metadata +3 -2
data/html/js/search_index.js
CHANGED
@@ -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()","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'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"]]}}
|
1
|
+
var search_data = {"index":{"searchIndex":["array","conductor","command","condition","config","env","script","falseclass","filter","hash","object","string","trueclass","yuicompressor","yui","add_comment()","add_mmd()","add_yaml()","append()","args=()","args=()","bool?()","bool?()","bool?()","bool_to_symbol()","clean_condition()","compress()","conduct()","create_config()","date?()","delete_meta()","delete_mmd()","delete_yaml()","env()","execute_track()","first_h1()","first_h2()","get_title()","has_comment?()","insert_css()","insert_file()","insert_script()","insert_title()","insert_toc()","load_test_env()","meta?()","meta_insert_point()","meta_type()","new()","new()","new()","new()","new()","new()","normalize_filter()","normalize_include_type()","normalize_position()","number?()","operator_to_symbol()","parse_condition()","path=()","path=()","process()","process_comments_and_strings()","replace()","replace_all()","restore_preserved_comments_and_strings()","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?()","wrap_style()","yaml?()","readme"],"longSearchIndex":["array","conductor","conductor::command","conductor::condition","conductor::config","conductor::env","conductor::script","falseclass","filter","hash","object","string","trueclass","yuicompressor","yuicompressor::yui","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()","yuicompressor::yui#compress()","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_css()","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()","yuicompressor::yui::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()","yuicompressor::yui#process_comments_and_strings()","string#replace()","string#replace_all()","yuicompressor::yui#restore_preserved_comments_and_strings()","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#wrap_style()","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"],["YuiCompressor","","YuiCompressor.html","","<p>This is a Ruby port of the YUI CSS compressor See LICENSE for license information\n"],["YuiCompressor::Yui","","YuiCompressor/Yui.html","","<p>Compress CSS rules using a variety of techniques\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"],["compress","YuiCompressor::Yui","YuiCompressor/Yui.html#method-i-compress","(css, line_length = 0)",""],["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_css","String","String.html#method-i-insert_css","(path)",""],["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)",""],["new","YuiCompressor::Yui","YuiCompressor/Yui.html#method-c-new","()",""],["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","()",""],["process_comments_and_strings","YuiCompressor::Yui","YuiCompressor/Yui.html#method-i-process_comments_and_strings","(css_text)",""],["replace","String","String.html#method-i-replace","(regex, pattern)",""],["replace_all","String","String.html#method-i-replace_all","(regex, pattern)",""],["restore_preserved_comments_and_strings","YuiCompressor::Yui","YuiCompressor/Yui.html#method-i-restore_preserved_comments_and_strings","(clean_css)",""],["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"],["wrap_style","String","String.html#method-i-wrap_style","()",""],["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/js/searcher.js.gz
CHANGED
Binary file
|
data/html/table_of_contents.html
CHANGED
@@ -77,6 +77,12 @@
|
|
77
77
|
<li class="class">
|
78
78
|
<a href="TrueClass.html">TrueClass</a>
|
79
79
|
</li>
|
80
|
+
<li class="module">
|
81
|
+
<a href="YuiCompressor.html">YuiCompressor</a>
|
82
|
+
</li>
|
83
|
+
<li class="class">
|
84
|
+
<a href="YuiCompressor/Yui.html">YuiCompressor::Yui</a>
|
85
|
+
</li>
|
80
86
|
</ul>
|
81
87
|
|
82
88
|
<h2 id="methods">Methods</h2>
|
@@ -103,19 +109,19 @@
|
|
103
109
|
<span class="container">Conductor::Env</span>
|
104
110
|
|
105
111
|
<li class="method">
|
106
|
-
<a href="
|
112
|
+
<a href="YuiCompressor/Yui.html#method-c-new">::new</a>
|
107
113
|
—
|
108
|
-
<span class="container">
|
114
|
+
<span class="container">YuiCompressor::Yui</span>
|
109
115
|
|
110
116
|
<li class="method">
|
111
|
-
<a href="Conductor/
|
117
|
+
<a href="Conductor/Command.html#method-c-new">::new</a>
|
112
118
|
—
|
113
|
-
<span class="container">Conductor::
|
119
|
+
<span class="container">Conductor::Command</span>
|
114
120
|
|
115
121
|
<li class="method">
|
116
|
-
<a href="
|
122
|
+
<a href="Conductor/Config.html#method-c-new">::new</a>
|
117
123
|
—
|
118
|
-
<span class="container">
|
124
|
+
<span class="container">Conductor::Config</span>
|
119
125
|
|
120
126
|
<li class="method">
|
121
127
|
<a href="Conductor/Condition.html#method-c-new">::new</a>
|
@@ -123,9 +129,14 @@
|
|
123
129
|
<span class="container">Conductor::Condition</span>
|
124
130
|
|
125
131
|
<li class="method">
|
126
|
-
<a href="
|
132
|
+
<a href="Filter.html#method-c-new">::new</a>
|
127
133
|
—
|
128
|
-
<span class="container">
|
134
|
+
<span class="container">Filter</span>
|
135
|
+
|
136
|
+
<li class="method">
|
137
|
+
<a href="Conductor/Script.html#method-c-new">::new</a>
|
138
|
+
—
|
139
|
+
<span class="container">Conductor::Script</span>
|
129
140
|
|
130
141
|
<li class="method">
|
131
142
|
<a href="Conductor.html#method-c-stdin">::stdin</a>
|
@@ -158,14 +169,14 @@
|
|
158
169
|
<span class="container">String</span>
|
159
170
|
|
160
171
|
<li class="method">
|
161
|
-
<a href="Conductor/
|
172
|
+
<a href="Conductor/Command.html#method-i-args-3D">#args=</a>
|
162
173
|
—
|
163
|
-
<span class="container">Conductor::
|
174
|
+
<span class="container">Conductor::Command</span>
|
164
175
|
|
165
176
|
<li class="method">
|
166
|
-
<a href="Conductor/
|
177
|
+
<a href="Conductor/Script.html#method-i-args-3D">#args=</a>
|
167
178
|
—
|
168
|
-
<span class="container">Conductor::
|
179
|
+
<span class="container">Conductor::Script</span>
|
169
180
|
|
170
181
|
<li class="method">
|
171
182
|
<a href="String.html#method-i-bool-3F">#bool?</a>
|
@@ -192,6 +203,11 @@
|
|
192
203
|
—
|
193
204
|
<span class="container">Object</span>
|
194
205
|
|
206
|
+
<li class="method">
|
207
|
+
<a href="YuiCompressor/Yui.html#method-i-compress">#compress</a>
|
208
|
+
—
|
209
|
+
<span class="container">YuiCompressor::Yui</span>
|
210
|
+
|
195
211
|
<li class="method">
|
196
212
|
<a href="Conductor.html#method-i-create_config">#create_config</a>
|
197
213
|
—
|
@@ -237,6 +253,11 @@
|
|
237
253
|
—
|
238
254
|
<span class="container">String</span>
|
239
255
|
|
256
|
+
<li class="method">
|
257
|
+
<a href="String.html#method-i-insert_css">#insert_css</a>
|
258
|
+
—
|
259
|
+
<span class="container">String</span>
|
260
|
+
|
240
261
|
<li class="method">
|
241
262
|
<a href="String.html#method-i-insert_file">#insert_file</a>
|
242
263
|
—
|
@@ -303,20 +324,25 @@
|
|
303
324
|
<span class="container">Conductor::Condition</span>
|
304
325
|
|
305
326
|
<li class="method">
|
306
|
-
<a href="Conductor/
|
327
|
+
<a href="Conductor/Command.html#method-i-path-3D">#path=</a>
|
307
328
|
—
|
308
|
-
<span class="container">Conductor::
|
329
|
+
<span class="container">Conductor::Command</span>
|
309
330
|
|
310
331
|
<li class="method">
|
311
|
-
<a href="Conductor/
|
332
|
+
<a href="Conductor/Script.html#method-i-path-3D">#path=</a>
|
312
333
|
—
|
313
|
-
<span class="container">Conductor::
|
334
|
+
<span class="container">Conductor::Script</span>
|
314
335
|
|
315
336
|
<li class="method">
|
316
337
|
<a href="Filter.html#method-i-process">#process</a>
|
317
338
|
—
|
318
339
|
<span class="container">Filter</span>
|
319
340
|
|
341
|
+
<li class="method">
|
342
|
+
<a href="YuiCompressor/Yui.html#method-i-process_comments_and_strings">#process_comments_and_strings</a>
|
343
|
+
—
|
344
|
+
<span class="container">YuiCompressor::Yui</span>
|
345
|
+
|
320
346
|
<li class="method">
|
321
347
|
<a href="String.html#method-i-replace">#replace</a>
|
322
348
|
—
|
@@ -327,6 +353,11 @@
|
|
327
353
|
—
|
328
354
|
<span class="container">String</span>
|
329
355
|
|
356
|
+
<li class="method">
|
357
|
+
<a href="YuiCompressor/Yui.html#method-i-restore_preserved_comments_and_strings">#restore_preserved_comments_and_strings</a>
|
358
|
+
—
|
359
|
+
<span class="container">YuiCompressor::Yui</span>
|
360
|
+
|
330
361
|
<li class="method">
|
331
362
|
<a href="Conductor/Command.html#method-i-run">#run</a>
|
332
363
|
—
|
@@ -482,6 +513,11 @@
|
|
482
513
|
—
|
483
514
|
<span class="container">Conductor::Condition</span>
|
484
515
|
|
516
|
+
<li class="method">
|
517
|
+
<a href="String.html#method-i-wrap_style">#wrap_style</a>
|
518
|
+
—
|
519
|
+
<span class="container">String</span>
|
520
|
+
|
485
521
|
<li class="method">
|
486
522
|
<a href="String.html#method-i-yaml-3F">#yaml?</a>
|
487
523
|
—
|
@@ -492,7 +528,7 @@
|
|
492
528
|
|
493
529
|
<footer id="validator-badges" role="contentinfo">
|
494
530
|
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
495
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.
|
531
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.7.0.
|
496
532
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
497
533
|
</footer>
|
498
534
|
|
data/lib/conductor/filter.rb
CHANGED
@@ -84,6 +84,42 @@ class ::String
|
|
84
84
|
lines.insert(line, "\n<!--toc#{max}-->\n").join("\n")
|
85
85
|
end
|
86
86
|
|
87
|
+
def wrap_style
|
88
|
+
if match(%r{<style>.*?</style>}m)
|
89
|
+
self
|
90
|
+
else
|
91
|
+
"<style>#{self}</style>"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def insert_css(path)
|
96
|
+
path.sub!(/(\.css)?$/, '.css')
|
97
|
+
|
98
|
+
if path =~ %r{^[~/]}
|
99
|
+
path = File.expand_path(path)
|
100
|
+
elsif File.directory?(File.expand_path("~/.config/conductor/css"))
|
101
|
+
new_path = File.expand_path("~/.config/conductor/css/#{path}")
|
102
|
+
path = new_path if File.exist?(new_path)
|
103
|
+
elsif File.directory?(File.expand_path("~/.config/conductor/files"))
|
104
|
+
new_path = File.expand_path("~/.config/conductor/files/#{path}")
|
105
|
+
path = new_path if File.exist?(new_path)
|
106
|
+
end
|
107
|
+
|
108
|
+
if File.exist?(path)
|
109
|
+
content = IO.read(path)
|
110
|
+
yui = YuiCompressor::Yui.new
|
111
|
+
content = yui.compress(content)
|
112
|
+
lines = split(/\n/)
|
113
|
+
insert_point = meta_insert_point
|
114
|
+
insert_at = insert_point.positive? ? insert_point + 1 : 0
|
115
|
+
lines.insert(insert_at, "#{content.wrap_style}\n\n")
|
116
|
+
lines.join("\n")
|
117
|
+
else
|
118
|
+
warn "File not found (#{path})"
|
119
|
+
self
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
87
123
|
def insert_file(path, type = :file, position = :end)
|
88
124
|
path.strip!
|
89
125
|
|
@@ -294,6 +330,11 @@ class Filter < String
|
|
294
330
|
content = Conductor.stdin
|
295
331
|
|
296
332
|
case @filter
|
333
|
+
when /(insert|add|inject)(css|style)/
|
334
|
+
@params.each do |css|
|
335
|
+
content = content.insert_css(css)
|
336
|
+
end
|
337
|
+
content
|
297
338
|
when /(insert|add|inject)title/
|
298
339
|
content.insert_title
|
299
340
|
when /(insert|add|inject)script/
|
data/lib/conductor/version.rb
CHANGED
@@ -0,0 +1,230 @@
|
|
1
|
+
# This is a Ruby port of the YUI CSS compressor
|
2
|
+
# See LICENSE for license information
|
3
|
+
|
4
|
+
module YuiCompressor
|
5
|
+
# Compress CSS rules using a variety of techniques
|
6
|
+
|
7
|
+
class Yui
|
8
|
+
attr_reader :input_size, :output_size
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@preservedTokens = []
|
12
|
+
@comments = []
|
13
|
+
@input_size = 0
|
14
|
+
@output_size = 0
|
15
|
+
end
|
16
|
+
|
17
|
+
def compress(css, line_length = 0)
|
18
|
+
@input_size = css.length
|
19
|
+
|
20
|
+
css = process_comments_and_strings(css)
|
21
|
+
|
22
|
+
# Normalize all whitespace strings to single spaces. Easier to work with that way.
|
23
|
+
css.gsub!(/\s+/, ' ')
|
24
|
+
|
25
|
+
# Remove the spaces before the things that should not have spaces before them.
|
26
|
+
# But, be careful not to turn "p :link {...}" into "p:link{...}"
|
27
|
+
# Swap out any pseudo-class colons with the token, and then swap back.
|
28
|
+
css.gsub!(/(?:^|\})[^{:]+\s+:+[^{]*\{/) do |match|
|
29
|
+
match.gsub(':', '___PSEUDOCLASSCOLON___')
|
30
|
+
end
|
31
|
+
css.gsub!(/\s+([!{};:>+()\],])/, '\1')
|
32
|
+
css.gsub!(/([!{}:;>+(\[,])\s+/, '\1')
|
33
|
+
css.gsub!('___PSEUDOCLASSCOLON___', ':')
|
34
|
+
|
35
|
+
# special case for IE
|
36
|
+
css.gsub!(/:first-(line|letter)(\{|,)/, ':first-\1 \2')
|
37
|
+
|
38
|
+
# no space after the end of a preserved comment
|
39
|
+
css.gsub!(%r{\*/ }, '*/')
|
40
|
+
|
41
|
+
# If there is a @charset, then only allow one, and push to the top of the file.
|
42
|
+
css.gsub!(/^(.*)(@charset "[^"]*";)/i, '\2\1')
|
43
|
+
css.gsub!(/^(\s*@charset [^;]+;\s*)+/i, '\1')
|
44
|
+
|
45
|
+
# Put the space back in some cases, to support stuff like
|
46
|
+
# @media screen and (-webkit-min-device-pixel-ratio:0){
|
47
|
+
css.gsub!(/\band\(/i, 'and (')
|
48
|
+
|
49
|
+
# remove unnecessary semicolons
|
50
|
+
css.gsub!(/;+\}/, '}')
|
51
|
+
|
52
|
+
# Replace 0(%, em, ex, px, in, cm, mm, pt, pc) with just 0.
|
53
|
+
css.gsub!(/([\s:])([+-]?0)(?:%|em|ex|px|in|cm|mm|pt|pc)/i, '\1\2')
|
54
|
+
|
55
|
+
# Replace 0 0 0 0; with 0.
|
56
|
+
css.gsub!(/:(?:0 )+0(;|\})/, ':0\1')
|
57
|
+
|
58
|
+
# Restore background-position:0 0; if required
|
59
|
+
css.gsub!(/(background-position|transform-origin|webkit-transform-origin|moz-transform-origin|o-transform-origin|ms-transform-origin):0(;|\})/i) {
|
60
|
+
"#{::Regexp.last_match(1).downcase}:0 0#{::Regexp.last_match(2)}" }
|
61
|
+
|
62
|
+
# Replace 0.6 with .6, but only when preceded by : or a space.
|
63
|
+
css.gsub!(/(:|\s)0+\.(\d+)/, '\1.\2')
|
64
|
+
|
65
|
+
# Shorten colors from rgb(51,102,153) to #336699
|
66
|
+
# This makes it more likely that it'll get further compressed in the next step.
|
67
|
+
css.gsub!(/rgb\s*\(\s*([0-9,\s]+)\s*\)/) do |_match|
|
68
|
+
'#' << ::Regexp.last_match(1).scan(/\d+/).map {|n| n.to_i.to_s(16).rjust(2, '0') }.join
|
69
|
+
end
|
70
|
+
|
71
|
+
# Shorten colors from #AABBCC to #ABC. Note that we want to make sure
|
72
|
+
# the color is not preceded by either ", " or =. Indeed, the property
|
73
|
+
# filter: chroma(color="#FFFFFF");
|
74
|
+
# would become
|
75
|
+
# filter: chroma(color="#FFF");
|
76
|
+
# which makes the filter break in IE.
|
77
|
+
css.gsub!(/([^"'=\s])(\s?)\s*#([0-9a-f])\3([0-9a-f])\4([0-9a-f])\5/i, '\1\2#\3\4\5')
|
78
|
+
|
79
|
+
# border: none -> border:0
|
80
|
+
css.gsub!(/(border|border-top|border-right|border-bottom|border-right|outline|background):none(;|\})/i) {
|
81
|
+
"#{::Regexp.last_match(1).downcase}:0#{::Regexp.last_match(2)}" }
|
82
|
+
|
83
|
+
# shorter opacity IE filter
|
84
|
+
css.gsub!(/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/i, 'alpha(opacity=')
|
85
|
+
|
86
|
+
# Remove empty rules.
|
87
|
+
css.gsub!(%r{[^\};\{/]+\{\}}, '')
|
88
|
+
|
89
|
+
if line_length > 0
|
90
|
+
# Some source control tools don't like it when files containing lines longer
|
91
|
+
# than, say 8000 characters, are checked in. The linebreak option is used in
|
92
|
+
# that case to split long lines after a specific column.
|
93
|
+
startIndex = 0
|
94
|
+
index = 0
|
95
|
+
length = css.length
|
96
|
+
while index < length
|
97
|
+
index += 1
|
98
|
+
if css[index - 1, 1] === '}' && index - startIndex > line_length
|
99
|
+
css = css.slice(0, index) + "\n" + css.slice(index, length)
|
100
|
+
startIndex = index
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Replace multiple semi-colons in a row by a single one
|
106
|
+
# See SF bug #1980989
|
107
|
+
css.gsub!(/;+/, ';')
|
108
|
+
|
109
|
+
# restore preserved comments and strings
|
110
|
+
css = restore_preserved_comments_and_strings(css)
|
111
|
+
|
112
|
+
# top and tail whitespace
|
113
|
+
css.strip!
|
114
|
+
|
115
|
+
@output_size = css.length
|
116
|
+
css
|
117
|
+
end
|
118
|
+
|
119
|
+
def process_comments_and_strings(css_text)
|
120
|
+
css = css_text.clone
|
121
|
+
|
122
|
+
startIndex = 0
|
123
|
+
endIndex = 0
|
124
|
+
i = 0
|
125
|
+
max = 0
|
126
|
+
token = ''
|
127
|
+
totallen = css.length
|
128
|
+
placeholder = ''
|
129
|
+
|
130
|
+
# collect all comment blocks
|
131
|
+
while (startIndex = css.index(%r{/\*}, startIndex))
|
132
|
+
endIndex = css.index(%r{\*/}, startIndex + 2)
|
133
|
+
endIndex = totallen unless endIndex
|
134
|
+
token = css.slice(startIndex + 2..endIndex - 1)
|
135
|
+
@comments.push(token)
|
136
|
+
css = css.slice(0..startIndex + 1).to_s + '___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_' + (@comments.length - 1).to_s + '___' + css.slice(
|
137
|
+
endIndex, totallen).to_s
|
138
|
+
startIndex += 2
|
139
|
+
end
|
140
|
+
|
141
|
+
# preserve strings so their content doesn't get accidentally minified
|
142
|
+
css.gsub!(/("([^\\"]|\\.|\\)*")|('([^\\']|\\.|\\)*')/) do |match|
|
143
|
+
quote = match[0, 1]
|
144
|
+
string = match.slice(1..-2)
|
145
|
+
|
146
|
+
# maybe the string contains a comment-like substring?
|
147
|
+
# one, maybe more? put'em back then
|
148
|
+
if string =~ /___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_/
|
149
|
+
@comments.each_index do |index|
|
150
|
+
string.gsub!(/___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_#{index}___/, @comments[index])
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# minify alpha opacity in filter strings
|
155
|
+
string.gsub!(/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/i, 'alpha(opacity=')
|
156
|
+
@preservedTokens.push(string)
|
157
|
+
|
158
|
+
quote + '___YUICSSMIN_PRESERVED_TOKEN_' + (@preservedTokens.length - 1).to_s + '___' + quote
|
159
|
+
end
|
160
|
+
|
161
|
+
# used to jump one index in loop
|
162
|
+
ie5_hack = false
|
163
|
+
# strings are safe, now wrestle the comments
|
164
|
+
@comments.each_index do |index|
|
165
|
+
if ie5_hack
|
166
|
+
ie5_hack = false
|
167
|
+
next
|
168
|
+
end
|
169
|
+
|
170
|
+
token = @comments[index]
|
171
|
+
placeholder = '___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_' + index.to_s + '___'
|
172
|
+
|
173
|
+
# ! in the first position of the comment means preserve
|
174
|
+
# so push to the preserved tokens keeping the !
|
175
|
+
if token[0, 1] === '!'
|
176
|
+
@preservedTokens.push(token)
|
177
|
+
css.gsub!(/#{placeholder}/i, '___YUICSSMIN_PRESERVED_TOKEN_' + (@preservedTokens.length - 1).to_s + '___')
|
178
|
+
next
|
179
|
+
end
|
180
|
+
|
181
|
+
# \ in the last position looks like hack for Mac/IE5
|
182
|
+
# shorten that to /*\*/ and the next one to /**/
|
183
|
+
if token[-1, 1] === '\\'
|
184
|
+
@preservedTokens.push('\\')
|
185
|
+
css.gsub!(/#{placeholder}/, '___YUICSSMIN_PRESERVED_TOKEN_' + (@preservedTokens.length - 1).to_s + '___')
|
186
|
+
# keep the next comment but remove its content
|
187
|
+
@preservedTokens.push('')
|
188
|
+
css.gsub!(/___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_#{index + 1}___/,
|
189
|
+
'___YUICSSMIN_PRESERVED_TOKEN_' + (@preservedTokens.length - 1).to_s + '___')
|
190
|
+
ie5_hack = true
|
191
|
+
next
|
192
|
+
end
|
193
|
+
|
194
|
+
# keep empty comments after child selectors (IE7 hack)
|
195
|
+
# e.g. html >/**/ body
|
196
|
+
if (token.length === 0) && (startIndex = css.index(/#{placeholder}/))
|
197
|
+
if startIndex > 2
|
198
|
+
if css[startIndex - 3, 1] === '>'
|
199
|
+
@preservedTokens.push('')
|
200
|
+
css.gsub!(/#{placeholder}/, '___YUICSSMIN_PRESERVED_TOKEN_' + (@preservedTokens.length - 1).to_s + '___')
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# in all other cases kill the comment
|
206
|
+
css.gsub!(%r{/\*#{placeholder}\*/}, '')
|
207
|
+
end
|
208
|
+
|
209
|
+
css
|
210
|
+
end
|
211
|
+
|
212
|
+
def restore_preserved_comments_and_strings(clean_css)
|
213
|
+
css = clean_css.clone
|
214
|
+
css_length = css.length
|
215
|
+
@preservedTokens.each_index do |index|
|
216
|
+
# slice these back into place rather than regex, because
|
217
|
+
# complex nested strings cause the replacement to fail
|
218
|
+
placeholder = "___YUICSSMIN_PRESERVED_TOKEN_#{index}___"
|
219
|
+
startIndex = css.index(placeholder, 0)
|
220
|
+
next unless startIndex # skip if nil
|
221
|
+
|
222
|
+
endIndex = startIndex + placeholder.length
|
223
|
+
|
224
|
+
css = css.slice(0..startIndex - 1).to_s + @preservedTokens[index] + css.slice(endIndex, css_length).to_s
|
225
|
+
end
|
226
|
+
|
227
|
+
css
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
data/lib/conductor.rb
CHANGED
data/src/_README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
# Marked Conductor
|
5
5
|
|
6
|
-
A "train conductor" for [Marked 2](https://marked2app.com). Conductor can be set up as a Custom Preprocessor or Custom Processor for Marked, and can run different commands and scripts based on conditions in a YAML configuration file, allowing you to have multiple processors that run based on predicates.
|
6
|
+
A "train conductor" for [Marked 2](https://marked2app.com) (Mac only). Conductor can be set up as a Custom Preprocessor or Custom Processor for Marked, and can run different commands and scripts based on conditions in a YAML configuration file, allowing you to have multiple processors that run based on predicates.
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -124,12 +124,16 @@ Conditions can be combined with AND or OR (must be uppercase) and simple parenth
|
|
124
124
|
|
125
125
|
The action can be `script`, `command`, or `filter`.
|
126
126
|
|
127
|
+
#### Scripts
|
128
|
+
|
127
129
|
**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
130
|
|
129
131
|
> Example:
|
130
132
|
>
|
131
133
|
> script: github_pre
|
132
134
|
|
135
|
+
#### Commands
|
136
|
+
|
133
137
|
**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
138
|
|
135
139
|
> Example:
|
@@ -139,7 +143,10 @@ The action can be `script`, `command`, or `filter`.
|
|
139
143
|
|
140
144
|
> 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
145
|
|
146
|
+
#### Filters
|
147
|
+
|
142
148
|
**Filters** are simple actions that can be run on the content without having to write a separate script for it. Available filters are:
|
149
|
+
|
143
150
|
| filter | description |
|
144
151
|
| :---- | :---------- |
|
145
152
|
| `setMeta(key, value)` | adds or updates a meta key, aware of YAML and MMD |
|
@@ -155,9 +162,11 @@ The action can be `script`, `command`, or `filter`.
|
|
155
162
|
| `prepend/appendRaw(path)` | insert a file as raw HTML at beginning or end of content |
|
156
163
|
| `prepend/appendCode(path)` | insert a file as a code block at beginning or end of content |
|
157
164
|
|
165
|
+
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`.
|
166
|
+
|
158
167
|
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
168
|
|
160
|
-
For
|
169
|
+
For all of the prepend/append file filters, you can store files in `~/.config/conductor/files` and reference them with just a filename. Otherwise a full path will be assumed.
|
161
170
|
|
162
171
|
> Example:
|
163
172
|
>
|
@@ -180,7 +189,7 @@ A script run by Conductor already knows it has the right type of file with the e
|
|
180
189
|
- 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"`)
|
181
190
|
- You can see what condition matched in Marked by opening **Help->Show Custom Processor Log** and checking the STDERR output.
|
182
191
|
- 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.
|
183
|
-
- To run a custom processor for Obsidian, use the condition `tree contains .obsidian`
|
192
|
+
- To run a [custom processor for Obsidian](https://brettterpstra.com/2024/05/16/marked-2-and-obsidian/), use the condition `tree contains .obsidian`
|
184
193
|
|
185
194
|
## Testing
|
186
195
|
|
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.
|
4
|
+
version: 1.0.16
|
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-
|
11
|
+
date: 2024-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -275,6 +275,7 @@ files:
|
|
275
275
|
- lib/conductor/script.rb
|
276
276
|
- lib/conductor/string.rb
|
277
277
|
- lib/conductor/version.rb
|
278
|
+
- lib/conductor/yui-compressor.rb
|
278
279
|
- marked-conductor.gemspec
|
279
280
|
- src/_README.md
|
280
281
|
- test.md
|