''' 2021-05-22 To Dead Code NOTE: Leading en_ on all these file names added at Time of Archiving webpage_diary working title webpage_diary_refactored holding title en_webpage_diary data dump title Consolidating Style & CSS for These Webpage Scripts was a major reason for the refactor # # # Created on Apr 24, 2019 @author: Brett Paufler Copyright Brett Paufler From Email to Diary Webpage For Editing Input: iPhone notes email (no pictures) Output: HTML Page Requiring Minimal Editing Looking Good ''' 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 TODAY = str(date.today()) YEAR = str(date.today().year) PAGE_TITLE_TEMPLATE = None #title COMMENT_TEMPLATE = '
%s
\n
\n
\n' #comment BOOK_TITLE_TEMPLATE = '\n
\n
\n%s
\n' #head_0 BOOK_TAG_TEMPLATE = '%s
\n' #head_1 AUTHOR_TEMPLATE = '%s
\n' #head_2 HEAD_TEMPLATE = r''' %s

The Diary Project

%s

250px header

500px intro

''' #print HEAD_TEMPLATE FOOTER_TEMPLATE = r''' Empty List
Empty Img

Next Diary Project

Diary Project 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:] print name, name print labelled #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 print name 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/%s_00_%s - %s - 1 - img spell - edit 1 2 3.html' % ( YEAR, name_out, TODAY) print save_name with open(save_name, 'w') as f: f.write(html_page)