From a4bda31855caa62adeac8650e27f93677e4e61c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Nizio?= Date: Sat, 20 Aug 2011 18:14:13 +0200 Subject: [PATCH] [man] small correction in manual page, update POD (etc.) generator --- docs/man/equo.pod | 4 +-- docs/man/man1/activator.1 | 4 +-- docs/man/man1/equo.1 | 8 ++--- docs/man/man1/reagent.1 | 4 +-- docs/man/pod-generator/Pod.pm | 3 +- docs/man/pod-generator/Wiki.pm | 53 ++++++++++++++++++++++++++++++++++ docs/man/pod-generator/halp.pl | 32 +++++++------------- 7 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 docs/man/pod-generator/Wiki.pm diff --git a/docs/man/equo.pod b/docs/man/equo.pod index 2e7459447..0ed825643 100644 --- a/docs/man/equo.pod +++ b/docs/man/equo.pod @@ -47,7 +47,7 @@ print version disable colorized output -=item B<--color> +=item [1] B<--color> force colorized output @@ -1549,4 +1549,4 @@ Fabio Erculiani =head1 SEE ALSO -reagent(1), activator(1) \ No newline at end of file +reagent(1), activator(1) diff --git a/docs/man/man1/activator.1 b/docs/man/man1/activator.1 index a3c8feeb8..f77707383 100644 --- a/docs/man/man1/activator.1 +++ b/docs/man/man1/activator.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) +.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "ACTIVATOR 1" -.TH ACTIVATOR 1 "2011-06-26" "perl v5.12.3" "Entropy" +.TH ACTIVATOR 1 "2011-07-24" "perl v5.12.3" "Entropy" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/docs/man/man1/equo.1 b/docs/man/man1/equo.1 index d227f0da8..323be9eb0 100644 --- a/docs/man/man1/equo.1 +++ b/docs/man/man1/equo.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) +.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EQUO 1" -.TH EQUO 1 "2011-06-25" "perl v5.12.3" "Entropy" +.TH EQUO 1 "2011-08-20" "perl v5.12.3" "Entropy" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -168,8 +168,8 @@ print version .IP "[1] \fB\-\-nocolor\fR" 4 .IX Item "[1] --nocolor" disable colorized output -.IP "\fB\-\-color\fR" 4 -.IX Item "--color" +.IP "[1] \fB\-\-color\fR" 4 +.IX Item "[1] --color" force colorized output .IP "[1] \fB\-\-bashcomp\fR" 4 .IX Item "[1] --bashcomp" diff --git a/docs/man/man1/reagent.1 b/docs/man/man1/reagent.1 index bad049275..05c41f335 100644 --- a/docs/man/man1/reagent.1 +++ b/docs/man/man1/reagent.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) +.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "REAGENT 1" -.TH REAGENT 1 "2011-08-05" "perl v5.12.3" "Entropy" +.TH REAGENT 1 "2011-08-11" "perl v5.12.3" "Entropy" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/docs/man/pod-generator/Pod.pm b/docs/man/pod-generator/Pod.pm index 74d3a6b38..f524b828f 100644 --- a/docs/man/pod-generator/Pod.pm +++ b/docs/man/pod-generator/Pod.pm @@ -148,7 +148,8 @@ Fabio Erculiani =head1 SEE ALSO -reagent(1), activator(1)}; +reagent(1), activator(1) +}; } sub conv { diff --git a/docs/man/pod-generator/Wiki.pm b/docs/man/pod-generator/Wiki.pm new file mode 100644 index 000000000..86ba862dd --- /dev/null +++ b/docs/man/pod-generator/Wiki.pm @@ -0,0 +1,53 @@ +use warnings; +use strict; +use 5.010; + +# by Enlik +# April 2011 + +package Wiki; + +sub new { + my $class = shift; + my $strs = shift || die "specify parameter"; + + unless (ref $strs eq "ARRAY") { + die "wrong parameter"; + } + + my $self = { + strs => $strs + }; + + bless $self, $class; +} + +sub generate { + my $self = shift; + my @strs = @{$self->{strs}}; + + for my $h (@strs) { + my ($indent, $cmd, $desc); + $indent = $h->{indent}; + $cmd = $h->{command}; + $desc = $h->{desc}; + + # only one space on the beginning of commands + # (format requires a space) + if ($indent == 1) { + print " "; + } + elsif ($indent >= 2) { + print " "x(8*$indent-8); + } + + if ($indent == 0) { + print "\n===$desc===\n\n"; + } + else { + print "'''",$cmd,"'''", " "x8, $desc, "\n"; + } + } +} + +1; diff --git a/docs/man/pod-generator/halp.pl b/docs/man/pod-generator/halp.pl index a4877c8b5..41166530f 100644 --- a/docs/man/pod-generator/halp.pl +++ b/docs/man/pod-generator/halp.pl @@ -20,6 +20,7 @@ my @strs; # command line arg: # -p generate pod file +# -w generate in MediaWiki format # pass to stdin equo --help (English), # you may use: LANG=en_US.UTF-8 equo | perl @@ -31,8 +32,16 @@ if (@ARGV and $ARGV[0] eq "-p") { my $conv = Pod->new(\@strs); $conv->generate; } +elsif (@ARGV and $ARGV[0] eq "-w") { + require Wiki; + @strs = parse_input(); + + my $conv = Wiki->new(\@strs); + $conv->generate; +} else { - print "bad command, use -p\n"; + say "usage: equo --help | perl $0