diff --git a/src/diary/entries/raw/entries/200808.tpl b/src/entries/200808.tpl similarity index 100% rename from src/diary/entries/raw/entries/200808.tpl rename to src/entries/200808.tpl diff --git a/src/diary/entries/raw/entries/200810.tpl b/src/entries/200810.tpl similarity index 100% rename from src/diary/entries/raw/entries/200810.tpl rename to src/entries/200810.tpl diff --git a/src/diary/entries/raw/entries/200813.tpl b/src/entries/200813.tpl similarity index 100% rename from src/diary/entries/raw/entries/200813.tpl rename to src/entries/200813.tpl diff --git a/src/diary/entries/raw/entries/200815.tpl b/src/entries/200815.tpl similarity index 100% rename from src/diary/entries/raw/entries/200815.tpl rename to src/entries/200815.tpl diff --git a/src/diary/entries/raw/entries/200918.tpl b/src/entries/200918.tpl similarity index 100% rename from src/diary/entries/raw/entries/200918.tpl rename to src/entries/200918.tpl diff --git a/src/diary/entries/raw/entries/200919.tpl b/src/entries/200919.tpl similarity index 100% rename from src/diary/entries/raw/entries/200919.tpl rename to src/entries/200919.tpl diff --git a/src/diary/entries/raw/entries/200926.tpl b/src/entries/200926.tpl similarity index 100% rename from src/diary/entries/raw/entries/200926.tpl rename to src/entries/200926.tpl diff --git a/src/diary/entries/raw/entries/201001.tpl b/src/entries/201001.tpl similarity index 100% rename from src/diary/entries/raw/entries/201001.tpl rename to src/entries/201001.tpl diff --git a/src/diary/entries/raw/entries/201003.tpl b/src/entries/201003.tpl similarity index 100% rename from src/diary/entries/raw/entries/201003.tpl rename to src/entries/201003.tpl diff --git a/src/diary/entries/raw/article-to-html.py b/src/entries/raw/article-to-html.py similarity index 84% rename from src/diary/entries/raw/article-to-html.py rename to src/entries/raw/article-to-html.py index 4e5256c..2986c13 100644 --- a/src/diary/entries/raw/article-to-html.py +++ b/src/entries/raw/article-to-html.py @@ -9,7 +9,7 @@ def file_to_string(f): return text def fill_text(f): - return file_to_string('res/head.txt') + file_to_string(f) + file_to_string('res/tail.txt') + return file_to_string(f) #file_to_string('res/head.txt') + file_to_string(f) + file_to_string('res/tail.txt') def create_files(files, directory): for f in files: diff --git a/src/diary/entries/200808.tpl b/src/entries/raw/entries/200808.tpl similarity index 90% rename from src/diary/entries/200808.tpl rename to src/entries/raw/entries/200808.tpl index 8779b61..5901c74 100644 --- a/src/diary/entries/200808.tpl +++ b/src/entries/raw/entries/200808.tpl @@ -1,8 +1,3 @@ -% rebase('feature.tpl') - -
- -

9 weekly roundup

