deckar01-task_list 2.3.2 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +22 -0
- data/README.md +2 -4
- data/bower.json +1 -2
- data/build.mjs +26 -0
- data/lib/task_list/filter.rb +20 -21
- data/lib/task_list/version.rb +1 -1
- data/package-lock.json +5042 -0
- data/package.json +19 -24
- data/script/bootstrap +8 -1
- data/script/cibuild +1 -1
- data/task_list.gemspec +9 -2
- data/test/task_list/filter_test.rb +27 -0
- data/test/unit/test_events.coffee +38 -60
- data/test/unit/test_updates.coffee +432 -381
- data/web-test-runner.config.mjs +5 -0
- metadata +25 -21
- data/.travis.yml +0 -16
- data/test/unit/config.js +0 -87
- data/webpack.config.js +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a298b08198908753ccb6e7d75d867daf8d12c596586bfbc45ab54baf8cff1e3f
|
4
|
+
data.tar.gz: c1e7f45c0f827b697813cd5c45d3b3dd9d8d9063e8a219a7cc2292affb25a21c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc40c8f60bb4f1bd6d61919d7252de08f007bd64a2cb6318c420c3c9893c332e84cbcfb77e6215166ff3e5de0cede45fd9941512093aa5366895b515f3e1565b
|
7
|
+
data.tar.gz: 1cafaea6e577823575588d5636fc83e607877584a859981c4ed63fcf6bc5e214920ada3d8d92252c7b264bc9184f96b7b5e422cae6208b482081396229d6a3bb
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
.test: &test
|
2
|
+
stage: test
|
3
|
+
before_script:
|
4
|
+
- ./script/bootstrap
|
5
|
+
script:
|
6
|
+
- ./script/cibuild
|
7
|
+
|
8
|
+
test 3.0:
|
9
|
+
image: "ruby:3.0"
|
10
|
+
<<: *test
|
11
|
+
|
12
|
+
test 3.1:
|
13
|
+
image: "ruby:3.1"
|
14
|
+
<<: *test
|
15
|
+
|
16
|
+
test 3.2:
|
17
|
+
image: "ruby:3.2"
|
18
|
+
<<: *test
|
19
|
+
|
20
|
+
test 3.3:
|
21
|
+
image: "ruby:3.3-rc"
|
22
|
+
<<: *test
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Task Lists
|
2
2
|
|
3
|
-
[![
|
4
|
-
|
5
|
-
[travis]: https://travis-ci.org/deckar01/task_list
|
3
|
+
[![pipeline status](https://gitlab.com/deckar01/task_list/badges/master/pipeline.svg)](https://gitlab.com/deckar01/task_list/-/commits/master)
|
6
4
|
|
7
5
|
This is a community fork of GitHub's archived [`task_list`][task_list] gem.
|
8
6
|
|
@@ -85,7 +83,7 @@ NOTE: Updates are not persisted to the server automatically. Persistence is the
|
|
85
83
|
|
86
84
|
Read through the documented behaviors and samples [in the source][frontend_behaviors] for more detail, including documented events.
|
87
85
|
|
88
|
-
[frontend_behaviors]: https://
|
86
|
+
[frontend_behaviors]: https://gitlab.com/deckar01/task_list/blob/master/app/assets/javascripts/task_list.coffee
|
89
87
|
|
90
88
|
## Installation
|
91
89
|
|
data/bower.json
CHANGED
@@ -2,10 +2,9 @@
|
|
2
2
|
"name": "deckar01-task_list",
|
3
3
|
"version": "2.0.1",
|
4
4
|
"description": "Markdown TaskList components",
|
5
|
-
"homepage": "https://
|
5
|
+
"homepage": "https://gitlab.com/deckar01/task_list",
|
6
6
|
"devDependencies": {
|
7
7
|
"jquery": ">= 1.9.1 <3",
|
8
|
-
"qunit": "^1.0.0",
|
9
8
|
"rails-behaviors": "^0.8.4"
|
10
9
|
},
|
11
10
|
"main": [
|
data/build.mjs
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
import { build } from 'esbuild';
|
2
|
+
import coffeeScriptPlugin from 'esbuild-coffeescript';
|
3
|
+
import { umdWrapper } from 'esbuild-plugin-umd-wrapper';
|
4
|
+
|
5
|
+
await build({
|
6
|
+
entryPoints: ['app/assets/javascripts/task_list.coffee'],
|
7
|
+
bundle: true,
|
8
|
+
minify: true,
|
9
|
+
format: 'umd',
|
10
|
+
outfile: 'dist/task_list.js',
|
11
|
+
plugins: [
|
12
|
+
coffeeScriptPlugin(),
|
13
|
+
umdWrapper({libraryName: 'TaskList'}),
|
14
|
+
],
|
15
|
+
logLevel: 'info',
|
16
|
+
});
|
17
|
+
|
18
|
+
await build({
|
19
|
+
entryPoints: ['test/unit/*.coffee'],
|
20
|
+
bundle: true,
|
21
|
+
outdir: 'bin/test/unit/',
|
22
|
+
plugins: [
|
23
|
+
coffeeScriptPlugin(),
|
24
|
+
],
|
25
|
+
logLevel: 'info',
|
26
|
+
});
|
data/lib/task_list/filter.rb
CHANGED
@@ -40,7 +40,7 @@ class TaskList
|
|
40
40
|
# Pattern used to identify all task list items.
|
41
41
|
# Useful when you need iterate over all items.
|
42
42
|
ItemPattern = /
|
43
|
-
|
43
|
+
\A
|
44
44
|
(?:\s*[-+*]|(?:\d+\.))? # optional list prefix
|
45
45
|
\s* # optional whitespace prefix
|
46
46
|
( # checkbox
|
@@ -50,17 +50,22 @@ class TaskList
|
|
50
50
|
(?=\s) # followed by whitespace
|
51
51
|
/x
|
52
52
|
|
53
|
-
ListItemSelector = ".//li[task_list_item(.)]".freeze
|
53
|
+
ListItemSelector = ".//li[nokogiri:task_list_item(.)]".freeze
|
54
54
|
|
55
55
|
class XPathSelectorFunction
|
56
56
|
def self.task_list_item(nodes)
|
57
|
-
nodes.select { |
|
57
|
+
nodes.select { |li| Filter::item_container(li).inner_html =~ ItemPattern }
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
# Selects first P tag of an LI, if present
|
62
62
|
ItemParaSelector = "./p[1]".freeze
|
63
63
|
|
64
|
+
# The the node directly containing the checkbox text
|
65
|
+
def self.item_container(li)
|
66
|
+
li.xpath(ItemParaSelector)[0] || li
|
67
|
+
end
|
68
|
+
|
64
69
|
# List of `TaskList::Item` objects that were recognized in the document.
|
65
70
|
# This is available in the result hash as `:task_list_items`.
|
66
71
|
#
|
@@ -80,6 +85,7 @@ class TaskList
|
|
80
85
|
/>)
|
81
86
|
end
|
82
87
|
|
88
|
+
# Deprecated: Removed in v3
|
83
89
|
# Public: Marks up the task list item checkbox with metadata and behavior.
|
84
90
|
#
|
85
91
|
# NOTE: produces a string that, when assigned to a Node's `inner_html`,
|
@@ -95,6 +101,7 @@ class TaskList
|
|
95
101
|
item.source.sub(ItemPattern, render_item_checkbox(item)), 'utf-8'
|
96
102
|
end
|
97
103
|
|
104
|
+
# Deprecated: Removed in v3
|
98
105
|
# Public: Select all task list items within `container`.
|
99
106
|
#
|
100
107
|
# Returns an Array of Nokogiri::XML::Element objects for ordered and
|
@@ -114,24 +121,15 @@ class TaskList
|
|
114
121
|
# Returns nothing.
|
115
122
|
def filter!
|
116
123
|
list_items(doc).reverse.each do |li|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
end
|
127
|
-
if match = (inner.chomp =~ ItemPattern && $1)
|
128
|
-
item = TaskList::Item.new(match, inner)
|
129
|
-
# prepend because we're iterating in reverse
|
130
|
-
task_list_items.unshift item
|
131
|
-
|
132
|
-
add_css_class(li, 'task-list-item')
|
133
|
-
outer.inner_html = render_task_list_item(item)
|
134
|
-
end
|
124
|
+
outer = self.class.item_container(li)
|
125
|
+
inner = outer.inner_html
|
126
|
+
checkbox = inner.match(ItemPattern).captures[0]
|
127
|
+
item = TaskList::Item.new(checkbox, inner)
|
128
|
+
# prepend because we're iterating in reverse
|
129
|
+
task_list_items.unshift item
|
130
|
+
li.parent.add_class('task-list')
|
131
|
+
li.add_class('task-list-item')
|
132
|
+
outer.inner_html = render_task_list_item(item)
|
135
133
|
end
|
136
134
|
end
|
137
135
|
|
@@ -140,6 +138,7 @@ class TaskList
|
|
140
138
|
doc
|
141
139
|
end
|
142
140
|
|
141
|
+
# Deprecated: Removed in v3
|
143
142
|
# Private: adds a CSS class name to a node, respecting existing class
|
144
143
|
# names.
|
145
144
|
def add_css_class(node, *new_class_names)
|
data/lib/task_list/version.rb
CHANGED