diff --git a/ttbp/core.py b/ttbp/core.py index 3c358c0..7084fdd 100644 --- a/ttbp/core.py +++ b/ttbp/core.py @@ -235,57 +235,60 @@ def write_global_feed(blogList): prints to blog feed ''' - outfile = open(FEED, "w") + try: + outfile = open(FEED, "w") - ## header - outfile.write("""\ - - - - tilde.town feels engine - - - -
-

tilde.town feels engine

+ ## header + outfile.write("""\ + + + + tilde.town feels engine + + + +
+

tilde.town feels engine

-

github - repo | state - of the ttbp

-
-

 

-""") +

github + repo | state + of the ttbp

+
+

 

+ """) - ## docs - outfile.write("""\ -
""") - outfile.write(mistune.markdown(open(os.path.join(config.INSTALL_PATH, "..", "README.md"), "r").read())) - outfile.write("""\ -
""") + ## docs + outfile.write("""\ +
""") + outfile.write(mistune.markdown(open(os.path.join(config.INSTALL_PATH, "..", "README.md"), "r").read())) + outfile.write("""\ +
""") - ## feed - outfile.write("""\ -

 

-
-

live feels-sharing:

- -
- - -""") - - outfile.close() - #subprocess.call(['chmod', 'a+w', FEED]) + outfile.close() + #subprocess.call(['chmod', 'a+w', FEED]) + except FileNotFoundError: + pass ## misc helpers @@ -309,7 +312,7 @@ def meta(entries = FILES): for filename in entries: mtime = os.path.getmtime(filename) try: - wc = subprocess.check_output(["wc","-w",filename], stderr=subprocess.STDOUT).split()[0] + wc = int(subprocess.check_output(["wc","-w",filename], stderr=subprocess.STDOUT).split()[0]) except subprocess.CalledProcessError: wc = "???" timestamp = time.strftime("%Y-%m-%d at %H:%M", time.localtime(mtime)) diff --git a/ttbp/ttbp.py b/ttbp/ttbp.py index 896bc99..94f9a45 100644 --- a/ttbp/ttbp.py +++ b/ttbp/ttbp.py @@ -108,7 +108,7 @@ def menu_handler(options, prompt, pagify=10, rainbow=False, top=""): return util.list_select(options, prompt) else: - return page_helper(options, prompt, pagify, rainbow, page, total, top) + return page_helper(options, prompt, pagify, rainbow, page, int(total), top) def page_helper(options, prompt, pagify, rainbow, page, total, top): ''' @@ -126,7 +126,7 @@ def page_helper(options, prompt, pagify, rainbow, page, total, top): optPage = options[x:y] util.print_menu(optPage, SETTINGS.get("rainbows", False)) - print("\n\t( page {page} of {total}; type 'u' or 'd' to scroll up and down )").format(page=page+1, total=total+1) + print("\n\t( page {page} of {total}; type 'u' or 'd' to scroll up and down)".format(page=page+1, total=total+1)) ans = util.list_select(optPage, prompt) @@ -794,17 +794,21 @@ editor. left = "" - if core.publishing(): - core.load_files() - core.write("index.html") - left = "posted to {url}/index.html\n\n>".format( - url="/".join( - [config.LIVE+config.USER, - str(SETTINGS.get("publish dir"))])) + if SETTINGS.get("nopub"): + core.toggle_nopub(os.path.basename(entry)) + else: + if core.publishing(): + core.write("index.html") + left = "posted to {url}/index.html\n\n>".format( + url="/".join( + [config.LIVE+config.USER, + str(SETTINGS.get("publish dir"))])) - if SETTINGS.get('gopher'): - gopher.publish_gopher('feels', core.get_files()) - left += " also posted to your ~/public_gopher!\n" + if SETTINGS.get('gopher'): + gopher.publish_gopher('feels', core.get_files()) + left += " also posted to your ~/public_gopher!\n" + + core.load_files() redraw(left + " thanks for sharing your feels!") return