tags weren't working for stories, but I think I fixed it

master
chimchooree 9 months ago
parent 11e546626f
commit c50c620c27

@ -1,6 +1,6 @@
<!---->
<h1>Godot 3 Tutorial - Chat Room Using WebSocket </h1>
#godot #webdev <br>
#godot #programming #webdev <br>
<br>
<p>Follow along to make your first mini WebSocket application in GDScript (with a little JSON). The client and the server will be two separate projects. I build upon the <a href="http://web.archive.org/web/20220928131714/http://www.narwalengineering.com/2018/07/01/godot-tutorial-simple-chat-room-using-multiplayer-api/">NetworkedMultiplayerENet chat room tutorial</a>(archive link) by <a href="https://www.deeproot.dev/">Miziziziz</a> and the <a href="https://docs.godotengine.org/en/stable/tutorials/networking/websocket.html">HTML5 and WebSocket tutorial in the Godot documentation</a>. </p>

@ -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 ##

@ -3,7 +3,7 @@
<div class="sidebar">
<div class="diary-box about-box">
<h2>about</h2>
<p><a href="/"><b>Blessfrey.me</b></a> is my blog and portfolio for programming, art, and Scripture. I want to learn and play!</p>
<p><a href="/"><b>Blessfrey.me</b></a> is my webdev playground!</p>
</div>
<div class="diary-box social-box">
@ -31,13 +31,13 @@
<h2>cloud</h2>
% for t in tags:
% tagless = t.replace('#','')
<a href=/diary/tag/{{tagless}}>{{t}}</a>
<a href=/{{category}}/tag/{{tagless}}>{{t}}</a>
% end
</div>
<div class="diary-box disclosure">
<h2>disclosure</h2>
<p>Blessfrey.me is not using sponsored posts or affiliate links.</p>
<p>Blessfrey.me has no sponsored posts or affiliate links.</p>
<p>Blessfrey.me is not collecting personal information + has no cookies. </p>
<p>Thank you for visiting. </p>
<!-- __<br>

@ -16,18 +16,18 @@
%>
<div class="diary-dir-left">
% # << is always active link pointing to 0
<a href=/diary/0>
<a href=/{{category}}/0>
&lt;&lt;
</a>
% # < points to 0 if page 0 or below
% if page <= 0:
<a href=/diary/0>
<a href=/{{category}}/0>
&lt;
</a>
% # < points to previous page otherwise
% else:
<a href=/diary/{{page - 1}}>
<a href=/{{category}}/{{page - 1}}>
&lt;&lt;
</a>
% end
@ -38,7 +38,7 @@
% if max_pages > cluster and page > max_pages - cluster:
% for j in range(cluster - max_pages + page):
<div class="diary-dir-number">
<a href=/diary/{{max_pages - cluster * 2 + j}} rel="nofollow">{{max_pages - cluster * 2 + j}}</a>
<a href=/{{category}}/{{max_pages - cluster * 2 + j}} rel="nofollow">{{max_pages - cluster * 2 + j}}</a>
</div>
% end
% end
@ -53,7 +53,7 @@
% # form neighboring numbers into links
% else:
<div class="diary-dir-number">
<a href=/diary/{{i}} rel="nofollow">{{i}}</a>
<a href=/{{category}}/{{i}} rel="nofollow">{{i}}</a>
</div>
% end
% end
@ -62,7 +62,7 @@
% if page <= cluster - 1 and max_pages > page + cluster:
% for j in range(cluster - page):
<div class="diary-dir-number">
<a href=/diary/{{page + j + cluster + 1}} rel="nofollow">{{page + j + cluster + 1}}</a>
<a href=/{{category}}/{{page + j + cluster + 1}} rel="nofollow">{{page + j + cluster + 1}}</a>
</div>
% end
% end
@ -71,18 +71,18 @@
<div class="diary-dir-right">
% # > points to max if page is at or above maximum
% if page >= max_pages:
<a href=/diary/{{max_pages}}>
<a href=/{{category}}/{{max_pages}}>
&gt;
</a>
% # > point to next page otherwise
% else:
<a href=/diary/{{page + 1}}>
<a href=/{{category}}/{{page + 1}}>
&gt;
</a>
% end
% # >> is always active link to maximum page
<a href=/diary/{{max_pages}}>
<a href=/{{category}}/{{max_pages}}>
&gt;&gt;
</a>
</div>
@ -91,7 +91,7 @@
<!-- DIARY PAGES -->
<div class="diary-pages">
<span class=title><h1>diary</h1></span>
<span class=title><h1>{{category}}</h1></span>
% for s in snippets[page * limit:page * limit + limit]:
<div class="snippet">
<div class="snippet-title">
@ -109,7 +109,7 @@
% for j in s[5]:
<div class="snippet-tag">
% tagless = j.replace('#','')
<a href=/diary/tag/{{tagless}}>{{j}}</a>
<a href=/{{category}}/tag/{{tagless}}>{{j}}</a>
</div>
% end
</div>
@ -145,18 +145,18 @@
%>
<div class="diary-dir-left">
% # << is always active link pointing to 0
<a href=/diary/0>
<a href=/{{category}}/0>
&lt;&lt;
</a>
% # < points to 0 if page 0 or below
% if page <= 0:
<a href=/diary/0>
<a href=/{{category}}/0>
&lt;
</a>
% # < points to previous page otherwise
% else:
<a href=/diary/{{page - 1}}>
<a href=/{{category}}/{{page - 1}}>
&lt;
</a>
% end
@ -167,7 +167,7 @@
% if max_pages > cluster and page > max_pages - cluster:
% for j in range(cluster - max_pages + page):
<div class="diary-dir-number">
<a href=/diary/{{max_pages - cluster * 2 + j}} rel="nofollow">{{max_pages - cluster * 2 + j}}</a>
<a href=/{{category}}/{{max_pages - cluster * 2 + j}} rel="nofollow">{{max_pages - cluster * 2 + j}}</a>
</div>
% end
% end
@ -182,7 +182,7 @@
% # form neighboring numbers into links
% else:
<div class="diary-dir-number">
<a href=/diary/{{i}} rel="nofollow">{{i}}</a>
<a href=/{{category}}/{{i}} rel="nofollow">{{i}}</a>
</div>
% end
% end
@ -191,7 +191,7 @@
% if page <= cluster - 1 and max_pages > page + cluster:
% for j in range(cluster - page):
<div class="diary-dir-number">
<a href=/diary/{{page + j + cluster + 1}} rel="nofollow">{{page + j + cluster + 1}}</a>
<a href=/{{category}}/{{page + j + cluster + 1}} rel="nofollow">{{page + j + cluster + 1}}</a>
</div>
% end
% end
@ -201,17 +201,17 @@
<div class="diary-dir-right">
% # > points to max if page is at or above maximum
% if page >= max_pages:
<a href=/diary/{{max_pages}}>
<a href=/{{category}}/{{max_pages}}>
&gt;
</a>
% # > point to next page otherwise
% else:
<a href=/diary/{{page + 1}}>
<a href=/{{category}}/{{page + 1}}>
&gt;
</a>
% end
% # >> is always active link to maximum page
<a href=/diary/{{max_pages}}>
<a href=/{{category}}/{{max_pages}}>
&gt;&gt;
</a>
</div>

