summaryrefslogtreecommitdiff
path: root/lib/banzai/filter/gollum_tags_filter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/banzai/filter/gollum_tags_filter.rb')
-rw-r--r--lib/banzai/filter/gollum_tags_filter.rb33
1 files changed, 5 insertions, 28 deletions
diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb
index f31f921903b..e18f64e08a4 100644
--- a/lib/banzai/filter/gollum_tags_filter.rb
+++ b/lib/banzai/filter/gollum_tags_filter.rb
@@ -26,10 +26,6 @@ module Banzai
# * [[http://example.com/images/logo.png]]
# * [[http://example.com/images/logo.png|alt=Logo]]
#
- # - Insert a Table of Contents list:
- #
- # * [[_TOC_]]
- #
# Based on Gollum::Filter::Tags
#
# Context options:
@@ -61,21 +57,14 @@ module Banzai
def call
search_text_nodes(doc).each do |node|
- # A Gollum ToC tag is `[[_TOC_]]`, but due to MarkdownFilter running
- # before this one, it will be converted into `[[<em>TOC</em>]]`, so it
- # needs special-case handling
- if toc_tag?(node)
- process_toc_tag(node)
- else
- content = node.content
+ content = node.content
- next unless content =~ TAGS_PATTERN
+ next unless content =~ TAGS_PATTERN
- html = process_tag($1)
+ html = process_tag($1)
- if html && html != node.content
- node.replace(html)
- end
+ if html && html != node.content
+ node.replace(html)
end
end
@@ -84,12 +73,6 @@ module Banzai
private
- # Replace an entire `[[<em>TOC</em>]]` node with the result generated by
- # TableOfContentsFilter
- def process_toc_tag(node)
- node.parent.parent.replace(result[:toc].presence || '')
- end
-
# Process a single tag into its final HTML form.
#
# tag - The String tag contents (the stuff inside the double brackets).
@@ -125,12 +108,6 @@ module Banzai
end
end
- def toc_tag?(node)
- node.content == 'TOC' &&
- node.parent.name == 'em' &&
- node.parent.parent.text == '[[TOC]]'
- end
-
def image?(path)
path =~ ALLOWED_IMAGE_EXTENSIONS
end