marked-conductor 1.0.15 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +18 -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 +10 -3
- data/html/Hash.html +1 -1
- data/html/Object.html +1 -1
- data/html/README_rdoc.html +1 -1
- data/html/String.html +121 -20
- data/html/TrueClass.html +1 -1
- data/html/YuiCompressor/Yui.html +447 -0
- data/html/YuiCompressor.html +93 -0
- 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 +57 -16
- data/lib/conductor/filter.rb +48 -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 +18 -3
- metadata +5 -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=()","autolink()","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=()","string#autolink()","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"],["autolink","String","String.html#method-i-autolink","()",""],["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,17 +169,17 @@
|
|
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
|
-
<a href="String.html#method-i-
|
182
|
+
<a href="String.html#method-i-autolink">#autolink</a>
|
172
183
|
—
|
173
184
|
<span class="container">String</span>
|
174
185
|
|
@@ -177,6 +188,11 @@
|
|
177
188
|
—
|
178
189
|
<span class="container">TrueClass</span>
|
179
190
|
|
191
|
+
<li class="method">
|
192
|
+
<a href="String.html#method-i-bool-3F">#bool?</a>
|
193
|
+
—
|
194
|
+
<span class="container">String</span>
|
195
|
+
|
180
196
|
<li class="method">
|
181
197
|
<a href="FalseClass.html#method-i-bool-3F">#bool?</a>
|
182
198
|
—
|
@@ -192,6 +208,11 @@
|
|
192
208
|
—
|
193
209
|
<span class="container">Object</span>
|
194
210
|
|
211
|
+
<li class="method">
|
212
|
+
<a href="YuiCompressor/Yui.html#method-i-compress">#compress</a>
|
213
|
+
—
|
214
|
+
<span class="container">YuiCompressor::Yui</span>
|
215
|
+
|
195
216
|
<li class="method">
|
196
217
|
<a href="Conductor.html#method-i-create_config">#create_config</a>
|
197
218
|
—
|
@@ -237,6 +258,11 @@
|
|
237
258
|
—
|
238
259
|
<span class="container">String</span>
|
239
260
|
|
261
|
+
<li class="method">
|
262
|
+
<a href="String.html#method-i-insert_css">#insert_css</a>
|
263
|
+
—
|
264
|
+
<span class="container">String</span>
|
265
|
+
|
240
266
|
<li class="method">
|
241
267
|
<a href="String.html#method-i-insert_file">#insert_file</a>
|
242
268
|
—
|
@@ -317,6 +343,11 @@
|
|
317
343
|
—
|
318
344
|
<span class="container">Filter</span>
|
319
345
|
|
346
|
+
<li class="method">
|
347
|
+
<a href="YuiCompressor/Yui.html#method-i-process_comments_and_strings">#process_comments_and_strings</a>
|
348
|
+
—
|
349
|
+
<span class="container">YuiCompressor::Yui</span>
|
350
|
+
|
320
351
|
<li class="method">
|
321
352
|
<a href="String.html#method-i-replace">#replace</a>
|
322
353
|
—
|
@@ -328,15 +359,20 @@
|
|
328
359
|
<span class="container">String</span>
|
329
360
|
|
330
361
|
<li class="method">
|
331
|
-
<a href="
|
362
|
+
<a href="YuiCompressor/Yui.html#method-i-restore_preserved_comments_and_strings">#restore_preserved_comments_and_strings</a>
|
332
363
|
—
|
333
|
-
<span class="container">
|
364
|
+
<span class="container">YuiCompressor::Yui</span>
|
334
365
|
|
335
366
|
<li class="method">
|
336
367
|
<a href="Conductor/Script.html#method-i-run">#run</a>
|
337
368
|
—
|
338
369
|
<span class="container">Conductor::Script</span>
|
339
370
|
|
371
|
+
<li class="method">
|
372
|
+
<a href="Conductor/Command.html#method-i-run">#run</a>
|
373
|
+
—
|
374
|
+
<span class="container">Conductor::Command</span>
|
375
|
+
|
340
376
|
<li class="method">
|
341
377
|
<a href="Conductor.html#method-i-sample_config">#sample_config</a>
|
342
378
|
—
|
@@ -482,6 +518,11 @@
|
|
482
518
|
—
|
483
519
|
<span class="container">Conductor::Condition</span>
|
484
520
|
|
521
|
+
<li class="method">
|
522
|
+
<a href="String.html#method-i-wrap_style">#wrap_style</a>
|
523
|
+
—
|
524
|
+
<span class="container">String</span>
|
525
|
+
|
485
526
|
<li class="method">
|
486
527
|
<a href="String.html#method-i-yaml-3F">#yaml?</a>
|
487
528
|
—
|
@@ -492,7 +533,7 @@
|
|
492
533
|
|
493
534
|
<footer id="validator-badges" role="contentinfo">
|
494
535
|
<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.
|
536
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.7.0.
|
496
537
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
497
538
|
</footer>
|
498
539
|
|
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
|
|
@@ -265,6 +301,11 @@ class ::String
|
|
265
301
|
sub(regex.to_rx, pattern.to_pattern)
|
266
302
|
end
|
267
303
|
|
304
|
+
def autolink
|
305
|
+
gsub(%r{(?mi)(?<!\(|]: )\b((?:[\w-]+?://)[-a-zA-Z0-9@:%._+~#=]{2,256}\b(?:[-a-zA-Z0-9@:%_+.~#?&/=]*))},
|
306
|
+
'<\1>')
|
307
|
+
end
|
308
|
+
|
268
309
|
def to_rx
|
269
310
|
if self =~ %r{^/(.*?)/([im]+)?$}
|
270
311
|
m = Regexp.last_match
|
@@ -294,6 +335,11 @@ class Filter < String
|
|
294
335
|
content = Conductor.stdin
|
295
336
|
|
296
337
|
case @filter
|
338
|
+
when /(insert|add|inject)(css|style)/
|
339
|
+
@params.each do |css|
|
340
|
+
content = content.insert_css(css)
|
341
|
+
end
|
342
|
+
content
|
297
343
|
when /(insert|add|inject)title/
|
298
344
|
content.insert_title
|
299
345
|
when /(insert|add|inject)script/
|
@@ -353,6 +399,8 @@ class Filter < String
|
|
353
399
|
end
|
354
400
|
|
355
401
|
content.replace(@params[0], @params[1])
|
402
|
+
when /(auto|self)link/
|
403
|
+
content.autolink
|
356
404
|
end
|
357
405
|
end
|
358
406
|
end
|
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