Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
6883e6e0
Commit
6883e6e0
authored
Apr 29, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all references to `parse_tasks`
parent
e167f285
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
139 deletions
+5
-139
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+1
-1
app/views/projects/merge_requests/show/_mr_box.html.haml
app/views/projects/merge_requests/show/_mr_box.html.haml
+1
-1
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+3
-28
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+0
-109
No files found.
app/views/projects/issues/show.html.haml
View file @
6883e6e0
...
...
@@ -34,7 +34,7 @@
.description.js-task-list-container
.wiki
=
preserve
do
=
markdown
(
@issue
.
description
,
parse_tasks:
true
)
=
markdown
(
@issue
.
description
)
%textarea
.hidden.js-task-list-field
=
@issue
.
description
...
...
app/views/projects/merge_requests/show/_mr_box.html.haml
View file @
6883e6e0
...
...
@@ -6,6 +6,6 @@
.description.js-task-list-container
.wiki
=
preserve
do
=
markdown
(
@merge_request
.
description
,
parse_tasks:
true
)
=
markdown
(
@merge_request
.
description
)
%textarea
.hidden.js-task-list-field
=
@merge_request
.
description
lib/gitlab/markdown.rb
View file @
6883e6e0
...
...
@@ -32,9 +32,9 @@ module Gitlab
# Public: Parse the provided text with GitLab-Flavored Markdown
#
# text - the source text
# options -
parse_tasks - render tasks
#
- xhtml
- output XHTML instead of HTML
#
- reference_only_path
- Use relative path for reference links
# options -
A Hash of options used to customize output (default: {}):
#
:xhtml
- output XHTML instead of HTML
#
:reference_only_path
- Use relative path for reference links
# project - the project
# html_options - extra options for the reference links as given to link_to
def
gfm_with_options
(
text
,
options
=
{},
project
=
@project
,
html_options
=
{})
...
...
@@ -46,7 +46,6 @@ module Gitlab
text
=
text
.
dup
.
to_str
options
.
reverse_merge!
(
parse_tasks:
false
,
xhtml:
false
,
reference_only_path:
true
)
...
...
@@ -77,10 +76,6 @@ module Gitlab
text
=
result
[
:output
].
to_html
(
save_with:
save_options
)
# if options[:parse_tasks]
# text = parse_tasks(text)
# end
text
.
html_safe
end
...
...
@@ -112,25 +107,5 @@ module Gitlab
TaskList
::
Filter
]
end
# Turn list items that start with "[ ]" into HTML checkbox inputs.
def
parse_tasks
(
text
)
li_tag
=
'<li class="task-list-item">'
unchecked_box
=
'<input type="checkbox" value="on" disabled />'
checked_box
=
unchecked_box
.
sub
(
/\/>$/
,
'checked="checked" />'
)
# Regexp captures don't seem to work when +text+ is an
# ActiveSupport::SafeBuffer, hence the `String.new`
String
.
new
(
text
).
gsub
(
Taskable
::
TASK_PATTERN_HTML
)
do
checked
=
$LAST_MATCH_INFO
[
:checked
].
downcase
==
'x'
p_tag
=
$LAST_MATCH_INFO
[
:p_tag
]
if
checked
"
#{
li_tag
}#{
p_tag
}#{
checked_box
}
"
else
"
#{
li_tag
}#{
p_tag
}#{
unchecked_box
}
"
end
end
end
end
end
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
6883e6e0
...
...
@@ -43,115 +43,6 @@ describe GitlabMarkdownHelper do
expect
(
gfm
(
actual
)).
to
match
(
expected
)
end
end
context
'parse_tasks: true'
do
before
(
:all
)
do
@source_text_asterisk
=
<<-
EOT
.
strip_heredoc
* [ ] valid unchecked task
* [x] valid lowercase checked task
* [X] valid uppercase checked task
* [ ] valid unchecked nested task
* [x] valid checked nested task
[ ] not an unchecked task - no list item
[x] not a checked task - no list item
* [ ] not an unchecked task - too many spaces
* [x ] not a checked task - too many spaces
* [] not an unchecked task - no spaces
* Not a task [ ] - not at beginning
EOT
@source_text_dash
=
<<-
EOT
.
strip_heredoc
- [ ] valid unchecked task
- [x] valid lowercase checked task
- [X] valid uppercase checked task
- [ ] valid unchecked nested task
- [x] valid checked nested task
EOT
end
it
'should render checkboxes at beginning of asterisk list items'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid lowercase checked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid uppercase checked task/
)
end
it
'should render checkboxes at beginning of dash list items'
do
rendered_text
=
markdown
(
@source_text_dash
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid lowercase checked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid uppercase checked task/
)
end
it
'should render checkboxes for nested tasks'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
end
it
'should not be confused by whitespace before bullets'
do
rendered_text_asterisk
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
rendered_text_dash
=
markdown
(
@source_text_dash
,
parse_tasks:
true
)
expect
(
rendered_text_asterisk
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text_asterisk
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
expect
(
rendered_text_dash
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text_dash
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
end
it
'should not render checkboxes outside of list items'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - no list item/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not a checked task - no list item/
)
end
it
'should not render checkboxes with invalid formatting'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - too many spaces/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not a checked task - too many spaces/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - no spaces/
)
expect
(
rendered_text
).
not_to
match
(
/Not a task.*<input.*checkbox.*not at beginning/
)
end
end
end
describe
'#link_to_gfm'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment