diff --git a/app/Article.py b/app/Article.py
index 774d25a..7d3aad5 100644
--- a/app/Article.py
+++ b/app/Article.py
@@ -61,22 +61,14 @@ def get_today_article(user_word_list, articleID):
if within_range(text_level, user_level, (8.0 - user_level) * factor):
d = reading
break
-
- s = '
According to your word list, your level is %4.2f and we have chosen an article with a difficulty level of %4.2f for you.
' % (
- user_level, text_level)
- s += 'Article added on: %s
' % (d['date'])
- s += ''
+
+ article_date = d['date']
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', '
')
- s += '%s' % (get_answer_part(d['question']))
- s += '
'
- session['articleID'] = d['article_id']
- return s
+ question_part = get_question_part(d['question'])
+ answer_part = get_answer_part(d['question'])
+ return user_level,text_level,article_date,article_title,article_body,question_part,answer_part
+
def load_freq_history(path):
@@ -103,7 +95,7 @@ def get_question_part(s):
flag = 0
elif flag == 1:
result.append(line)
- return '\n'.join(result)
+ return result
def get_answer_part(s):
@@ -117,20 +109,4 @@ def get_answer_part(s):
elif flag == 1:
result.append(line)
# https://css-tricks.com/snippets/javascript/showhide-element/
- js = '''
-
- '''
- html_code = js
- html_code += '\n'
- html_code += 'ANSWER \n'
- html_code += '%s
\n' % ('\n'.join(result))
- return html_code
\ No newline at end of file
+ return result
\ No newline at end of file
diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html
index 19542c1..da8a351 100644
--- a/app/templates/userpage_get.html
+++ b/app/templates/userpage_get.html
@@ -30,8 +30,48 @@
下一篇 Next Article
阅读文章并回答问题
- {{ today_article|safe }}
+
+
+
+ According to your word list, your level is
+ {{ user_level }}
+ and we have chosen an article with a difficulty level of
+ {{ text_level }}
+ for you.
+
+
Article added on: {{ article_date }}
+
+
{{ article_title }}
+
{{ article_body }}
+
+ {% for x in question_part %}
+ {{ x }}
+
+ {% endfor %}
+
+
+
+
ANSWER
+
+ {% for x in answer_part %}
+ {{ x }}
+
+ {% endfor %}
+
+
+
+
+
生词高亮
大声朗读
划词入库
diff --git a/app/user_service.py b/app/user_service.py
index 139c140..bec8b17 100644
--- a/app/user_service.py
+++ b/app/user_service.py
@@ -117,11 +117,19 @@ def userpage(username):
words = ''
for x in lst3:
words += x[0] + ' '
+ user_level,text_level,article_date,article_title,article_body,question_part,answer_part = get_today_article(user_freq_record, session['articleID'])
return render_template('userpage_get.html',
username=username,
session=session,
flashed_messages=get_flashed_messages_if_any(),
- today_article=get_today_article(user_freq_record, session['articleID']),
+ d=d,
+ user_level=user_level,
+ text_level=text_level,
+ article_date=article_date,
+ article_title=article_title,
+ article_body=article_body,
+ question_part=question_part,
+ answer_part=answer_part,
d_len=len(d),
lst3=lst3,
yml=Yaml.yml,
@@ -130,7 +138,6 @@ def userpage(username):
-
@userService.route("//mark", methods=['GET', 'POST'])
def user_mark_word(username):
'''