# frozen_string_literal: true require 'task_list' require 'task_list/filter' # Contains functionality for objects that can have task lists in their # descriptions. Task list items can be added with Markdown like "* [x] Fix # bugs". # # Used by MergeRequest and Issue module Taskable COMPLETED = 'completed' INCOMPLETE = 'incomplete' COMPLETE_PATTERN = /\[[xX]\]/.freeze INCOMPLETE_PATTERN = /\[[[:space:]]\]/.freeze ITEM_PATTERN = %r{ ^ (?:(?:>\s{0,4})*) # optional blockquote characters ((?:\s*(?:[-+*]|(?:\d+\.)))+) # list prefix (one or more) required - task item has to be always in a list \s+ # whitespace prefix has to be always presented for a list item ( # checkbox #{COMPLETE_PATTERN}|#{INCOMPLETE_PATTERN} ) (\s.+) # followed by whitespace and some text. }x.freeze ITEM_PATTERN_UNTRUSTED = '^' \ '(?:(?:>\s{0,4})*)' \ '(?P(?:\s*(?:[-+*]|(?:\d+\.)))+)' \ '\s+' \ '(?P' \ "#{COMPLETE_PATTERN.source}|#{INCOMPLETE_PATTERN.source}" \ ')' \ '(?P