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> <h1>Godot 3 Tutorial - Chat Room Using WebSocket </h1>
#godot #webdev <br> #godot #programming #webdev <br>
<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> <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_social_title(text))
a.append(find_tags(text)) a.append(find_tags(text))
result.append(a) result.append(a)
print(result)
return result return result
# List latest 5 articles as headline links # List latest 5 articles as headline links
@ -321,15 +320,21 @@ def list_rec(page, loc):
def prepare_diary_entry(page, loc): def prepare_diary_entry(page, loc):
result = [] result = []
with open(loc + page) as f: try:
text = [] with open(loc + page) as f:
text = article2list(page, loc) text = []
result.append(find_title(text)) text = article2list(page, loc)
result.append(retrieve_diary_entry_content(page, loc)) result.append(find_title(text))
result.append(find_timestamp(page)) result.append(retrieve_diary_entry_content(page, loc))
result.append(find_url(loc + page)) result.append(find_timestamp(page))
result.append(find_social_title(text)) result.append(find_url(loc + page))
result.append(find_tags(text)) 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 result
# Return article as list of lines of text # Return article as list of lines of text
@ -501,9 +506,7 @@ def games():
@route('/japanese') @route('/japanese')
def japanese(): def japanese():
"""japanese""" """japanese"""
#info = {'css': 'cornucopia', 'title': 'studying Japanese', 'year': find_year()} redirect('diary/entries/240220')
redirect('/https://blessfrey.me/diary/entries/240220')
#return template('cornucopia.tpl', info)
# Diary Page # Diary Page
@route('/') @route('/')
@ -520,7 +523,7 @@ def diary(page):
"""diary""" """diary"""
loc = 'diary/entries/' loc = 'diary/entries/'
assert isinstance(page, int) 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) return template('diary.tpl', info)
# Entry Page - Feature Template - for articles # Entry Page - Feature Template - for articles
@ -532,7 +535,7 @@ def entry(page_t):
page = str(page_t) page = str(page_t)
loc = 'diary/entries/' loc = 'diary/entries/'
entry = prepare_diary_entry(page, loc) 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_app_dir_path = os.path.dirname(os.path.realpath(__file__))
abs_views_path = os.path.join(abs_app_dir_path, 'views') abs_views_path = os.path.join(abs_app_dir_path, 'views')
TEMPLATE_PATH.insert(0, abs_views_path ) TEMPLATE_PATH.insert(0, abs_views_path )
@ -606,26 +609,6 @@ def style():
info = {'css': 'doc', 'title': 'blessfrey style guide', 'year': find_year()} info = {'css': 'doc', 'title': 'blessfrey style guide', 'year': find_year()}
return template('style-guide.tpl', info) 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 # Me Page
@route('/about-me') @route('/about-me')
def me(): def me():
@ -709,16 +692,30 @@ def setting():
@route('/story') @route('/story')
def story2(): def story2():
return story("home") return story("home")
@route('/story/<story:path>') @route('/story/<story>')
def story(story): def story(story):
"""story""" """story"""
loc = 'story/' loc = 'story/'
entry = prepare_diary_entry(story, loc) 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_app_dir_path = os.path.dirname(os.path.realpath(__file__))
abs_views_path = os.path.join(abs_app_dir_path, 'views') abs_views_path = os.path.join(abs_app_dir_path, 'views')
TEMPLATE_PATH.insert(0, abs_views_path ) TEMPLATE_PATH.insert(0, abs_views_path )
return template(os.path.join(abs_views_path,'entry.tpl'), info) 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 # Blessfrey Wiki Page
@route('/study') @route('/study')
@ -728,14 +725,15 @@ def study():
# Search Diary by Tag # Search Diary by Tag
@route('/diary/tag/<tagin>') # Start on first Diary tag page if no page given @route('/diary/tag/<tagin>') # Start on first Diary tag page if no page given
def tag2(tagin): def diary_tag2(tagin):
return tag(tagin, 0, 'diary/entries/') return diary_tag(tagin, 0, 'diary/entries/')
@route('/diary/tag/<tagin>/<page:int>') # Tag Page - Diary Tag Template - list all articles for tag @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""" """tag page"""
print("PASS - TAG - " + tagin)
assert isinstance(tagin, str) assert isinstance(tagin, str)
assert isinstance(page, int) 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) return template('diary.tpl', info)
## Main ## ## Main ##

@ -3,7 +3,7 @@
<div class="sidebar"> <div class="sidebar">
<div class="diary-box about-box"> <div class="diary-box about-box">
<h2>about</h2> <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>
<div class="diary-box social-box"> <div class="diary-box social-box">
@ -31,13 +31,13 @@
<h2>cloud</h2> <h2>cloud</h2>
% for t in tags: % for t in tags:
% tagless = t.replace('#','') % tagless = t.replace('#','')
<a href=/diary/tag/{{tagless}}>{{t}}</a> <a href=/{{category}}/tag/{{tagless}}>{{t}}</a>
% end % end
</div> </div>
<div class="diary-box disclosure"> <div class="diary-box disclosure">
<h2>disclosure</h2> <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>Blessfrey.me is not collecting personal information + has no cookies. </p>
<p>Thank you for visiting. </p> <p>Thank you for visiting. </p>
<!-- __<br> <!-- __<br>

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

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

@ -7,13 +7,27 @@
<div class="intro"> <div class="intro">
<h2>hello,</h2> <h2>hello,</h2>
<p>call me chimchooree.</p> <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>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> <h3>contact</h3>
<ul> <ul>
<li>{{random.choice(['.','•','☆','★'])}}&#9;Steam: <a href="https://steamcommunity.com/id/customso/">Customs Officer</a> </li> <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> <li>{{random.choice(['.','•','☆','★'])}}&#9;FlightRising: <a href="https://www1.flightrising.com/clan-profile/525948">Aristene</a> </li>
</ul> </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>
</div> </div>

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