app/main.py: bootstrap elements.

pull/10/head
Hui Lan 2021-07-31 20:54:19 +08:00
parent e841ca7d07
commit 29f0d02327
1 changed files with 3 additions and 1 deletions

View File

@ -110,7 +110,7 @@ def get_today_article(user_word_list, articleID):
d = reading d = reading
break break
s = '<p><i>According to your word list, your level is <b>%4.2f</b> and we have chosen an article with a difficulty level of <b>%4.2f</b> for you.</i></p>' % (user_level, text_level) s = '<p><i>According to your word list, your level is <span class="badge bg-success">%4.2f</span> and we have chosen an article with a difficulty level of <span class="badge bg-success">%4.2f</span> for you.</i></p>' % (user_level, text_level)
s += '<p><b>%s</b></p>' % (d['date']) s += '<p><b>%s</b></p>' % (d['date'])
s += '<p><font size=+2>%s</font></p>' % (d['text']) s += '<p><font size=+2>%s</font></p>' % (d['text'])
s += '<p><i>%s</i></p>' % (d['source']) s += '<p><i>%s</i></p>' % (d['source'])
@ -336,6 +336,7 @@ def userpage(username):
page = '<meta charset="UTF8">\n' page = '<meta charset="UTF8">\n'
page += '<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes" />\n' page += '<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes" />\n'
page += '<meta name="format-detection" content="telephone=no" />\n' # forbid treating numbers as cell numbers in smart phones page += '<meta name="format-detection" content="telephone=no" />\n' # forbid treating numbers as cell numbers in smart phones
page += '<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">'
page += '<title>EnglishPal Study Room for %s</title>' % (username) page += '<title>EnglishPal Study Room for %s</title>' % (username)
page += '<p><b>English Pal for <font color="red">%s</font></b> <a href="/logout">登出</a></p>' % (username) page += '<p><b>English Pal for <font color="red">%s</font></b> <a href="/logout">登出</a></p>' % (username)
page += '<p><a href="/%s/reset">下一篇</a></p>' % (username) page += '<p><a href="/%s/reset">下一篇</a></p>' % (username)
@ -393,6 +394,7 @@ def userpage(username):
page += '<p class="new-word"> <a href="%s">%s</a>(<a title="%s">%d</a>) <a href="%s/%s/familiar">熟悉</a> <a href="%s/%s/unfamiliar">不熟悉</a> <a href="%s/%s/del" >删除</a> </p>\n' % (youdao_link(word), word, '; '.join(d[word]), freq,username, word,username,word, username,word) page += '<p class="new-word"> <a href="%s">%s</a>(<a title="%s">%d</a>) <a href="%s/%s/familiar">熟悉</a> <a href="%s/%s/unfamiliar">不熟悉</a> <a href="%s/%s/del" >删除</a> </p>\n' % (youdao_link(word), word, '; '.join(d[word]), freq,username, word,username,word, username,word)
elif isinstance(d[word], int): # d[word] is a frequency. to migrate from old format. elif isinstance(d[word], int): # d[word] is a frequency. to migrate from old format.
page += '<a href="%s">%s</a>%d\n' % (youdao_link(word), word, freq) page += '<a href="%s">%s</a>%d\n' % (youdao_link(word), word, freq)
page += '<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>'
return page return page
### Sign-up, login, logout ### ### Sign-up, login, logout ###