diff options
author | Scott Lahteine <github@thinkyhead.com> | 2020-05-31 06:06:53 +0300 |
---|---|---|
committer | Scott Lahteine <github@thinkyhead.com> | 2020-05-31 06:06:53 +0300 |
commit | 428c35294f2c225c80f2224b54b7f92908713dbf (patch) | |
tree | 8ad8017fd7d5d5a7a92fe81978811f45de63ee98 /_plugins | |
parent | 5b32a3428d6918fde0ff498b80a5d6cf8aafb956 (diff) |
Update search feed
Diffstat (limited to '_plugins')
-rw-r--r-- | _plugins/marlinfw_filter.rb | 24 | ||||
-rw-r--r-- | _plugins/sitemap_generator.rb | 10 |
2 files changed, 19 insertions, 15 deletions
diff --git a/_plugins/marlinfw_filter.rb b/_plugins/marlinfw_filter.rb index 3c7324e3..47d94aaa 100644 --- a/_plugins/marlinfw_filter.rb +++ b/_plugins/marlinfw_filter.rb @@ -1,16 +1,22 @@ module Jekyll module MarlinSiteFilter def indexify(input) - re0 = /<[^>]*>/ - re1 = /(\b([a-z]{,2}|a(ll|nd|re(n\'t)?)|but|can(\'t|not)?|d(id|oes)(n\'t)?|end|for|ha(d|s|ve)(n\'t)?|it\'?s|odd|use[ds]?|even|from|many|more|much|some|this|tha[nt]|th[eo]se|the([mny]|ir|re|y\'re)?|was|were(n\'t)?|wh(at|en|ere|ich|o|y)|will|won\'t|other|users?|people|(al)?though|your?)\b)|(\s+)/ - re2 = /!\[[^\]]+\]\([^\)]+\)\s*(\{[^\}]+\})?/ - re3 = /\[([^\]]+)\]\([^\)]+\)\s*(\{[^\}]+\})?/ - re4 = /\\q/ - re5 = /(EN|DIS)ABLED\(([^\)]+)\)/i - re6 = /([[:punct:]]|:| [a-z])[ \t\n]+|[\n\r]+|\\[nr]/ - re7 = /[`\(\)\[\]:]+/ # This will be returned - input.downcase.gsub(re0, '').gsub(re1, ' ').gsub(re2, ' ').gsub(re3, '\1').gsub(re4, '\1').gsub(re5, '\2').gsub(re6, ' ').gsub(re7, '').split(' ').compact.uniq.join(' ') + some = input.downcase + some = some.gsub(/<[^>]*>/, '') + some = some.gsub("’", "'") + some = some.gsub("“", '"') + some = some.gsub("-", ' ') + some = some.gsub(/\b([a-z]{,2})\b/, '') + some = some.gsub(/\b(a(ll|nd|re(n't)?)|but|can('t|not)?|d(id|oes)(n't)?|end|for|ha(d|s|ve)(n't)?|it'?s|odd|use[ds]?|even|from|man?y|more|much|some|this|tha[nt]|th[eo]se|the([mny]|ir|re|y're)?|(was|were)(n't)?|wh(at|en|ere|ich|o|y)|will|won't|other|users?|people|(al)?though|your?|one|two)\b/, '') + some = some.gsub(/!\[[^\]]+\]\([^\)]+\)\s*(\{[^\}]+\})?/, ' ') + some = some.gsub(/\[([^\]]+)\]\([^\)]+\)\s*(\{[^\}]+\})?/, '\1') + some = some.gsub(/\\q/, '\1') + some = some.gsub(/(EN|DIS)ABLED\(([^\)]+)\)/i, '\2') + some = some.gsub(/([[:punct:]]|:| [a-z])[ \t\n]+|[\n\r]+|\\[nr]/, ' ') + some = some.gsub(/[`\(\)\[\]:]+/, '') + some = some.split(' ').compact.uniq.join(' ') + some end def linkify(input) re1 = /([GM])(\d)\b/ diff --git a/_plugins/sitemap_generator.rb b/_plugins/sitemap_generator.rb index 0b4217aa..f2a51c14 100644 --- a/_plugins/sitemap_generator.rb +++ b/_plugins/sitemap_generator.rb @@ -68,11 +68,11 @@ module Jekyll # Configuration sitemap_config = site.config['sitemap'] || {} @config = {} - @config['filename'] = sitemap_config['filename'] || SITEMAP_FILE_NAME + @config['filename'] = sitemap_config['filename'] || SITEMAP_FILE_NAME @config['change_frequency_name'] = sitemap_config['change_frequency_name'] || CHANGE_FREQUENCY_NAME - @config['priority_name'] = sitemap_config['priority_name'] || PRIORITY_NAME - @config['exclude'] = sitemap_config['exclude'] || EXCLUDE - @config['include_posts'] = sitemap_config['include_posts'] || INCLUDE_POSTS + @config['priority_name'] = sitemap_config['priority_name'] || PRIORITY_NAME + @config['exclude'] = sitemap_config['exclude'] || EXCLUDE + @config['include_posts'] = sitemap_config['include_posts'] || INCLUDE_POSTS sitemap = REXML::Document.new << REXML::XMLDecl.new("1.0", "UTF-8") @@ -147,8 +147,6 @@ module Jekyll lastmod = fill_last_modified(site, page_or_post) url.add_element(lastmod) if lastmod - - if (page_or_post.data[@config['change_frequency_name']]) change_frequency = page_or_post.data[@config['change_frequency_name']].downcase |