Skip to content

Commit 244a28c

Browse files
Ryota KusanoRokt33r
authored andcommitted
Adjust continuous quotation pattern
1 parent edac4d3 commit 244a28c

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

browser/components/MarkdownEditor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ class MarkdownEditor extends React.Component {
159159
e.preventDefault()
160160
e.stopPropagation()
161161
const idMatch = /checkbox-([0-9]+)/
162-
const checkedMatch = /^\s*>?\s*[+\-*] \[x]/i
163-
const uncheckedMatch = /^\s*>?\s*[+\-*] \[ ]/
162+
const checkedMatch = /^(\s*>?)*\s*[+\-*] \[x]/i
163+
const uncheckedMatch = /^(\s*>?)*\s*[+\-*] \[ ]/
164164
const checkReplace = /\[x]/i
165165
const uncheckReplace = /\[ ]/
166166
if (idMatch.test(e.target.getAttribute('id'))) {

browser/components/MarkdownSplitEditor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class MarkdownSplitEditor extends React.Component {
7878
e.preventDefault()
7979
e.stopPropagation()
8080
const idMatch = /checkbox-([0-9]+)/
81-
const checkedMatch = /^\s*>?\s*[+\-*] \[x]/i
82-
const uncheckedMatch = /^\s*>?\s*[+\-*] \[ ]/
81+
const checkedMatch = /^(\s*>?)*\s*[+\-*] \[x]/i
82+
const uncheckedMatch = /^(\s*>?)*\s*[+\-*] \[ ]/
8383
const checkReplace = /\[x]/i
8484
const uncheckReplace = /\[ ]/
8585
if (idMatch.test(e.target.getAttribute('id'))) {

browser/lib/getTodoStatus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function getTodoStatus (content) {
44
let numberOfCompletedTodo = 0
55

66
splitted.forEach((line) => {
7-
const trimmedLine = line.trim().replace(/^>\s*/, '')
7+
const trimmedLine = line.trim().replace(/^(>\s*)*/, '')
88
if (trimmedLine.match(/^[+\-*] \[(\s|x)] ./i)) {
99
numberOfTodo++
1010
}

tests/lib/get-todo-status-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ test('getTodoStatus should return a correct hash object', t => {
3333
['> - [ ] a\n- [x] a\n', { total: 2, completed: 1 }],
3434
['> + [ ] a\n+ foo [x]bar a\n', { total: 1, completed: 0 }],
3535
['> - [X] `- [X] a`\n', { total: 1, completed: 1 }],
36-
['> \t - [X] `- [X] a`\n', { total: 1, completed: 1 }]
36+
['> \t - [X] `- [X] a`\n', { total: 1, completed: 1 }],
37+
['> > - [ ] a\n', { total: 1, completed: 0 }],
38+
['> > > - [ ] a\n- [x] a\n', { total: 2, completed: 1 }]
3739
]
3840

3941
testCases.forEach(testCase => {

0 commit comments

Comments
 (0)