[man] small correction in manual page, update POD (etc.) generator

This commit is contained in:
Sławomir Nizio
2011-08-20 18:14:13 +02:00
parent 97f4a3d6f9
commit a4bda31855
7 changed files with 75 additions and 33 deletions

View File

@@ -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 <lxnay@sabayon.org>
=head1 SEE ALSO
reagent(1), activator(1)
reagent(1), activator(1)

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -148,7 +148,8 @@ Fabio Erculiani <lxnay@sabayon.org>
=head1 SEE ALSO
reagent(1), activator(1)};
reagent(1), activator(1)
};
}
sub conv {

View File

@@ -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;

View File

@@ -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 <this script>
@@ -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 <option>";
say "available options: -p (POD), -w (Wiki)";
exit 1;
}
@@ -73,27 +82,6 @@ sub parse_input {
$cmd = "";
$desc = $line;
}
## hop <branch> upgrade your distribution to a new release (branch)
#if ($line =~ /^(\S+ <.+>)\s*(.*)/) {
#$cmd = $1;
#$desc = $2;
#}
## notice [repos] repository notice board reader
#elsif ($line =~ /^(\S+ \[.+\])\s*(.*)/) {
#$cmd = $1;
#$desc = $2;
#}
## search search packages in repositories
#elsif ($line =~ /^(\S+)\s*(.*)/) {
#$cmd = $1;
#$desc = $2;
#}
#else {
## ?
#$level = 0;
#$cmd = "";
#$desc = $line;
#}
push @strs, { indent => $level, command => $cmd, desc => $desc };
}