class HTML::Pipeline::TaskList

Generates task lists (e.g., checkboxes) from Github falvored markdown. See ./filter.rb for more details

Generates task lists (e.g., checkboxes) from GitHub flavored markdown. Requires processing by Markdown filter and therefore must follow HTML::Pipeline::MarkdownFilter in the pipeline

Usage:

require 'html/pipeline'
require 'html/pipeline/task_list/filter'

pipeline = HTML::Pipeline.new [
  HTML::Pipeline::MarkdownFilter,
  HTML::Pipeline::TaskList::Filter
]

pipeline.call "- [ ] task list item"

utilized to integrate into rails asset pipeline

Constants

Item
Summary

Provides a summary of provided TaskList `items`.

`items` is an Array of TaskList::Item objects.

VERSION

Attributes

record[R]

Public Class Methods

asset_paths() click to toggle source
# File lib/html/pipeline/task_list/railtie.rb, line 12
def asset_paths
  @asset_paths ||= Dir[root_path.join('app/assets/*')]
end
filter(*args) click to toggle source

Returns a `Nokogiri::DocumentFragment` object.

# File lib/html/pipeline/task_list/filter.rb, line 25
def self.filter(*args)
  Filter.call(*args)
end
new(record) click to toggle source

`record` is the resource with the Markdown source text with task list items following this syntax:

- [ ] a task list item
- [ ] another item
- [x] a completed item
# File lib/html/pipeline/task_list.rb, line 20
def initialize(record)
  @record = record
end
root_path() click to toggle source
# File lib/html/pipeline/task_list/railtie.rb, line 8
def root_path
  @root_path ||= Pathname.new(File.expand_path('../..', __dir__))
end

Public Instance Methods

summary() click to toggle source

Public: return the TaskList::Summary for this task list.

Returns a TaskList::Summary.

# File lib/html/pipeline/task_list.rb, line 27
def summary
  @summary ||= HTML::Pipeline::TaskList::Summary.new(record.task_list_items)
end