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
# 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
}
}
+// tl
+jsToolBar.prototype.elements.tl = {
+ type: 'button',
+ title: 'Task list',
+ fn: {
+ wiki: function() {
+ this.encloseLineSelection('','',function(str) {
+ str = str.replace(/\r/g,'');
+ return str.replace(/(\n|^)[*-]?\s*/g,"$1* [ ] ");
+ });
+ }
+ }
+}
+
// spacer
jsToolBar.prototype.elements.space3 = {type: 'space'}
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 {
.jstb_ol {
background-image: url(../images/jstoolbar/bt_ol.png);
}
+.jstb_tl {
+ background-image: url(../images/jstoolbar/bt_tl.png);
+}
.jstb_bq {
background-image: url(../images/jstoolbar/bt_bq.png);
}
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)