august 4-8, 2020 css, html, php, server, website
@@ -38,6 +33,3 @@
  • added images to live site despite conflicts with Linux's security

  • -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/200810.tpl b/src/entries/raw/entries/200810.tpl similarity index 90% rename from src/diary/entries/200810.tpl rename to src/entries/raw/entries/200810.tpl index e649ea4..dc50144 100644 --- a/src/diary/entries/200810.tpl +++ b/src/entries/raw/entries/200810.tpl @@ -1,8 +1,3 @@ -% rebase('feature.tpl') - -
    - -

    8 what is blessfrey?

    august 10, 2020

    @@ -19,6 +14,3 @@ Skills are gained through exploration of the game world. As you encounter enemie Blessfrey has been lots of fun to work on. I hope you enjoy it once a demo and eventually a game drops.

    chimchooree
    -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/200813.tpl b/src/entries/raw/entries/200813.tpl similarity index 90% rename from src/diary/entries/200813.tpl rename to src/entries/raw/entries/200813.tpl index 370c53d..f5c83dd 100644 --- a/src/diary/entries/200813.tpl +++ b/src/entries/raw/entries/200813.tpl @@ -1,8 +1,3 @@ -% rebase('feature.tpl') - -
    - -

    7 all weekly updates

    august 13, 2020

    @@ -48,6 +43,3 @@ function gather_files() { convert_files(gather_files()); ?>

    -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/200815.tpl b/src/entries/raw/entries/200815.tpl similarity index 89% rename from src/diary/entries/200815.tpl rename to src/entries/raw/entries/200815.tpl index 40972ce..d764fa8 100644 --- a/src/diary/entries/200815.tpl +++ b/src/entries/raw/entries/200815.tpl @@ -1,8 +1,3 @@ -% rebase('feature.tpl') - -
    - -

    6 weekly roundup

    august 9-15, 2020 apache, automation, css, html, jenkins, nginx, php, server, website
    @@ -39,6 +34,3 @@ apache, automation, css, html, jenkins, nginx, php, server, website

    -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/200918.tpl b/src/entries/raw/entries/200918.tpl similarity index 58% rename from src/diary/entries/200918.tpl rename to src/entries/raw/entries/200918.tpl index a5191fb..e145a64 100644 --- a/src/diary/entries/200918.tpl +++ b/src/entries/raw/entries/200918.tpl @@ -1,14 +1,6 @@ -% rebase('feature.tpl') - -
    - -

    5 my favorite GDC talks

    september 18, 2020

    I really should be keeping a list of these with descriptions, so why not keep them in an article?

    Work on it later.
    -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/200919.tpl b/src/entries/raw/entries/200919.tpl similarity index 73% rename from src/diary/entries/200919.tpl rename to src/entries/raw/entries/200919.tpl index 7679e7e..391ccaf 100644 --- a/src/diary/entries/200919.tpl +++ b/src/entries/raw/entries/200919.tpl @@ -1,8 +1,3 @@ -% rebase('feature.tpl') - -
    - -

    4 weekly roundup

    september 13-19, 2020 bottle
    @@ -16,6 +11,3 @@ bottle
  • Used Bottle to avoid repeating html code in navigation pane, header, and footer

  • -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/200926.tpl b/src/entries/raw/entries/200926.tpl similarity index 75% rename from src/diary/entries/200926.tpl rename to src/entries/raw/entries/200926.tpl index b1e645f..3aef0dd 100644 --- a/src/diary/entries/200926.tpl +++ b/src/entries/raw/entries/200926.tpl @@ -1,8 +1,3 @@ -% rebase('feature.tpl') - -
    - -

    3 weekly roundup

    september 20-26, 2020 bottle
    @@ -17,6 +12,3 @@ bottle
  • Updated the blessfrey.me script to serve static content like CSS stylesheets + images. Now the pages are actually styled.

  • -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/201001.tpl b/src/entries/raw/entries/201001.tpl similarity index 87% rename from src/diary/entries/201001.tpl rename to src/entries/raw/entries/201001.tpl index 4b6bb85..cd94c32 100644 --- a/src/diary/entries/201001.tpl +++ b/src/entries/raw/entries/201001.tpl @@ -1,8 +1,3 @@ -% rebase('feature.tpl') - -
    - -

    2 why bottle over php?

    october 1, 2020

    @@ -14,6 +9,3 @@ It's useful because it lets you reuse code for HTML, supports simple HTML templa
    It's still good to practice with, since it's a widely used web development language, and I feel like understanding it brings me closer to the PHP petsites of the mid-2000s which I dearly love.

    -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/201003.tpl b/src/entries/raw/entries/201003.tpl similarity index 92% rename from src/diary/entries/201003.tpl rename to src/entries/raw/entries/201003.tpl index ebdffeb..0f27cc8 100644 --- a/src/diary/entries/201003.tpl +++ b/src/entries/raw/entries/201003.tpl @@ -1,8 +1,3 @@ -% rebase('feature.tpl') - -
    - -

    1 this week

    september 27-october 3, 2020 bottle, css, git, html, regex, regular expressions, website
    @@ -22,6 +17,3 @@ bottle, css, git, html, regex, regular expressions, website


    -
    - -% include diary-boxes.tpl diff --git a/src/diary/entries/raw/res/head.txt b/src/entries/raw/res/head.txt similarity index 100% rename from src/diary/entries/raw/res/head.txt rename to src/entries/raw/res/head.txt diff --git a/src/diary/entries/raw/res/tail.txt b/src/entries/raw/res/tail.txt similarity index 100% rename from src/diary/entries/raw/res/tail.txt rename to src/entries/raw/res/tail.txt diff --git a/src/index.py b/src/index.py index 2f303b5..059f56f 100644 --- a/src/index.py +++ b/src/index.py @@ -1,10 +1,9 @@ import datetime, os, re -from bottle import error, route, run, static_file, template +from bottle import error, route, run, static_file, template, TEMPLATE_PATH -loc = 'diary/entries/' +loc = 'entries/' def list_headlines(articles): - head = count_lines(loc + 'raw/res/head.txt') result = [] text = [] @@ -16,15 +15,19 @@ def list_headlines(articles): b = [] b.append(path) - b.append(clean(text[head].replace('
    ',''))) + b.append(clean(text[0].replace('
    ',''))) result.append(b) return result +def retrieve_article(page): + text = [] + with open(loc + page) as f: + text = f.readlines() + return text + def list_snippets(articles): limit = 4 total = len(articles) - head = count_lines(loc + 'raw/res/head.txt') - tail = count_lines(loc + 'raw/res/tail.txt') result = [] for article in articles: @@ -35,15 +38,15 @@ def list_snippets(articles): with open(loc + article) as f: text = f.readlines() length = len(text) - a.append(clean(text[head])) # title - content = snip_article(find_content(article, length, head, tail), path) + a.append(clean(text[0])) # title + content = snip_article(find_content(article, length), path) if content.count(''): content += '' a.append(content) # snippet - a.append(text[head + 1].replace('
    ','')) # timestamp + a.append(text[1].replace('
    ','')) # timestamp a.append('/' + path.replace('.tpl','')) # URL - a.append(clean(text[head]).replace(' ','+')) # social media title + a.append(clean(text[0]).replace(' ','+')) # social media title result.append(a) return result @@ -53,11 +56,11 @@ def count_lines(fname): pass return linenum -def find_content(article, length, head, tail): +def find_content(article, length): content = "" with open(loc + article) as f: for pos, line in enumerate(f): - if pos > head + 1 and pos < length - tail: + if pos > 1 and pos < length: content += line return content @@ -131,11 +134,16 @@ def diary(page): info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': list_headlines(sort_files(gather_files())[0:5]), 'total': len(gather_files()), 'limit': 4, 'cluster': 3, 'page': page} return template('diary.tpl', info) -@route('diary/entries/') +@route('/entries/') def entry(page): - """diary entry""" - info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'latest': list_headlines(sort_files(gather_files())[0:5]), 'page': page} - return template('feature.tpl', info) + info = {'css': 'box', 'title': 'blessfrey - credits', 'year': datetime.datetime.now()} + 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,'contact.tpl'), info) +# """diary entry""" +# info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'entry': retrieve_article(page), 'latest': list_headlines(sort_files(gather_files())[0:5]), 'page': page} +# return template('feature.tpl', info) @route('/box') def box(): diff --git a/src/views/box.tpl b/src/views/box.tpl index 2bef33b..4c932bf 100644 --- a/src/views/box.tpl +++ b/src/views/box.tpl @@ -15,6 +15,15 @@

    Web Design


    diff --git a/src/views/feature.tpl b/src/views/feature.tpl index bfd8e8f..755b132 100644 --- a/src/views/feature.tpl +++ b/src/views/feature.tpl @@ -1,11 +1,12 @@ % rebase('frame.tpl') - - -
    - - {{!base}} +
    + + +
    + {{entry}} +
    % include diary-boxes.tpl