Project

General

Profile

Feature #35742 » 0001-Enable-task-list-for-CommonMark-Markdown-formater-35.patch

Marius BĂLTEANU, 2022-01-04 18:35

View differences:

Gemfile
49 49
  gem "html-pipeline", "~> 2.13.2"
50 50
  gem "commonmarker", (Gem.ruby_version < Gem::Version.new('2.6.0') ? '0.21.0' : '0.23.1')
51 51
  gem "sanitize", "~> 6.0"
52
  gem 'deckar01-task_list', '2.3.2'
52 53
end
53 54

  
54 55
# Include database gems for the adapters found in the database
lib/redmine/wiki_formatting/common_mark/formatter.rb
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 19

  
20 20
require 'html/pipeline'
21
require 'task_list/filter'
21 22

  
22 23
module Redmine
23 24
  module WikiFormatting
......
57 58
        SyntaxHighlightFilter,
58 59
        FixupAutoLinksFilter,
59 60
        ExternalLinksFilter,
61
        TaskList::Filter
60 62
      ], PIPELINE_CONFIG
61 63

  
62 64
      class Formatter < Redmine::WikiFormatting::Markdown::Formatter
public/stylesheets/application.css
1311 1311
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; }
1312 1312

  
1313 1313
div.wiki img {vertical-align:middle; max-width:100%;}
1314
div.wiki .task-list {
1315
  list-style-type: none;
1316
  padding-left: 0px;
1317
}
1318
div.wiki .task-list input.task-list-item-checkbox {
1319
  height: initial;
1320
}
1314 1321

  
1315 1322
/***** My page layout *****/
1316 1323
.block-receiver {
test/unit/lib/redmine/wiki_formatting/common_mark/formatter_test.rb
263 263
      end
264 264
    end
265 265

  
266
    def test_should_support_task_list
267
      text = <<~STR
268
        Task list:
269
        * [ ] Task 1
270
        * [x] Task 2
271
      STR
272

  
273
      expected = <<~EXPECTED
274
        <p>Task list:</p>
275
        <ul class="task-list">
276
        <li class="task-list-item">
277
        <input type="checkbox" class="task-list-item-checkbox" disabled> Task 1
278
        </li>
279
        <li class="task-list-item">
280
        <input type="checkbox" class="task-list-item-checkbox" checked disabled> Task 2</li>
281
        </ul>
282
      EXPECTED
283

  
284
      assert_equal expected.gsub(%r{[\r\n\t]}, ''), format(text).gsub(%r{[\r\n\t]}, '').rstrip
285
    end
286

  
266 287
    private
267 288

  
268 289
    def assert_section_with_hash(expected, text, index)
(2-2/5)