Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CentralNic
parsedown
Commits
609ad47c
Commit
609ad47c
authored
Jul 26, 2013
by
Emanuil
Browse files
resolve #16
parent
7d7e89f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Parsedown.php
View file @
609ad47c
...
...
@@ -157,7 +157,6 @@ class Parsedown
{
$markup
.
=
'<'
.
$list_type
.
'>'
.
"
\n
"
;
# Of the same type and indentation.
$list_items
=
preg_split
(
'/^([ ]{'
.
$list_indentation
.
'})'
.
$list_marker_pattern
.
'[ ]/m'
,
$list
,
-
1
,
PREG_SPLIT_NO_EMPTY
);
foreach
(
$list_items
as
$list_item
)
...
...
@@ -175,7 +174,7 @@ class Parsedown
}
else
{
$list_item
=
$this
->
parse_lines
(
$list_item
);
$list_item
=
$this
->
parse_lines
(
$list_item
,
TRUE
);
}
$markup
.
=
"
\n
"
.
$list_item
;
...
...
@@ -277,7 +276,7 @@ class Parsedown
{
if
(
strpos
(
$block
,
"
\n
"
))
{
$markup
.
=
$this
->
parse_lines
(
$block
);
$markup
.
=
$this
->
parse_lines
(
$block
,
TRUE
);
}
else
{
...
...
@@ -292,7 +291,7 @@ class Parsedown
return
$markup
;
}
private
function
parse_lines
(
$text
)
private
function
parse_lines
(
$text
,
$paragraph_based
=
FALSE
)
{
$text
=
trim
(
$text
,
"
\n
"
);
...
...
@@ -473,9 +472,11 @@ class Parsedown
{
if
(
isset
(
$paragraph
))
{
$
element
_text
=
$this
->
parse_inline_elements
(
$paragraph
);
$
paragraph
_text
=
$this
->
parse_inline_elements
(
$paragraph
);
$markup
.
=
'<p>'
.
$element_text
.
'</p>'
.
"
\n
"
;
$markup
.
=
$markup
===
''
&&
$paragraph_based
===
FALSE
?
$paragraph_text
:
'<p>'
.
$paragraph_text
.
'</p>'
.
"
\n
"
;
unset
(
$paragraph
);
}
...
...
tests/data/
regular
_list.html
→
tests/data/
dense
_list.html
View file @
609ad47c
...
...
@@ -14,4 +14,11 @@
- another list item
</code></pre>
<p>
Here's one with no space after markers:
</p>
<p>
-list item
-another list item
</p>
\ No newline at end of file
-another list item
</p>
<p>
Here's one where items contain line breaks:
</p>
<ul>
<li>
list
item
</li>
<li>
another
list item
</li>
</ul>
\ No newline at end of file
tests/data/
regular
_list.md
→
tests/data/
dense
_list.md
View file @
609ad47c
...
...
@@ -17,4 +17,11 @@ Here's one with too much space before items:
Here's one with no space after markers:
-list item
-another list item
\ No newline at end of file
-another list item
Here's one where items contain line breaks:
-
list
item
-
another
list item
\ No newline at end of file
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