-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I made a patch to sort the options sections in kdemangen.pl. They were in the order: Generic options: Qt options: KDE options: Options: Arguments:
Now they're in the order: Arguments: Options: Generic options: KDE options: Qt options: Because that's the order of their general usefulness as I see it. It's easily changed. [EMAIL PROTECTED] diff -Nu kdemangen.pl kdemangen-patched.pl - --- kdemangen.pl 2004-04-15 03:10:54.000000000 -0400 +++ kdemangen-patched.pl 2004-05-05 22:56:45.000000000 -0400 @@ -93,6 +93,88 @@ return $ret; }; +sub sortoptionsfromnroff { + # Zack Cerza + + # Rather than redo Dominique's optionstonroff(), I decided + # to make this function to sort the options sections created + # by his function. + + # What it does is read line-by-line and first determine which + # section it's looking at via the ".SS <SECTION>" lines. Once + # it knows, it sets a "$in_<SECTION>" variable to "1" and + # begins to write the section data into $<SECTION>. When it + # gets to a line that contains only ".SS ", it sets + # $in_<SECTION> to "0" and continues. + + # It's a little messy, but it's the only way I could + # get it to work with what little knowledge I had. + + # This is the first time I've used Perl. Be kind. + + my $options = shift; + my $ret=""; + + my $in_gen_opts = "0"; + my $gen_opts = ""; + my $in_qt_opts = "0"; + my $qt_opts = ""; + my $in_kde_opts = "0"; + my $kde_opts = ""; + my $in_opts = "0"; + my $opts = ""; + my $in_args = "0"; + my $args = ""; + + foreach ( split /\n/, $options ) { + if( $in_gen_opts == "1" ) { + if( /^(\.SS )$/ ) { $in_gen_opts = "0"; } + $gen_opts .= $_; + $gen_opts .= "\n"; + } + if( /^(\.SS.+Generic options:)$/ ) + { $in_gen_opts = "1"; $gen_opts .= $1; $gen_opts .= "\n"; } + + if( $in_qt_opts == "1" ) { + if( /^(\.SS )$/ ) { $in_qt_opts = "0"; } + $qt_opts .= $_; + $qt_opts .= "\n"; + } + if( /^(\.SS.+Qt options:)$/ ) + { $in_qt_opts = "1"; $qt_opts .= $1; $qt_opts .= "\n"; } + + if( $in_kde_opts == "1" ) { + if( /^(\.SS )$/ ) { $in_kde_opts = "0"; } + $kde_opts .= $_; + $kde_opts .= "\n"; + } + if( /^(\.SS.+KDE options:)$/ ) + { $in_kde_opts = "1"; $kde_opts .= $1; $kde_opts .= "\n"; } + + if( $in_opts == "1" ) { + if( /^(\.SS )$/ ) { $in_opts = "0"; } + $opts .= $_; + $opts .= "\n"; + } + if( /^(\.SS.+Options:)$/ ) + { $in_opts = "1"; $opts .= $1; $opts .= "\n"; } + + if( $in_args == "1" ) { + if( /^(\.SS )$/ ) { $in_args = "0"; } + $args .= $_; + $args .= "\n"; + } + if( /^(\.SS.+Arguments:)$/ ) + { $in_args = "1"; $args .= ".SS\n"; $args .= $1; $args .= "\n"; } + } + $ret .= $args; + $ret .= $opts; + $ret .= $gen_opts; + $ret .= $kde_opts; + $ret .= $qt_opts; + return $ret; + }; + sub usage { print "This script generates a nice manual page for a KDE app which uses KCmdLineArgs..\n"; @@ -124,6 +206,7 @@ my $options = `$runapp --help-all | sed -e '1,4d'`; $options = optionstonroff( $options ); +$options = sortoptionsfromnroff( $options ); my $timespec = ucfirst `date '+%b %G'`; chomp $timespec; - -- Zack Cerza <[EMAIL PROTECTED]> PGP Key ID: 9A8BE23F -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAma9mpkwJUpqL4j8RAhL5AJ90Oe1t0b1TP4YXpDHnfbfSmHEjAACfRp92 YchUal3j2Bj7xEpKxPhFuBc= =LLV8 -----END PGP SIGNATURE-----