From c71b1562037cac099df593460cccf0daa23dfd32 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Sun, 1 Aug 2021 21:22:45 +0800 Subject: [PATCH] app/main.py: larger font for article title. --- app/main.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 496724c..c342a16 100644 --- a/app/main.py +++ b/app/main.py @@ -81,6 +81,14 @@ def within_range(x, y, r): return x > y and abs(x - y) <= r +def get_article_title(s): + return s.split('\n')[0] + + +def get_article_body(s): + return '\n'.join(s.split('\n')[1:-1]) # remove the first line + + def get_today_article(user_word_list, articleID): rq = RecordQuery(path_prefix + 'static/wordfreqapp.db') @@ -113,7 +121,10 @@ def get_today_article(user_word_list, articleID): s = '' % (user_level, text_level) s += '

Article added on: %s

' % (d['date']) s += '
' - s += '

%s

' % (d['text']) + article_title = get_article_title(d['text']) + article_body = get_article_body(d['text']) + s += '

%s

' % (article_title) + s += '

%s

' % (article_body) s += '

%s

' % (d['source']) s += '

%s

' % (get_question_part(d['question'])) s = s.replace('\n', '
')