Browse files

add atom2file script

  • Loading branch information...
1 parent a934ea0 commit 7c87eeffede4aa66fdab5a79b2f9dbbccd9d3036 @zag committed with zag Dec 13, 2012
Showing with 87 additions and 1 deletion.
  1. +86 −0 scripts/atom2file
  2. +1 −1 scripts/writeat
View
86 scripts/atom2file
@@ -0,0 +1,86 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use v5.10;
+use Data::Dumper;
+use IO::File;
+my ( $help, $man, $template );
+my %opt = (
+ help => \$help,
+ man => \$man,
+ template => \$template,
+);
+GetOptions( \%opt, 'help|?', 'man', "template|t:s" )
+ or pod2usage(2);
+pod2usage(1) if $help;
+pod2usage( -exitstatus => 0, -verbose => 2 ) if $man;
+
+unless ($template) {
+ pod2usage( -exitstatus => 2, -message => 'Need -template [file]!' );
+}
+
+{
+ my $infile = shift;
+ my $in_fd;
+ if ($infile) {
+ $in_fd = new IO::File:: "< $infile" or die "$infile: $!";
+ }
+ else {
+ $in_fd = \*STDIN;
+ }
+ my $in;
+ { local $/; undef $/; $in = <$in_fd> };
+}
+
+=head1 NAME
+
+ atom2file - render html files from atom file
+
+=head1 SYNOPSIS
+
+ atom2file -template contrib/template.tmpl < atom.xml
+
+
+ [options]:
+
+ -help - print help message
+ -man - print man page
+
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<-help>
+
+Print a brief help message and exit
+
+=item B<-man>
+
+Prints manual page and exit
+
+=back
+
+=head1 DESCRIPTION
+
+ atom2file - render html files from atom file
+
+=head1 EXAMPLE
+
+ atom2file -template contrib/template.tmpl < atom.xml
+
+=head1 AUTHOR
+
+Zahatski Aliaksandr, E<lt>zahatski@gmail.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2012 by Zahatski Aliaksandr
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
View
2 scripts/writeat
@@ -128,7 +128,7 @@ unless ($type) {
$r->title_page(%res);
$r->w->raw(
-'\tableofcontents{} % это оглавление, которое генерируется автоматически
+'\tableofcontents{} % auto toc
\newpage'
);

0 comments on commit 7c87eef

Please sign in to comment.