diff options
author | rsiddharth <s@ricketyspace.net> | 2019-05-18 18:44:46 -0400 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2019-05-18 18:46:12 -0400 |
commit | 0c20f06793a6630152e8fe032b2cd3f9f636141b (patch) | |
tree | 5b66b83b586969bc449f7281077d5350cd413d69 /bin/html | |
parent | aec4073669917ce1cfc80e4a4b42e2eb1a6ce53b (diff) |
bin/html: Add ability set author.
* bin/html (PH): Add author field.
(author): New function.
(html): Set author if needed.
* scss/style.scss: Update styling for '.meta'. Add styling '.author'
and '.date' divs under meta.
* templates/html/article.html: Add author in meta div.
Diffstat (limited to 'bin/html')
-rw-r--r-- | bin/html | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -18,6 +18,7 @@ SECTIONS = ['news'] # placeholders PH = { 'title': '<!-- ITEM-TITLE -->', + 'author': '<!-- AUTHOR -->', 'date': '<!-- DATE -->', 'content': '<!-- MAIN-CONTENT -->', } @@ -84,6 +85,15 @@ def title(c): return m.group(1) +def author(c): + m = re.search(r'<!-- author: ([\w ]+) -->', c) + + if not m: + return '' + + return 'By ' + m.group(1) + + def date(c): m = re.search(r'pubdate: ([0-9]{8})', c) @@ -128,6 +138,7 @@ def html(sec, f): s = slug(f.path) t = title(c) + a = author(c) d = date(c) c = content(c) @@ -136,6 +147,9 @@ def html(sec, f): h = h.replace(PH['date'], datefmt(d), 1) h = h.replace(PH['content'], markdown(c), 1) + if author: + h = h.replace(PH['author'], a, 1) + return s, h |