Class: Banzai::Filter::TaskListFilter

Inherits:
TaskList::Filter
  • Object
show all
Defined in:
lib/banzai/filter/task_list_filter.rb

Overview

Work around a bug in the default TaskList::Filter that adds a `task-list` class to every list element, regardless of whether or not it contains a task list.

This is a (hopefully) temporary fix, pending a new release of the task_list gem.

See github.com/github/task_list/pull/60

Instance Method Summary collapse

Instance Method Details

#add_css_class_with_fix(node, *new_class_names) ⇒ Object


14
15
16
17
18
19
20
21
22
23
# File 'lib/banzai/filter/task_list_filter.rb', line 14

def add_css_class_with_fix(node, *new_class_names)
  if new_class_names.include?('task-list')
    # Don't add class to all lists
    return
  elsif new_class_names.include?('task-list-item')
    add_css_class_without_fix(node.parent, 'task-list')
  end

  add_css_class_without_fix(node, *new_class_names)
end