Feature #35742 » 0001-Enable-task-list-for-CommonMark-Markdown-formater-35.patch
| Gemfile | ||
|---|---|---|
|
gem "html-pipeline", "~> 2.13.2"
|
||
|
gem "commonmarker", (Gem.ruby_version < Gem::Version.new('2.6.0') ? '0.21.0' : '0.23.1')
|
||
|
gem "sanitize", "~> 6.0"
|
||
|
gem 'deckar01-task_list', '2.3.2'
|
||
|
end
|
||
|
# Include database gems for the adapters found in the database
|
||
| lib/redmine/wiki_formatting/common_mark/formatter.rb | ||
|---|---|---|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
require 'html/pipeline'
|
||
|
require 'task_list/filter'
|
||
|
module Redmine
|
||
|
module WikiFormatting
|
||
| ... | ... | |
|
SyntaxHighlightFilter,
|
||
|
FixupAutoLinksFilter,
|
||
|
ExternalLinksFilter,
|
||
|
TaskList::Filter
|
||
|
], PIPELINE_CONFIG
|
||
|
class Formatter < Redmine::WikiFormatting::Markdown::Formatter
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
h1:hover a.wiki-anchor, h2:hover a.wiki-anchor, h3:hover a.wiki-anchor, h4:hover a.wiki-anchor, h5:hover a.wiki-anchor, h6:hover a.wiki-anchor { display: inline; color: #ddd; }
|
||
|
div.wiki img {vertical-align:middle; max-width:100%;}
|
||
|
div.wiki .task-list {
|
||
|
list-style-type: none;
|
||
|
padding-left: 0px;
|
||
|
}
|
||
|
div.wiki .task-list input.task-list-item-checkbox {
|
||
|
height: initial;
|
||
|
}
|
||
|
/***** My page layout *****/
|
||
|
.block-receiver {
|
||
| test/unit/lib/redmine/wiki_formatting/common_mark/formatter_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_should_support_task_list
|
||
|
text = <<~STR
|
||
|
Task list:
|
||
|
* [ ] Task 1
|
||
|
* [x] Task 2
|
||
|
STR
|
||
|
expected = <<~EXPECTED
|
||
|
<p>Task list:</p>
|
||
|
<ul class="task-list">
|
||
|
<li class="task-list-item">
|
||
|
<input type="checkbox" class="task-list-item-checkbox" disabled> Task 1
|
||
|
</li>
|
||
|
<li class="task-list-item">
|
||
|
<input type="checkbox" class="task-list-item-checkbox" checked disabled> Task 2</li>
|
||
|
</ul>
|
||
|
EXPECTED
|
||
|
assert_equal expected.gsub(%r{[\r\n\t]}, ''), format(text).gsub(%r{[\r\n\t]}, '').rstrip
|
||
|
end
|
||
|
private
|
||
|
def assert_section_with_hash(expected, text, index)
|
||