diff --git a/app/main.py b/app/main.py index 634338a..3818ea6 100644 --- a/app/main.py +++ b/app/main.py @@ -81,6 +81,15 @@ 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): + lst = s.split('\n') + lst.pop(0) # remove the first line + return '\n'.join(lst) + def get_today_article(user_word_list, articleID): rq = RecordQuery(path_prefix + 'static/wordfreqapp.db') @@ -111,12 +120,17 @@ def get_today_article(user_word_list, articleID): break s = '
%s
' % (d['date']) - s += '%s
' % (d['text']) - s += '%s
' % (d['source']) + s += 'Article added on: %s
' % (d['date']) + s += '%s
' % (article_title) + s += '%s
' % (article_body) + s += '%s
' % (d['source']) s += '%s
' % (get_question_part(d['question'])) s = s.replace('\n', '