+ # List Item
- if (preg_match('{^<(\w+)(?:[ ].*?)?>}', $line, $matches))
+ if (preg_match('/^([ ]*)(\d+[.]|[*+-])[ ](.*)/', $line, $matches))
{
$elements []= $element;
$element = array(
- 'type' => 'block',
- 'subtype' => strtolower($matches[1]),
- 'text' => $line,
- 'depth' => 0,
+ 'type' => 'li',
+ 'ordered' => isset($matches[2][1]),
+ 'indentation' => $matches[1],
+ 'last' => true,
+ 'lines' => array(
+ preg_replace('/^[ ]{0,4}/', '', $matches[3]),
+ ),
);
- preg_match('{'.$matches[1].'>\s*$}', $line) and $element['closed'] = true;
-
continue;
}
diff --git a/tests/data/sparse_list.html b/tests/data/sparse_list.html
index e83f2dc..2b6bf1d 100644
--- a/tests/data/sparse_list.html
+++ b/tests/data/sparse_list.html
@@ -1,14 +1,16 @@
-Here's a list where items are separated by empty lines:
-
--
-
list item
-
-- another list item
-
-Here's an ordered one:
-
--
-
item one
-
-- item two
-
\ No newline at end of file
+Here's a sparse list:
+
+-
+
list item
+
+- another list item
+
+Here's one with an indented list item:
+
\ No newline at end of file
diff --git a/tests/data/sparse_list.md b/tests/data/sparse_list.md
index b7f3ea6..5bad1bd 100644
--- a/tests/data/sparse_list.md
+++ b/tests/data/sparse_list.md
@@ -1,11 +1,11 @@
-Here's a list where items are separated by empty lines:
-
-- list item
-
-- another list item
-
-Here's an ordered one:
-
-1. item one
-
-2. item two
\ No newline at end of file
+Here's a sparse list:
+
+- list item
+
+- another list item
+
+Here's one with an indented list item:
+
+- li
+
+ - li
\ No newline at end of file