@ -174,7 +174,6 @@ def list_snippets(articles, loc):
a . append ( find_social_title ( text ) )
a . append ( find_tags ( text ) )
result . append ( a )
print ( result )
return result
# List latest 5 articles as headline links
@ -321,15 +320,21 @@ def list_rec(page, loc):
def prepare_diary_entry ( page , loc ) :
result = [ ]
with open ( loc + page ) as f :
text = [ ]
text = article2list ( page , loc )
result . append ( find_title ( text ) )
result . append ( retrieve_diary_entry_content ( page , loc ) )
result . append ( find_timestamp ( page ) )
result . append ( find_url ( loc + page ) )
result . append ( find_social_title ( text ) )
result . append ( find_tags ( text ) )
try :
with open ( loc + page ) as f :
text = [ ]
text = article2list ( page , loc )
result . append ( find_title ( text ) )
result . append ( retrieve_diary_entry_content ( page , loc ) )
result . append ( find_timestamp ( page ) )
result . append ( find_url ( loc + page ) )
result . append ( find_social_title ( text ) )
result . append ( find_tags ( text ) )
except FileNotFoundError as e :
print ( " HEY - Error: " + str ( e ) )
print ( " HEY - loc: " + loc )
print ( " HEY - page: " + page )
print ( " PASS - " + loc + page )
return result
# Return article as list of lines of text
@ -501,9 +506,7 @@ def games():
@route ( ' /japanese ' )
def japanese ( ) :
""" japanese """
#info = {'css': 'cornucopia', 'title': 'studying Japanese', 'year': find_year()}
redirect ( ' /https://blessfrey.me/diary/entries/240220 ' )
#return template('cornucopia.tpl', info)
redirect ( ' diary/entries/240220 ' )
# Diary Page
@route ( ' / ' )
@ -520,7 +523,7 @@ def diary(page):
""" diary """
loc = ' diary/entries/ '
assert isinstance ( page , int )
info = { ' css ' : ' diary ' , ' title ' : ' chimchooree \' s diary ' , ' year ' : find_year ( ) , ' snippets ' : list_snippets ( gather_and_sort ( loc ) , loc ) , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' total ' : len ( curate_files ( gather_files ( loc ) ) ) , ' limit ' : 8 , ' cluster ' : 3 , ' page ' : page }
info = { ' css ' : ' diary ' , ' title ' : ' chimchooree \' s diary ' , ' year ' : find_year ( ) , ' snippets ' : list_snippets ( gather_and_sort ( loc ) , loc ) , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' total ' : len ( curate_files ( gather_files ( loc ) ) ) , ' limit ' : 8 , ' cluster ' : 3 , ' page ' : page , ' category ' : " diary " }
return template ( ' diary.tpl ' , info )
# Entry Page - Feature Template - for articles
@ -532,7 +535,7 @@ def entry(page_t):
page = str ( page_t )
loc = ' diary/entries/ '
entry = prepare_diary_entry ( page , loc )
info = { ' css ' : ' entry ' , ' title ' : entry [ 0 ] + ' (blessfrey developer diary) ' , ' year ' : find_year ( ) , ' entry ' : entry , ' recommends ' : list_rec ( page , loc ) , ' articles ' : " Articles " , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' page ' : page }
info = { ' css ' : ' entry ' , ' title ' : entry [ 0 ] + ' (blessfrey developer diary) ' , ' year ' : find_year ( ) , ' entry ' : entry , ' recommends ' : list_rec ( page , loc ) , ' articles ' : " Articles " , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' page ' : page , ' category ' : " diary " }
abs_app_dir_path = os . path . dirname ( os . path . realpath ( __file__ ) )
abs_views_path = os . path . join ( abs_app_dir_path , ' views ' )
TEMPLATE_PATH . insert ( 0 , abs_views_path )
@ -606,26 +609,6 @@ def style():
info = { ' css ' : ' doc ' , ' title ' : ' blessfrey style guide ' , ' year ' : find_year ( ) }
return template ( ' style-guide.tpl ' , info )
# Location Page
@route ( ' /location/ ' ) # if no location given
def loc3 ( ) :
return setting ( )
@route ( ' /loc/ ' ) # if no location given
def loc2 ( ) :
return setting ( )
@route ( ' /loc/<page:path> ' )
def loc ( page ) :
""" location page """
loc = ' loc/ '
info = { ' css ' : ' doc ' , ' title ' : ' blessfrey GDD - setting - ' + page , ' year ' : find_year ( ) , ' topic ' : page . lower ( ) , ' writeup ' : prepare_gdd_page ( page , loc ) }
return template ( ' page-setting.tpl ' , info )
# loc = 'location/'
# info = {'css': 'char', 'title': 'blessfrey - location | about ' + location_name, 'year': find_year(), 'name': location_name, 'profile': prepare_profile(loc, location_name), 'gallery': find_gallery(location_name)}
# abs_app_dir_path = os.path.dirname(os.path.realpath(__file__))
# abs_views_path = os.path.join(abs_app_dir_path, 'views')
# TEMPLATE_PATH.insert(0, abs_views_path )
# return template(os.path.join(abs_views_path,'char.tpl'), info)
# Me Page
@route ( ' /about-me ' )
def me ( ) :
@ -709,16 +692,30 @@ def setting():
@route ( ' /story ' )
def story2 ( ) :
return story ( " home " )
@route ( ' /story/<story :path >' )
@route ( ' /story/<story >' )
def story ( story ) :
""" story """
loc = ' story/ '
entry = prepare_diary_entry ( story , loc )
info = { ' css ' : ' entry ' , ' title ' : entry [ 0 ] , ' year ' : find_year ( ) , ' entry ' : entry , ' recommends ' : list_rec ( story , loc ) , ' articles ' : " Articles " , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' page ' : story }
print ( " HEY ... " )
print ( entry )
info = { ' css ' : ' entry ' , ' title ' : entry [ 0 ] , ' year ' : find_year ( ) , ' entry ' : entry , ' recommends ' : list_rec ( story , loc ) , ' articles ' : " Articles " , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' page ' : story , ' category ' : " story " }
abs_app_dir_path = os . path . dirname ( os . path . realpath ( __file__ ) )
abs_views_path = os . path . join ( abs_app_dir_path , ' views ' )
TEMPLATE_PATH . insert ( 0 , abs_views_path )
return template ( os . path . join ( abs_views_path , ' entry.tpl ' ) , info )
# Search Story by Tag
@route ( ' /story/tag/<tagin> ' ) # Start on first Story tag page if no page given
def story_tag2 ( tagin ) :
return story_tag ( tagin , 0 , ' story/ ' )
@route ( ' /story/tag/<tagin>/<page> ' ) # Tag Page - Story Tag Template - list all articles for tag
def story_tag ( tagin , page , loc ) :
""" tag page """
print ( " PASS - TAG - " + tagin )
assert isinstance ( tagin , str )
assert isinstance ( page , int )
info = { ' css ' : ' diary ' , ' title ' : ' blessfrey developer diary ' , ' year ' : find_year ( ) , ' snippets ' : list_snippets ( pull_tag ( gather_and_sort ( loc ) , tagin , loc ) , loc ) , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' total ' : len ( curate_files ( gather_files ( loc ) ) ) , ' limit ' : 8 , ' cluster ' : 3 , ' page ' : page , ' category ' : " story " }
return template ( ' diary.tpl ' , info )
# Blessfrey Wiki Page
@route ( ' /study ' )
@ -728,14 +725,15 @@ def study():
# Search Diary by Tag
@route ( ' /diary/tag/<tagin> ' ) # Start on first Diary tag page if no page given
def tag2( tagin ) :
return tag( tagin , 0 , ' diary/entries/ ' )
def diary_ tag2( tagin ) :
return diary_ tag( tagin , 0 , ' diary/entries/ ' )
@route ( ' /diary/tag/<tagin>/<page:int> ' ) # Tag Page - Diary Tag Template - list all articles for tag
def tag( tagin , page , loc ) :
def diary_ tag( tagin , page , loc ) :
""" tag page """
print ( " PASS - TAG - " + tagin )
assert isinstance ( tagin , str )
assert isinstance ( page , int )
info = { ' css ' : ' diary ' , ' title ' : ' blessfrey developer diary ' , ' year ' : find_year ( ) , ' snippets ' : list_snippets ( pull_tag ( gather_and_sort ( loc ) , tagin , loc ) , loc ) , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' total ' : len ( curate_files ( gather_files ( loc ) ) ) , ' limit ' : 8 , ' cluster ' : 3 , ' page ' : page }
info = { ' css ' : ' diary ' , ' title ' : ' blessfrey developer diary ' , ' year ' : find_year ( ) , ' snippets ' : list_snippets ( pull_tag ( gather_and_sort ( loc ) , tagin , loc ) , loc ) , ' latest ' : list_headlines ( gather_and_sort ( loc ) [ 0 : 5 ] , loc ) , ' tags ' : fill_word_cloud ( curate_files ( gather_files ( loc ) ) , loc ) , ' total ' : len ( curate_files ( gather_files ( loc ) ) ) , ' limit ' : 8 , ' cluster ' : 3 , ' page ' : page , ' category ' : " diary " }
return template ( ' diary.tpl ' , info )
## Main ##