mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Replace $first with $indent to get uniform indentation and simplify
This commit is contained in:
parent
cab1380031
commit
9e23ea9eeb
@ -17,8 +17,8 @@ getopts("hv") or usage($HELP);
|
|||||||
$opt_v and usage("Copyleft (c) 2006, Russ Rowan (See `COPYING')");
|
$opt_v and usage("Copyleft (c) 2006, Russ Rowan (See `COPYING')");
|
||||||
usage($HELP) if $opt_h or @ARGV < 1;
|
usage($HELP) if $opt_h or @ARGV < 1;
|
||||||
|
|
||||||
my ($found, $first, $idpath);
|
my ($found, $indent, $idpath);
|
||||||
$idpath = '';
|
$idpath = ''; $indent = '';
|
||||||
while (<>)
|
while (<>)
|
||||||
{
|
{
|
||||||
# Match:
|
# Match:
|
||||||
@ -33,21 +33,25 @@ while (<>)
|
|||||||
|
|
||||||
if ($found)
|
if ($found)
|
||||||
{
|
{
|
||||||
if (/^\s+\*\s$/) { next if $first; $_ =~ s/\s\*// if not $first; }
|
$found = 'sorta' if s/\s*\*+\//\n/;
|
||||||
if (/^\s\*+\/$/ or $_ !~ /^\s/) { $found = undef; next; }
|
s/^(\s|\*)*/$indent/;
|
||||||
$_ =~ s/^(\s*)\s\*\s/$1/;
|
s/^$indent$/\n/;
|
||||||
$found = 'sorta' if s/\s*\*\/$/\n/; $first = undef;
|
|
||||||
}
|
}
|
||||||
elsif (/^\s*\/\*\*\s(.*)/)
|
elsif (/^\s*\/\*\*\s(.*)/)
|
||||||
{
|
{
|
||||||
$_ = $1; $first = 1;
|
$_ = $1;
|
||||||
if (/\s*\*\/$/) { $found = 'sorta'; } else { $found = $.; }
|
if (/\s*\*\/$/) { $found = 'sorta'; } else { $found = $.; }
|
||||||
if (/struct:[[]([^\]]+)[\]]/) { $idpath = "$1."; } else { $idpath = ''; }
|
if (/struct:[[]([^\]]+)[\]]/) { $idpath = "$1."; } else { $idpath = ''; }
|
||||||
if (/::/) { $_ = "\n$_\n\n"; }
|
if (/::/)
|
||||||
|
{
|
||||||
|
$_ = "\n$_\n\n";
|
||||||
|
$indent = "\t";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
my $dash; for (my $x = 0; $x < length($_); $x++) { $dash .= '-'; }
|
my $dash; for (my $x = 0; $x < length($_); $x++) { $dash .= '-'; }
|
||||||
$_ = "\n$_\n$dash\n\n";
|
$_ = "\n$_\n$dash\n";
|
||||||
|
$indent = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next if not $found; $found = undef if $found eq 'sorta';
|
next if not $found; $found = undef if $found eq 'sorta';
|
||||||
|
Loading…
Reference in New Issue
Block a user