Skip to content

Instantly share code, notes, and snippets.

@JJ JJ/list.p6
Created Dec 2, 2017

Embed
What would you like to do?
Find items in a markdown list
use v6;
use Text::Markdown;
use JSON::Tiny;
sub MAIN( Str $letter-to-santa = 'letters/dear-santa-list.md' ) {
my $letter = Text::Markdown::Document.new($letter-to-santa.IO.slurp());
my $flip = False;
my $list = $letter.items
.grep( { $flip = ( $flip
or so ($^þ ~~ Text::Markdown::Heading
and $^þ.level == 2
and $^þ.text ~~ m/<[Rr]>equest/) ) } )
.grep( { $^þ ~~ Text::Markdown::List })
.map( {$^þ.items} ).flat
.map( {$^þ.items} ).flat
.map( {$^þ.items} ).flat;
say to-json $list ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.