Author: johannes Date: 2007-11-21 03:49:23 -0600 (Wed, 21 Nov 2007) New Revision: 9821
Modified: trunk/gnue-common/src/apps/manpage.py Log: Reindented Modified: trunk/gnue-common/src/apps/manpage.py =================================================================== --- trunk/gnue-common/src/apps/manpage.py 2007-11-21 09:48:24 UTC (rev 9820) +++ trunk/gnue-common/src/apps/manpage.py 2007-11-21 09:49:23 UTC (rev 9821) @@ -33,19 +33,19 @@ class ManPage: - """ - Create a man page for this utility. - """ + """ + Create a man page for this utility. + """ - def __init__(self, app, dest, format=None, options={}): + def __init__(self, app, dest, format=None, options={}): - year = time.strftime("%Y", time.localtime(time.time())) + year = time.strftime("%Y", time.localtime(time.time())) - COMMAND = string.replace(app.COMMAND,'-','\-') + COMMAND = string.replace(app.COMMAND,'-','\-') - # - # HEADER + NAME Sections - # + # + # HEADER + NAME Sections + # # dest.write ("""\ # .ig # Copyright (C) 2000-%s Free Software Foundation, Inc. @@ -67,121 +67,120 @@ # .. # """ % year) - dest.write('.TH %s 1 "%s" "%s"\n' % ( - string.upper(COMMAND), - time.strftime("%d %B %Y", - time.localtime(time.time())), - app.NAME)) - dest.write('.SH NAME\n') - dest.write('%s \- %s\n' % (COMMAND, - string.replace(app.NAME,'-','\-'))) + dest.write('.TH %s 1 "%s" "%s"\n' % ( + string.upper(COMMAND), + time.strftime("%d %B %Y", + time.localtime(time.time())), + app.NAME)) + dest.write('.SH NAME\n') + dest.write('%s \- %s\n' % (COMMAND, + string.replace(app.NAME,'-','\-'))) - # - # SYNOPSIS Section - # - dest.write('.SH SYNOPSIS\n') - # dest.write('.ll +8\n') - dest.write('.B %s\n' % COMMAND) - for p in string.split(app.USAGE): - part = p - if part[0] == '[' and part[-1] == ']': - pre = '[\n.I ' - post = '\n]' - part = part[1:-1] - else: - pre = '.I ' - post = '' + # + # SYNOPSIS Section + # + dest.write('.SH SYNOPSIS\n') + # dest.write('.ll +8\n') + dest.write('.B %s\n' % COMMAND) + for p in string.split(app.USAGE): + part = p + if part[0] == '[' and part[-1] == ']': + pre = '[\n.I ' + post = '\n]' + part = part[1:-1] + else: + pre = '.I ' + post = '' - if part == '...': - part = '\&...' + if part == '...': + part = '\&...' - if string.find(part,'=') > 0: - first, last = string.split(part,'=',2) - part = string.replace(part, - '=','\n=\n.I ',1) + if string.find(part,'=') > 0: + first, last = string.split(part,'=',2) + part = string.replace(part, + '=','\n=\n.I ',1) - dest.write('%s%s%s\n' % (pre, part, post)) + dest.write('%s%s%s\n' % (pre, part, post)) - # - # DESCRIPTION Section - # - dest.write('.SH DESCRIPTION\n') - dest.write(lineWrap(string.replace(app.SUMMARY,'-','\-'),70) + '\n') + # + # DESCRIPTION Section + # + dest.write('.SH DESCRIPTION\n') + dest.write(lineWrap(string.replace(app.SUMMARY,'-','\-'),70) + '\n') - # - # OPTIONS Section - # - dest.write('.SH OPTIONS\n') + # + # OPTIONS Section + # + dest.write('.SH OPTIONS\n') - allOptions = {} - devOptions = {} - descriptors = {} - for optionset in [app._base_options, app.COMMAND_OPTIONS]: - for option in optionset: - if option.category == 'dev': - devOptions[string.upper(option.longOption)] = option - else: - allOptions[string.upper(option.longOption)] = option + allOptions = {} + devOptions = {} + descriptors = {} + for optionset in [app._base_options, app.COMMAND_OPTIONS]: + for option in optionset: + if option.category == 'dev': + devOptions[string.upper(option.longOption)] = option + else: + allOptions[string.upper(option.longOption)] = option - if option.acceptsArgument: - descr = '.B \-\-%s <%s>' % (option.longOption, option.argumentName or u_("value")) - else: - descr = '.B \-\-%s' % (option.longOption) - if option.shortOption: - descr += ', \-%s' % option.shortOption + if option.acceptsArgument: + descr = '.B \-\-%s <%s>' % (option.longOption, option.argumentName or u_("value")) + else: + descr = '.B \-\-%s' % (option.longOption) + if option.shortOption: + descr += ', \-%s' % option.shortOption - descriptors[string.upper(option.longOption)] = descr + descriptors[string.upper(option.longOption)] = descr - for optionSet, descr in ( - (allOptions,'GENERAL OPTIONS'), - (devOptions,'DEVELOPER OPTIONS') ): + for optionSet, descr in ( + (allOptions,'GENERAL OPTIONS'), + (devOptions,'DEVELOPER OPTIONS') ): - sorted = optionSet.keys() - sorted.sort() + sorted = optionSet.keys() + sorted.sort() - dest.write(".TP\n.B %s\n.TP\n" %descr) + dest.write(".TP\n.B %s\n.TP\n" %descr) - for optionKey in sorted: - dest.write(".TP\n%s\n" % (descriptors[optionKey])) - dest.write(string.replace(string.replace( - lineWrap( - string.replace(optionSet[optionKey].help,'-','\-'),70), - "\n.", "\n\\."), "\n'", "\n\\'")) + for optionKey in sorted: + dest.write(".TP\n%s\n" % (descriptors[optionKey])) + dest.write(string.replace(string.replace( + lineWrap( + string.replace(optionSet[optionKey].help,'-','\-'),70), + "\n.", "\n\\."), "\n'", "\n\\'")) - # - # AUTHOR, BUGS, and COPYRIGHT sections - # - dest.write("""\ -.SH AUTHOR -%(AUTHOR)s <%(EMAIL)s> -.SH BUGS -%(BUGS)s -Include a complete, self-contained example -that will allow the bug to be reproduced, -and say which version of this tool you are using. -.SH COPYRIGHT -Copyright \(co 2000-%(YEAR)s Free Software Foundation, Inc. -.LP -%(COMMAND)s is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. -.LP -%(COMMAND)s is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. -.LP -You should have received a copy of the GNU General Public License along -with %(COMMAND)s; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -""" % {'COMMAND': COMMAND, - 'YEAR': year, - 'BUGS': app.REPORT_BUGS_TO, - 'AUTHOR': app.AUTHOR, - 'EMAIL': app.EMAIL}) - + # + # AUTHOR, BUGS, and COPYRIGHT sections + # + dest.write("""\ + .SH AUTHOR + %(AUTHOR)s <%(EMAIL)s> + .SH BUGS + %(BUGS)s + Include a complete, self-contained example + that will allow the bug to be reproduced, + and say which version of this tool you are using. + .SH COPYRIGHT + Copyright \(co 2000-%(YEAR)s Free Software Foundation, Inc. + .LP + %(COMMAND)s is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2, or (at your option) any later + version. + .LP + %(COMMAND)s is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + .LP + You should have received a copy of the GNU General Public License along + with %(COMMAND)s; see the file COPYING. If not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + """ % {'COMMAND': COMMAND, + 'YEAR': year, + 'BUGS': app.REPORT_BUGS_TO, + 'AUTHOR': app.AUTHOR, + 'EMAIL': app.EMAIL}) _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue