Permalink
Browse files

formatting added

  • Loading branch information...
troydm committed Feb 3, 2014
1 parent b03b1ef commit f806c06cb8d70813a9658efa83370676ac1a157b
Showing with 10 additions and 1 deletion.
  1. +10 −1 exp
View
11 exp
@@ -70,14 +70,23 @@ sub parsetag {
return ();
}
+sub formatdesc {
+ my ($t,$d) = (@_);
+ if($d =~ /\n/){
+ my $offset = ' ' x (length($t)+6);
+ $d =~ s/\n\s*/\n$offset/g;
+ }
+ return $d;
+}
+
my @helprefs = $content =~ /helpref=\"help-(\d+)\"/g;
for my $i (@helprefs){
my @t = parsetag("span","help-$i");
my @d = parsetag("pre","help-$i");
if(@t){
my $title = decodechars(striptags $t[1]) if @t;
- my $desc = decodechars(striptags $d[1]) if @d;
+ my $desc = formatdesc($title, decodechars(striptags $d[1])) if @d;
if($color){
print "\n", $title, color($color), " ---[", color("reset")
, " $desc ", color($color), "]", color("reset"), "\n\n";

0 comments on commit f806c06

Please sign in to comment.