''' 2021-05-22 To Dead Code Created on Feb 2, 2020 @author: Brett Paufler (c) Copyright Brett Paufler Formats an IDEAS text file into HTML Code needs to be cut pasted into a blank rant file Title Sequence: Main Text
Title Sequence Main Text
Reversable: REVERSE_LIST = TRUE ''' from os import listdir from os.path import join as path_join from datetime import date #Makes First Last and Last First REVERSE_LIST = True #Get the One Lone File in input directory DIR_IN = '.\input' file_path = path_join( DIR_IN, listdir(DIR_IN)[0]) #print file_path #Get the contents of the Ideas File as plain text with open(file_path, 'r') as f: raw_text = f.read() #print raw_text #Breaks the page into separate ideas ideas_list = [i for i in raw_text.split('\n') if i != ''] if REVERSE_LIST: ideas_list.reverse() #Loop Through and Process text_out = '' for idea in ideas_list: #Title & Text title_text = idea.split(':') if len(title_text) == 0: print 'Empty Entry - Should Not Happen' print title_text assert True == False if len(title_text) == 1: title = '' text = title_text[0] elif len(title_text) == 2: title, text = title_text else: title = '' text = ' '.join(title_text) title = title.strip() text = text.strip() text_out += "\n"
text_out += "%s
\n" % title
text_out += "%s
\n