From 1017f22cdde7c83c206d3735efd836455455d5de Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Sat, 18 Jan 2014 16:44:38 +0200 Subject: [PATCH] fix paragraph list --- Parsedown.php | 13 +++---------- tests/data/paragraph_list.html | 12 ++++++++++++ tests/data/paragraph_list.md | 9 +++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 tests/data/paragraph_list.html create mode 100644 tests/data/paragraph_list.md diff --git a/Parsedown.php b/Parsedown.php index 7b5feea..b7f4714 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -324,8 +324,6 @@ class Parsedown if ($element['type'] === 'paragraph' and isset($element['interrupted']) === false) { - $is_heading = true; - $chopped_line = rtrim($line); $i = 1; @@ -334,19 +332,14 @@ class Parsedown { if ($chopped_line[$i] !== $line[0]) { - $is_heading = false; - - break; + break 2; } $i++; } - if ($is_heading) - { - $element['type'] = 'heading'; - $element['level'] = $line[0] === '-' ? 2 : 1; - } + $element['type'] = 'heading'; + $element['level'] = $line[0] === '-' ? 2 : 1; continue 2; } diff --git a/tests/data/paragraph_list.html b/tests/data/paragraph_list.html new file mode 100644 index 0000000..ced1c43 --- /dev/null +++ b/tests/data/paragraph_list.html @@ -0,0 +1,12 @@ +

paragraph

+ +

paragraph

+ \ No newline at end of file diff --git a/tests/data/paragraph_list.md b/tests/data/paragraph_list.md new file mode 100644 index 0000000..b973908 --- /dev/null +++ b/tests/data/paragraph_list.md @@ -0,0 +1,9 @@ +paragraph +- li +- li + +paragraph + + * li + + * li \ No newline at end of file