Handle task lists that start with * or + symbol
This commit is contained in:
parent
c6349738ad
commit
2cd4c1420a
@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
|||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
class TaskListBlockParser extends AbstractBlockParser {
|
class TaskListBlockParser extends AbstractBlockParser {
|
||||||
|
|
||||||
private static final Pattern PATTERN = Pattern.compile("\\s*-\\s+\\[(x|X|\\s)\\]\\s+(.*)");
|
private static final Pattern PATTERN = Pattern.compile("\\s*[-*+]\\s+\\[(x|X|\\s)\\]\\s+(.*)");
|
||||||
|
|
||||||
private final TaskListBlock block = new TaskListBlock();
|
private final TaskListBlock block = new TaskListBlock();
|
||||||
|
|
||||||
|
47
markwon/src/test/resources/tests/task-list.yaml
Normal file
47
markwon/src/test/resources/tests/task-list.yaml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
input: |-
|
||||||
|
- [ ] First
|
||||||
|
- [x] Second
|
||||||
|
- [X] Third
|
||||||
|
* [ ] First star
|
||||||
|
* [x] Second star
|
||||||
|
* [X] Third star
|
||||||
|
+ [ ] First plus
|
||||||
|
+ [x] Second plus
|
||||||
|
+ [X] Third plus
|
||||||
|
|
||||||
|
output:
|
||||||
|
- task-list: "First"
|
||||||
|
blockIdent: 1
|
||||||
|
done: false
|
||||||
|
- text: "\n"
|
||||||
|
- task-list: "Second"
|
||||||
|
blockIdent: 1
|
||||||
|
done: true
|
||||||
|
- text: "\n"
|
||||||
|
- task-list: "Third"
|
||||||
|
blockIdent: 1
|
||||||
|
done: true
|
||||||
|
- text: "\n"
|
||||||
|
- task-list: "First star"
|
||||||
|
blockIdent: 1
|
||||||
|
done: false
|
||||||
|
- text: "\n"
|
||||||
|
- task-list: "Second star"
|
||||||
|
blockIdent: 1
|
||||||
|
done: true
|
||||||
|
- text: "\n"
|
||||||
|
- task-list: "Third star"
|
||||||
|
blockIdent: 1
|
||||||
|
done: true
|
||||||
|
- text: "\n"
|
||||||
|
- task-list: "First plus"
|
||||||
|
blockIdent: 1
|
||||||
|
done: false
|
||||||
|
- text: "\n"
|
||||||
|
- task-list: "Second plus"
|
||||||
|
blockIdent: 1
|
||||||
|
done: true
|
||||||
|
- text: "\n"
|
||||||
|
- task-list: "Third plus"
|
||||||
|
blockIdent: 1
|
||||||
|
done: true
|
Loading…
x
Reference in New Issue
Block a user