summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-01-30 13:41:18 -0600
committerEric Eastwood <contact@ericeastwood.com>2017-01-30 13:41:18 -0600
commit3977a64a08554aaa77700bfa3ad9af1dee011355 (patch)
treedbabb656b401419b6ea1af331bc7b584afe2f8d5
parent4468104f3550456481b45d1b09202ed6732a1810 (diff)
downloadgitlab-ce-feature/native-emojis.tar.gz
-rw-r--r--lib/banzai/filter/emoji_filter.rb6
-rw-r--r--lib/banzai/renderer.rb7
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/banzai/filter/emoji_filter.rb b/lib/banzai/filter/emoji_filter.rb
index a8c1ca0c60a..9e01d5f2b82 100644
--- a/lib/banzai/filter/emoji_filter.rb
+++ b/lib/banzai/filter/emoji_filter.rb
@@ -17,8 +17,9 @@ module Banzai
next unless content.include?(':') || node.text.match(emoji_unicode_pattern)
- html = emoji_name_image_filter(content)
- html = emoji_unicode_image_filter(html)
+ puts "html #{html}"
+ #html = emoji_name_image_filter(content)
+ #html = emoji_unicode_image_filter(html)
next if html == content
@@ -51,6 +52,7 @@ module Banzai
end
def emoji_image_tag(emoji_name, emoji_url)
+ puts "emoji_image_tag #{emoji_name}"
"<img class='emoji' title=':#{emoji_name}:' alt=':#{emoji_name}:' src='#{emoji_url}' height='20' width='20' align='absmiddle' />"
end
diff --git a/lib/banzai/renderer.rb b/lib/banzai/renderer.rb
index 74663556cbb..e972fbadbae 100644
--- a/lib/banzai/renderer.rb
+++ b/lib/banzai/renderer.rb
@@ -1,6 +1,7 @@
module Banzai
module Renderer
module_function
+ CACHE_ENABLED = false
# Convert a Markdown String into an HTML-safe String of HTML
#
@@ -20,13 +21,14 @@ module Banzai
cache_key = context.delete(:cache_key)
cache_key = full_cache_key(cache_key, context[:pipeline])
- if cache_key
+ if cache_key && CACHE_ENABLED
Gitlab::Metrics.measure(:banzai_cached_render) do
Rails.cache.fetch(cache_key) do
cacheless_render(text, context)
end
end
else
+ puts "render #{text}"
cacheless_render(text, context)
end
end
@@ -90,7 +92,7 @@ module Banzai
item[:cache_key] = cache_key if cache_key
end
- cacheable_items, non_cacheable_items = items_collection.partition { |item| item.key?(:cache_key) }
+ cacheable_items, non_cacheable_items = items_collection.partition { |item| item.key?(:cache_key) && CACHE_ENABLED }
items_in_cache = []
items_not_in_cache = []
@@ -108,6 +110,7 @@ module Banzai
Rails.cache.write(item[:cache_key], item[:rendered]) if item[:cache_key]
end
+ items_collection.map { |item| puts "item[:rendered] #{item[:rendered]}" }
items_collection.map { |item| item[:rendered] }
end