ADD: initial commit
This commit is contained in:
commit
aa1c94384a
14
dist.ini
Normal file
14
dist.ini
Normal file
@ -0,0 +1,14 @@
|
||||
name = HiD-Processor-Markdown
|
||||
author = Dominik Meyer <dmeyer@federationhq.de>
|
||||
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]
|
58
lib/HiD/Generator/Markdown.pm
Normal file
58
lib/HiD/Generator/Markdown.pm
Normal file
@ -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;
|
Loading…
Reference in New Issue
Block a user