Skip to content
Snippets Groups Projects

Replace Gollum `[[_TOC_]]` tag with result of TableOfContentsFilter

Merged Robert Speicher requested to merge rs-wiki-toc into master

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
4 4 module Pipeline
5 5 class WikiPipeline < FullPipeline
6 6 def self.filters
7 super.insert(1, Filter::GollumTagsFilter)
7 @filters ||= begin
8 filters = super
9 toc = filters.index(Filter::TableOfContentsFilter)
10 filters.insert(toc + 1, Filter::GollumTagsFilter)
  • Reassigned to @DouweM

  • 86 86 expect(doc.at_css('a')['href']).to eq 'wiki-slug'
    87 87 end
    88 88 end
    89
    90 context 'table of contents' do
    91 let(:pipeline) { Banzai::Pipeline[:wiki] }
  • Douwe Maan
    Douwe Maan @DouweM started a thread on the diff
  • 73 82
    74 83 private
    75 84
    85 # Replace an entire `[[<em>TOC</em>]]` node with the result generated by
    86 # TableOfContentsFilter
    87 def process_toc_tag(node)
    88 node.parent.parent.replace(result[:toc])
  • Douwe Maan mentioned in commit 3d1de5ba

    mentioned in commit 3d1de5ba

  • Douwe Maan Status changed to merged

    Status changed to merged

  • @DouweM Looking at this again, I'm thinking "Why limit this to Gollum?". Maybe we should update TableOfContentsFilter to just do this replacement immediately, and then we get the functionality anywhere we render Markdown.

  • @rspeicher Sounds like a plan

  • and then we get the functionality anywhere we render Markdown.

    @rspeicher that would be awesome.

  • Robert Speicher mentioned in merge request !3166 (closed)

    mentioned in merge request !3166 (closed)

  • Please register or sign in to reply
    Loading