''' 2021-05-22 To Dead Code Created on May 23, 2019 @author: Brett Paufler (c) Copyright Brett Paufler For use for stand alone Books Input: iPhone notes email (no pictures) Output: HTML Page Requiring Minimal Editing ''' from utilities_email_refactored import text_iterator_eml from utilities_txt_files_refactored import text_iterator_txt from utilities_text_refactored import label_text from utilities_text_refactored import three_head_label_to_html from utilities_text_refactored import escape_sequences from itertools import chain from datetime import date YEAR = '2020' PAGE_TITLE_TEMPLATE = None #title COMMENT_TEMPLATE = '\n\n
\n
%s
\n
\n
\n' #comment BOOK_TITLE_TEMPLATE = '\n
\n%s
\n' #head_0 BOOK_TAG_TEMPLATE = '%s
\n' #head_1 AUTHOR_TEMPLATE = '%s
\n' #head_2 HEAD_TEMPLATE = ''' %s

Brett's Books

%s

header

Title
by Author
year

Thoughts Going In

Notable Quotes

Running Thoughts

''' FOOTER_TEMPLATE = '''

Final Debriefing


next Brett's Books entry

Home Brett's Books Index

sign-off

© copyright %s Brett Paufler
Brett@Paufler.net
''' text_iterators = chain( text_iterator_eml(), text_iterator_txt()) for text_in in text_iterators: #Slice Off the Page Name labelled = label_text(text_in) name = labelled[0][1] labelled = labelled[1:] #Call Label Parser html_body = three_head_label_to_html( labeled_list=labelled, page_title_template=PAGE_TITLE_TEMPLATE, comment_template=COMMENT_TEMPLATE, book_title_template=BOOK_TITLE_TEMPLATE, book_tag_template=BOOK_TAG_TEMPLATE, author_template=AUTHOR_TEMPLATE) #Assemble the HTML PAGE html_head = HEAD_TEMPLATE % (name, name) html_footer = FOOTER_TEMPLATE % (YEAR) html_page = html_head + html_body + html_footer #A Bit of Correction html_page = escape_sequences(html_page) print html_page #Create save_name date_out = str(date.today()) #.replace('-', '_') name_out = name.replace(' ', '_').lower() save_name = './output/000_%s - %s - 1 - img spell - edit 1 2 3.html' % ( name_out, date_out) with open(save_name, 'w') as f: f.write(html_page) print name #print date.isoformat() print date.today()