-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add genapi.pl script to build asciidoc from pod
- Loading branch information
1 parent
9fc5dc4
commit 5b9959f
Showing
2 changed files
with
104 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env perl | ||
use strict; | ||
use warnings; | ||
|
||
use Pod::AsciiDoctor; | ||
|
||
my $adoc = Pod::AsciiDoctor->new(); | ||
|
||
my $data_dir = "./src/"; | ||
opendir(DIR, $data_dir) or die("Cannot read directories: $data_dir"); | ||
my @files = grep { /\.pm$/ } readdir DIR; | ||
|
||
foreach my $current_file (@files) { | ||
|
||
open(my $ifh, '<', $data_dir . $current_file) or die("Cannot open $current_file"); | ||
$current_file =~ s/^(.*)\.pm$/$1.asciidoc/; | ||
open(my $ofh, ">", $current_file) or die("Cannot open $current_file"); | ||
|
||
print "Transforming $current_file\n"; | ||
$adoc->append("include::header.asciidoc[]"); | ||
$adoc->append("\n"); | ||
$adoc->parse_from_filehandle($ifh); | ||
|
||
print $ofh $adoc->adoc(); | ||
close($ofh); | ||
close($ifh); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters