[GRASS-SVN] r30372 -
grass/branches/releasebranch_6_3/tools/g.html2man
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 27 02:28:47 EST 2008
Author: hamish
Date: 2008-02-27 02:28:46 -0500 (Wed, 27 Feb 2008)
New Revision: 30372
Modified:
grass/branches/releasebranch_6_3/tools/g.html2man/g.html2man
Log:
backport table/DD fixes from trunk
Modified: grass/branches/releasebranch_6_3/tools/g.html2man/g.html2man
===================================================================
--- grass/branches/releasebranch_6_3/tools/g.html2man/g.html2man 2008-02-27 04:17:46 UTC (rev 30371)
+++ grass/branches/releasebranch_6_3/tools/g.html2man/g.html2man 2008-02-27 07:28:46 UTC (rev 30372)
@@ -2,11 +2,22 @@
eval 'exec $GRASS_PERL -S $0 ${1+"$@"}'
if 0;
+############################################################################
+#
+# MODULE: g.html2man
+# AUTHOR(S): Daniel Calvelo Aros
+# PURPOSE: convert HTML formatted page to MAN page format
+# COPYRIGHT: (C) 2004 by the GRASS Development Team
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+
# Note: the GRASS_PERL variables must be set!
# Usage:
# perl g.html2man <html file> <man file> <section>
-#
-# Main author: Daniel Calvelo Aros
our $preformat, $in_bu, $in_nb, @nb_n;
our $suppress = 0;
@@ -41,7 +52,7 @@
$ncols = -1 + scalar split /<td/i, $one_row;
$has_header = m|<th|i ;
s|[\n\r]||g;
- s|</tr.*?>|\n|gis;
+ s|</tr.*?>|\n.br\n|gis;
s|</td.*?>|\t|gis;
foreach $tag ( qw(<td.*?> <th.*?> </th> <tr.*?>) ){
s/$tag//gi;
@@ -183,7 +194,7 @@
if (m#^ *<DD> *$#i) {return 0};
if (m#^ *</DD> *$#i) {return 0};
if (m#^</LI>$#i) {return 0};
- s#<DD>##i;
+ s#<DD>#\n.br\n#i;
s#</DD>##i;
s#^.*<DL> *$##i;
@@ -210,9 +221,11 @@
$nb_n[$in_nb]++ # because we post-increment after encountering each <li>
);
}
- s/<TD>/| /i;
- s/<TR>/\n/i;
+ # move into CvtTable() ??
+ s/<TD.*?>/\t| /gi;
+ s/<TR.*?>/\n.br\n/i;
+
return 1;
}
More information about the grass-commit
mailing list