Visitar URL original
Updates should not ignore items with links by mtodd · Pull Request #41 · github/task_list · GitHub
Skip to content
This repository was archived by the owner on Nov 1, 2017. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Got it
  • Loading branch information
mtodd committed Sep 26, 2014
commit 765f60f87fb8ba6c56d39508153de20ef6a887e9
15 changes: 11 additions & 4 deletions app/assets/javascripts/task_list.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,17 @@ itemPattern = ///
#{escapePattern(complete)}|
#{escapePattern(incomplete)}
)
(?=\s) # is followed by whitespace
(?! # but not a link to this destination
\s*
\(.*?\)
\s+ # is followed by whitespace
( # followed by anything unmistakable for a link,
([^\[\(]|$) # or end of line
|
(?!
\(.*?\) # or, not immediately followed by a link URL
)
( # and not part of a link reference
(\[.*?\]\s*(\[.*?\]|\(.*?\))\s*)+
([^\[]|$)
)
)
///

Expand Down
8 changes: 4 additions & 4 deletions test/unit/test_updates.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -466,18 +466,18 @@ asyncTest "update ignores items that look like Task List items but are links", -

field = $ '<textarea>', class: 'js-task-list-field', text: """
- [ ] (link)
# - [ ] [reference]
- [ ] [reference]
- [ ] () collapsed
# - [ ] [] collapsed reference
- [ ] [] collapsed reference
- [ ] \\(escaped item)
- [ ] item
"""

changes = """
- [ ] (link)
# - [ ] [reference]
- [ ] [reference]
- [ ] () collapsed
# - [ ] [] collapsed reference
- [ ] [] collapsed reference
- [ ] \\(escaped item)
- [x] item
"""
Expand Down