Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix * list not working correctly #28

Merged
merged 2 commits into from Jun 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Text/Markdown/Document.pm6
Expand Up @@ -371,6 +371,7 @@ class Text::Markdown::Document {
}
else {
$chunk ~~ s/^\s+\-\s+//;
$chunk ~~ s/^\*\s+//;
}
@list-items.push(self.new($chunk)) if $chunk && $in-list;
@items.push(Text::Markdown::List.new(:items(@list-items), :numbered($list-ordered))) if @list-items;
Expand Down
11 changes: 9 additions & 2 deletions t/parse.t
Expand Up @@ -2,7 +2,7 @@ use v6;
use Text::Markdown::Document;
use Test;

plan 182;
plan 184;

my $text = q:to/TEXT/;
## Markdown Test ##
Expand Down Expand Up @@ -53,11 +53,14 @@ $text = q:to/TEXT/;
1. ol One
2. ol Two

* Other List One
* Other List Two

TEXT

$document = Text::Markdown::Document.new($text);
ok $document ~~ Text::Markdown::Document, 'Able to parse';
is $document.items.elems, 5, 'has correct number of items';
is $document.items.elems, 6, 'has correct number of items';

my $li = $document.items[0];
ok $li ~~ Text::Markdown::List, 'first element is a list';
Expand Down Expand Up @@ -95,6 +98,10 @@ ok $li ~~ Text::Markdown::List, 'fifth element is a list';
ok $li.numbered, '...which is ordered';
ok $li.items == 2, '...with two items';

$li = $document.items[5];
ok $li ~~ Text::Markdown::List, 'sixth element is a list';
ok $li.items == 2;

## next text with lists
$text = q:to/TEXT/;
This is a *paragraph* with **many** `different` ``inline` elements``.
Expand Down