commit aa1c94384abf7845fcc6174746ef75a6e2180b57 Author: Dominik Meyer Date: Mon Jun 25 15:45:44 2018 +0200 ADD: initial commit diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..f6dea33 --- /dev/null +++ b/dist.ini @@ -0,0 +1,14 @@ +name = HiD-Processor-Markdown +author = Dominik Meyer +license = Perl_5 +copyright_holder = Dominik Meyer +copyright_year = 2018 + +[@Basic] +[@Git] +[Git::NextVersion] + first_version = 0.001 ; this is the default + version_by_branch = 0 ; this is the default + version_regexp = ^v(.+)$ ; this is the default +[PodWeaver] +[ChangelogFromGit] diff --git a/lib/HiD/Generator/Markdown.pm b/lib/HiD/Generator/Markdown.pm new file mode 100644 index 0000000..a75ff88 --- /dev/null +++ b/lib/HiD/Generator/Markdown.pm @@ -0,0 +1,58 @@ +package HiD::Generator::Markdown; +#ABSTRACT: Markdown Processor for HiD +use Moose; +with 'HiD::Generator'; +use File::Find; +use File::Basename; + +=head1 DESCRIPTION + +This generator searches for all markdown files within the HiD working +directory and generates html pages from them. + +=cut + +=attr markdown files + +all found markdown files + +=cut +has 'markdown_files' => (is=>'rw', defaults => sub{return [];}); + + +sub generate { + my( $self , $site ) = @_; + my $follow = $site->config->{markdown}{follow_symlinks} || "false"; + + return unless $site->config->{markdown}{generate}; + + if ($follow=~/true/) + { + $follow=1; + } + else + { + $follow=0; + } + + # find all markdown files + find(sub { + return unless substr($_,0,1) != "_"; + + my($filename, $dirs, $suffix) = fileparse($File::Find::name); + + return unless $suffix=="md"; + + push(@{$self->markdown_files()},$File::Find::name); + + }, + [$site->config->{source}] + ); + + # generate pages + + +} + + +1;