Skip to content

Commit

Permalink
add prerequisites and perltidy
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Dec 15, 2014
1 parent 6ae6a08 commit 3cf8291
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ WriteMakefile(
'JSON' => 0,
'JSON::XS' => 0,
'JSON::Path' => 0,
'List::AllUtils' => 0,
'List::MoreUtils' => 0,
'List::Util' => 0,
'LWP::Simple' => 0,
'MIME::Lite' => 0,
'Net::Delicious' => 0,
'Path::Tiny' => 0,
'PerlX::Maybe' => 0,
'Template' => 0,
'Test::More' => 0,
'Perl::Tidy' => '20140711', # Apparently Test::Code::TidyAll does not explicitly depend on it
Expand Down
34 changes: 18 additions & 16 deletions bin/mkd2json.pl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

$newsletter->{subject} = ( shift @file ) =~ s/^#\s*//r;
$newsletter->{date} = shift @file;
$newsletter->{editor} = 'yanick_champoux';
$newsletter->{editor} = 'yanick_champoux';

## header stuff
my @headers;
Expand All @@ -36,7 +36,7 @@
my @entries = slurp_entries( \@file )
or next;

warn "adding $title\n";
warn "adding $title\n";

push @{ $newsletter->{chapters} },
{
Expand All @@ -60,29 +60,31 @@ sub slurp_entries {
last if $file->[0] =~ /^##\s+/m;

my $title = ( shift @$file ) =~ s/^###\s*//r;
my @meta;
push @meta, shift @$file until $file->[0] =~ /^\s*$/;
my @meta;
push @meta, shift @$file until $file->[0] =~ /^\s*$/;

my( $link, $date, $author ) = @meta;
my ( $link, $date, $author ) = @meta;
my $date =~ y/-/./;
$author =~ y/ /_/;
$author = lc $author;
$author =~ y/ /_/;
$author = lc $author;

shift @$file while @$file and $file->[0] =~ /^\s*$/;
shift @$file while @$file and $file->[0] =~ /^\s*$/;

my $text = '';
$text .= ' ' . shift @$file while @$file and $file->[0] !~ /^(?:#|\s*$)/;
$text .= ' ' . shift @$file
while @$file
and $file->[0] !~ /^(?:#|\s*$)/;
$text =~ s/^\s+|\s+$//g;

push @entries,
{
title => $title,
text => $text,
url => $link,
ts => $date,
link => '',
tags => [],
maybe author => $author,
title => $title,
text => $text,
url => $link,
ts => $date,
link => '',
tags => [],
maybe author => $author,
};
}

Expand Down

0 comments on commit 3cf8291

Please sign in to comment.