deckar01-task_list 2.3.2 → 3.0.alpha2
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 +9 -48
- 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 +7 -0
- data/test/task_list/filter_test.rb +18 -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 +19 -15
- 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: ad259725c7de35c5b6bb6c88a6f175c3c53becfebebc2681d7fc3f816cd0b498
|
4
|
+
data.tar.gz: 59bbc4372a0a24e95123585ad2df1b1b9551f89be82486a72bcac36321522121
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2773a96edaf7569423101c52f7b310265e206b1c2ad71aff139cfa810d1bda9313ed4434b0fdd6b7963e555b7321c0fd8dd06f78af551f297a71404657abd28c
|
7
|
+
data.tar.gz: 66ed087ad4add8a9bdc24951ce8c55bbbe4562b936f409c7499133276a7df474a6af100d58865ee2f9f4b16292f6f7ddd15b2048f18666b99202908eaadcab08
|
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
@@ -50,17 +50,6 @@ class TaskList
|
|
50
50
|
(?=\s) # followed by whitespace
|
51
51
|
/x
|
52
52
|
|
53
|
-
ListItemSelector = ".//li[task_list_item(.)]".freeze
|
54
|
-
|
55
|
-
class XPathSelectorFunction
|
56
|
-
def self.task_list_item(nodes)
|
57
|
-
nodes.select { |node| node.text =~ ItemPattern }
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# Selects first P tag of an LI, if present
|
62
|
-
ItemParaSelector = "./p[1]".freeze
|
63
|
-
|
64
53
|
# List of `TaskList::Item` objects that were recognized in the document.
|
65
54
|
# This is available in the result hash as `:task_list_items`.
|
66
55
|
#
|
@@ -95,15 +84,6 @@ class TaskList
|
|
95
84
|
item.source.sub(ItemPattern, render_item_checkbox(item)), 'utf-8'
|
96
85
|
end
|
97
86
|
|
98
|
-
# Public: Select all task list items within `container`.
|
99
|
-
#
|
100
|
-
# Returns an Array of Nokogiri::XML::Element objects for ordered and
|
101
|
-
# unordered lists. The container can either be the entire document (as
|
102
|
-
# returned by `#doc`) or an Element object.
|
103
|
-
def list_items(container)
|
104
|
-
container.xpath(ListItemSelector, XPathSelectorFunction)
|
105
|
-
end
|
106
|
-
|
107
87
|
# Filters the source for task list items.
|
108
88
|
#
|
109
89
|
# Each item is wrapped in HTML to identify, style, and layer
|
@@ -113,25 +93,15 @@ class TaskList
|
|
113
93
|
#
|
114
94
|
# Returns nothing.
|
115
95
|
def filter!
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
[li, li.inner_html]
|
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
|
96
|
+
doc.xpath(".//li").reverse.each do |li|
|
97
|
+
container = li.xpath("./p[1]")[0] || li
|
98
|
+
next if not container.inner_html =~ ItemPattern
|
99
|
+
|
100
|
+
item = TaskList::Item.new($1, container.inner_html)
|
101
|
+
task_list_items.unshift item
|
102
|
+
container.inner_html = render_task_list_item(item)
|
103
|
+
li.parent.add_class('task-list')
|
104
|
+
li.add_class('task-list-item')
|
135
105
|
end
|
136
106
|
end
|
137
107
|
|
@@ -139,14 +109,5 @@ class TaskList
|
|
139
109
|
filter!
|
140
110
|
doc
|
141
111
|
end
|
142
|
-
|
143
|
-
# Private: adds a CSS class name to a node, respecting existing class
|
144
|
-
# names.
|
145
|
-
def add_css_class(node, *new_class_names)
|
146
|
-
class_names = (node['class'] || '').split(' ')
|
147
|
-
return if new_class_names.all? { |klass| class_names.include?(klass) }
|
148
|
-
class_names.concat(new_class_names)
|
149
|
-
node['class'] = class_names.uniq.join(' ')
|
150
|
-
end
|
151
112
|
end
|
152
113
|
end
|
data/lib/task_list/version.rb
CHANGED