@ -19,17 +19,17 @@
% for t in entry[5]:
<div class="diary-tag">
% tagless = t.replace('#', '')
<a href=/diary/tag/{{tagless}}>{{t}}</a>
<a href=/{{category}}/tag/{{tagless}}>{{t}}</a>
</div>
% end
</div>
% end
</div>
<!--<hr>-->
<div class="share-links">
<div class="share-links">
</div>
<br>
</div>
% include diary-boxes.tpl

@ -7,13 +7,27 @@
<div class="intro">
<h2>hello,</h2>
<p>call me chimchooree.</p>
<p>I live in the USA and dabble in lots of things - webdev, gamedev, programming, sewing, pattern-making, drawing, and creative writing, to name a few. Some of my projects are shared on here. Others may be lurking on <a href="https://chimchooree.itch.io/">itch.io (chimchooree)</a> and <a href="https://gitlab.com/chimchooree">GitLab (chimchooree)</a>, though most never see the light of day. </p>
<p>I live in the USA and love to learn! Sometimes I post my writing, art, and code here like a portfolio. Other projects may be lurking on <a href="https://chimchooree.itch.io/">itch.io (chimchooree)</a> and <a href="https://gitlab.com/chimchooree">GitLab (chimchooree)</a>, though most are locked away forever. </p>
<p>Blessfrey.me is a project in itself, a blog coded from scratch in <a href="https://bottlepy.org/docs/dev/">Bottle: Python</a>, <a href="https://bottlepy.org/docs/dev/stpl.html">SimpleTemplate</a>, and HTML+CSS. Any embedded applications are probably HTML5 and developed in <a href="https://godotengine.org/">Godot Engine</a>. </p>
<p>Also, I am very sick. Please pray for me. </p>
<p>If you don't mind, pray for me. I am very sick. </p>
<h3>contact</h3>
<ul>
<li>{{random.choice(['.','•','☆','★'])}}&#9;Steam: <a href="https://steamcommunity.com/id/customso/">Customs Officer</a> </li>
<li>{{random.choice(['.','•','☆','★'])}}&#9;FlightRising: <a href="https://www1.flightrising.com/clan-profile/525948">Aristene</a> </li>
</ul>
<!--<form action="/contact" method="post">
<label for="name">Name:</label>
<input type="text" name="name" required><br>
<label for="email">Email:</label>
<input type="email" name="email" required><br>
<label for="message">Message:</label>
<textarea name="message" required></textarea><br>
<input type="submit" value="Submit">
</form>-->
</div>
</div>

@ -1,4 +0,0 @@
% rebase('frame.tpl')
{{!entry[1]}}
</div>
Loading…
Cancel
Save