The following commit has been merged in the master branch:
commit 601da3454a8e2567c96bb3403402939313fd5065
Author: James Vega <[email protected]>
Date:   Sat Feb 12 09:35:18 2011 -0500

    bts: Use Pod::Text to remove POD markup before displaying the help.
    
    Signed-off-by: James Vega <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index 167d5fc..c8eea87 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ devscripts (2.10.71) UNRELEASED; urgency=low
   * debcommit (git): Don't treat "no files to commit" as an error when called
     with --release, otherwise it is not possible to tag after the final build.
 
+  [ James Vega ]
+  * bts: Use Pod::Text to remove POD markup before displaying the help.
+
  -- Christoph Berg <[email protected]>  Sat, 12 Feb 2011 14:26:10 +0100
 
 devscripts (2.10.70) unstable; urgency=low
diff --git a/scripts/bts.pl b/scripts/bts.pl
index 4b47089..26477ab 100755
--- a/scripts/bts.pl
+++ b/scripts/bts.pl
@@ -23,6 +23,19 @@
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
+# Use our own subclass of Pod::Text to
+# a) Strip the POD markup before displaying it via "bts help"
+# b) Automatically display the text which is supposed to be replaced by the
+#    user between <>, as per convention.
+package Pod::BTS;
+use strict;
+
+use base qw(Pod::Text);
+
+sub cmd_i { return '<' . $_[2] . '>' }
+
+package main;
+
 =head1 NAME
 
 bts - developers' command line interface to the BTS
@@ -2407,8 +2420,17 @@ EOF
        next unless $inlist;
        $insublist = 1 if /^=over [^4]/;
        $insublist = 0 if /^=back/;
-       print "\t$1\n" if /^=item\s([^\-].*)/ and ! $insublist;
-       last if defined $1 and $1 eq 'help';
+       if (/^=item\sB<([^->].*)>/ and ! $insublist) {
+           if ($1 eq 'help') {
+               last;
+           }
+           # Strip POD markup before displaying and ensure we don't wrap
+           # longer lines
+           my $parser = Pod::BTS->new(width => 100);
+           $parser->no_whining(1);
+           $parser->output_fh(\*STDOUT);
+           $parser->parse_string_document($_);
+       }
     }
 }
 

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to