diff python/html2flux.py @ 296:ee3c1b65d6d1

random fixes
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 11 May 2013 06:50:40 -0700
parents a0d830fd8a42
children a43d0205f80b
line wrap: on
line diff
--- a/python/html2flux.py	Sat May 11 04:16:56 2013 -0700
+++ b/python/html2flux.py	Sat May 11 06:50:40 2013 -0700
@@ -25,6 +25,8 @@
 executables = set([i.rsplit('/', 1)[-1] for i in lsex() ])
 
 def readmenu(dl, output, top=True):
+    """read menu from an <dl> tag"""
+    # TODO: probably don't really need lxml
 
     menu_items = []
     name = None # menu name
@@ -57,8 +59,13 @@
     """
     - output: file-like object for writing
     """
+
+    # print [submenu] tag for this menu
     name = name or ''
-    print >> output, '[submenu] (%s)' % name
+    if not top:
+        print >> output, '[submenu] (%s)' % name
+
+    # print menu items
     for name, item in menu:
         if isinstance(item, basestring):
             # command
@@ -66,6 +73,8 @@
         else:
             # submenu
             printflux(name, item, output, top=False)
+
+    # print end of this submenu
     if not top:
         print >> output, '[end]'