]> git.phdru.name Git - phdru.name/phdru.name.git/commitdiff
Restructured the code in the loop.
authorOleg Broytman <phd@phdru.name>
Thu, 11 Feb 2010 17:11:07 +0000 (17:11 +0000)
committerOleg Broytman <phd@phdru.name>
Thu, 11 Feb 2010 17:11:07 +0000 (17:11 +0000)
git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@97 7bb0bf08-9e0d-0410-b083-99cee3bf18b8

dotfiles2html/dotfiles2html.py

index 5d0d04d2540a9ca077a5c7424adb352d7dd13461..9df4392d2f5e74dc8f8e7753711c57dbca6c7c87 100755 (executable)
@@ -71,22 +71,23 @@ for i, (fname, ftype) in enumerate(file_types):
       file = open('vimrc', 'w')
       file.write(text.replace('\e', '<Esc>'))
       file.close()
-   if os.path.exists(fname):
-      os.system("""exec gvim -f -c "set filetype=%s" -c ":source %s/dotfile2html.vim" "%s"
-         """ % (ftype, home_dir, fname))
-      if i == 0:
-         prev = None
-      else:
-         prev = file_types[i-1][0]
-      if i >= ft_len - 1:
-         next = None
-      else:
-         next = file_types[i+1][0]
-      add_headers(fname, prev, next)
-      if os.path.exists(fname + ".tmpl") and filecmp.cmp(fname + ".html", fname + ".tmpl"):
-         os.remove(fname + ".html")
-      else:
-         os.rename(fname + ".html", fname + ".tmpl")
+   if not os.path.exists(fname):
+      continue
+   os.system("""exec gvim -f -c "set filetype=%s" -c ":source %s/dotfile2html.vim" "%s"
+      """ % (ftype, home_dir, fname))
+   if i == 0:
+      prev = None
+   else:
+      prev = file_types[i-1][0]
+   if i >= ft_len - 1:
+      next = None
+   else:
+      next = file_types[i+1][0]
+   add_headers(fname, prev, next)
+   if os.path.exists(fname + ".tmpl") and filecmp.cmp(fname + ".html", fname + ".tmpl"):
+      os.remove(fname + ".html")
+   else:
+      os.rename(fname + ".html", fname + ".tmpl")
    if fname == 'vimrc' and os.path.exists('.' + fname):
       shutil.copy2('.' + fname, fname)
    if fname.endswith('.py'):