diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-03-03 12:36:36 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-03-03 12:41:40 -0500 |
commit | def6446dad808f2ff0f725df7a08f81365719586 (patch) | |
tree | f22d3f41c733ee73052da434b5191234506325bc /lib | |
parent | 82bc6c6229b626dae74a12a56243c89aa8348cc3 (diff) | |
download | gitlab-ce-def6446dad808f2ff0f725df7a08f81365719586.tar.gz |
Replace `[[_TOC_]]` tag even if `toc` result is blankrs-wiki-pipeline-spec
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/gollum_tags_filter.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb index bcf5297e382..f31f921903b 100644 --- a/lib/banzai/filter/gollum_tags_filter.rb +++ b/lib/banzai/filter/gollum_tags_filter.rb @@ -26,6 +26,10 @@ 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,8 +65,6 @@ module Banzai # before this one, it will be converted into `[[<em>TOC</em>]]`, so it # needs special-case handling if toc_tag?(node) - next unless result[:toc].present? - process_toc_tag(node) else content = node.content @@ -85,7 +87,7 @@ module Banzai # Replace an entire `[[<em>TOC</em>]]` node with the result generated by # TableOfContentsFilter def process_toc_tag(node) - node.parent.parent.replace(result[:toc]) + node.parent.parent.replace(result[:toc].presence || '') end # Process a single tag into its final HTML form. |