diff options
| -rwxr-xr-x | admin/bin/mm2do | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/admin/bin/mm2do b/admin/bin/mm2do index f8145f09c..661a25f4b 100755 --- a/admin/bin/mm2do +++ b/admin/bin/mm2do @@ -6,17 +6,17 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program 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. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -"""Generate the todo.html file from the plain-text TODO file.""" +"""Generate the todo.ht file from the plain-text TODO file.""" import sys @@ -32,22 +32,23 @@ def dumpsection(header, items, hasitems): if header: # output the previous section print >> outfp, '<h3>', header, '</h3>' - if hasitems: - print >> outfp, '<ul>' - for item in items: + if hasitems: + print >> outfp, '<ul>' + for item in items: + if item: print >> outfp, ' <li>', SPACE.join(item) - print >> outfp, '</ul>' - else: - for item in items: - print >> outfp, SPACE.join(item), '<p>' - items = [['']] + print >> outfp, '</ul>' + else: + for item in items: + print >> outfp, SPACE.join(item), '<p>' + header = '' items = [['']] -hasitems = 0 -inpreamble = 1 -while 1: +hasitems = False +inpreamble = True +while True: line = infp.readline() if not line or line[0] == '\f': break @@ -56,16 +57,17 @@ while 1: if line.strip(): continue else: - inpreamble = 0 + inpreamble = False if not line[0].isspace(): dumpsection(header, items, hasitems) header = line + items = [[]] continue # find out what the first non-ws character on the line is line = line.lstrip() if line and line[0] == '-': items.append([line[2:-1]]) - hasitems += 1 + hasitems = True else: if not line: continue |
