summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLev Lamberov <dogsleg@debian.org>2018-03-17 23:23:31 +0500
committerLev Lamberov <dogsleg@debian.org>2018-03-20 10:47:54 +0500
commita17681d2b42cbe7f7f1a80962da7dbfa78c6408b (patch)
tree7de0deee0667321c6b242801fc4c00f77a535304
parentbab47c42855b00a1e651e73c11d1cde3a7571251 (diff)
Add support for md, markdown, mdwn, and org documentation files
-rw-r--r--lib/DhMakeELPA/Command/Packaging.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm
index 40a440a..cc4dd42 100644
--- a/lib/DhMakeELPA/Command/Packaging.pm
+++ b/lib/DhMakeELPA/Command/Packaging.pm
@@ -289,14 +289,19 @@ sub create_gbp_conf {
}
# TODO more complex case with more than one binary package
-# TODO support .markdown, .mdwn etc.
sub create_docs {
my $self = shift;
- my @docs = glob($self->main_dir . "/*.md");
+
+ my $doc_regexp = qr/\.md$|\.markdown$|\.mdwn$|\.org$/i;
+ opendir my $dh, $self->main_dir or die "$0: Unable to open directory: $!";
+ my @docs = grep { /$doc_regexp/ && -f "$self->{main_dir}/$_" } readdir($dh);
+ closedir $dh;
if ( keys %{$self->bins} le 1 && scalar @docs gt 0 ) {
my $fh = $self->_file_w( $self->debian_file('docs') );
- $fh->print( "*.md\n" );
+ for (@docs) {
+ $fh->print( "$_\n" );
+ }
$fh->close;
} else {
print "I: couldn't generate d/docs: not fully implemented\n";