diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-29 17:53:32 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-06 12:58:28 -0400 |
commit | 6883e6e084f17a96d3cbb6f84b69603533f4f2c2 (patch) | |
tree | fd7d58d4d14fdac60e83c5b874f1fa93c1ccd06d /lib | |
parent | e167f28549b80141165f42b567073c5dd55f80c5 (diff) | |
download | gitlab-ce-6883e6e084f17a96d3cbb6f84b69603533f4f2c2.tar.gz |
Remove all references to `parse_tasks`
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/markdown.rb | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index bbae6ae3e74..63294aa54c0 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -32,9 +32,9 @@ module Gitlab # Public: Parse the provided text with GitLab-Flavored Markdown # # text - the source text - # options - parse_tasks - render tasks - # - xhtml - output XHTML instead of HTML - # - reference_only_path - Use relative path for reference links + # options - A Hash of options used to customize output (default: {}): + # :xhtml - output XHTML instead of HTML + # :reference_only_path - Use relative path for reference links # project - the project # html_options - extra options for the reference links as given to link_to def gfm_with_options(text, options = {}, project = @project, html_options = {}) @@ -46,7 +46,6 @@ module Gitlab text = text.dup.to_str options.reverse_merge!( - parse_tasks: false, xhtml: false, reference_only_path: true ) @@ -77,10 +76,6 @@ module Gitlab text = result[:output].to_html(save_with: save_options) - # if options[:parse_tasks] - # text = parse_tasks(text) - # end - text.html_safe end @@ -112,25 +107,5 @@ module Gitlab TaskList::Filter ] end - - # Turn list items that start with "[ ]" into HTML checkbox inputs. - def parse_tasks(text) - li_tag = '<li class="task-list-item">' - unchecked_box = '<input type="checkbox" value="on" disabled />' - checked_box = unchecked_box.sub(/\/>$/, 'checked="checked" />') - - # Regexp captures don't seem to work when +text+ is an - # ActiveSupport::SafeBuffer, hence the `String.new` - String.new(text).gsub(Taskable::TASK_PATTERN_HTML) do - checked = $LAST_MATCH_INFO[:checked].downcase == 'x' - p_tag = $LAST_MATCH_INFO[:p_tag] - - if checked - "#{li_tag}#{p_tag}#{checked_box}" - else - "#{li_tag}#{p_tag}#{unchecked_box}" - end - end - end end end |