Commit 1af496935addff8a807744a89c28ed8cd087e58b
1 parent
6818d19c
Exists in
master
and in
1 other branch
- fix 'info' vs 'information' in topic.js.
- information now looks like the other text (not warning panels).
Showing
3 changed files
with
11 additions
and
25 deletions
Show diff stats
static/js/topic.js
@@ -66,7 +66,7 @@ function new_question(type, question, tries, progress) { | @@ -66,7 +66,7 @@ function new_question(type, question, tries, progress) { | ||
66 | $("#question_div").html(question).animateCSS('bounceInDown'); | 66 | $("#question_div").html(question).animateCSS('bounceInDown'); |
67 | showTriesLeft(tries); | 67 | showTriesLeft(tries); |
68 | $("#comments, #solution").html(""); | 68 | $("#comments, #solution").html(""); |
69 | - var btntext = (type == "info") ? "Continuar" : "Responder"; | 69 | + var btntext = (type == "information") ? "Continuar" : "Responder"; |
70 | $("#submit").html(btntext).off().click(postAnswer); | 70 | $("#submit").html(btntext).off().click(postAnswer); |
71 | $('#topic_progress').css('width', (100*progress)+'%').attr('aria-valuenow', 100*progress); | 71 | $('#topic_progress').css('width', (100*progress)+'%').attr('aria-valuenow', 100*progress); |
72 | MathJax.Hub.Queue(["Typeset",MathJax.Hub,"question_div"]); | 72 | MathJax.Hub.Queue(["Typeset",MathJax.Hub,"question_div"]); |
@@ -120,7 +120,7 @@ function getFeedback(response) { | @@ -120,7 +120,7 @@ function getFeedback(response) { | ||
120 | var method = response["method"]; | 120 | var method = response["method"]; |
121 | var params = response["params"]; | 121 | var params = response["params"]; |
122 | 122 | ||
123 | - if (params['type'] == "info") { | 123 | + if (params['type'] == "information") { |
124 | getQuestion(); | 124 | getQuestion(); |
125 | return; | 125 | return; |
126 | } | 126 | } |
templates/question-information.html
1 | {% autoescape %} | 1 | {% autoescape %} |
2 | 2 | ||
3 | -{% if q['type'] == 'information' %} | ||
4 | -<div class="card border-primary mb-3"> | ||
5 | - <div class="card-body text-primary"> | ||
6 | -{% elif q['type'] == 'success' %} | ||
7 | -<div class="card border-success mb-3"> | ||
8 | - <div class="card-body text-success"> | ||
9 | -{% elif q['type'] == 'warning' %} | ||
10 | -<div class="card border-warning mb-3"> | ||
11 | - <div class="card-body text-warning"> | ||
12 | -{% elif q['type'] == 'alert' %} | ||
13 | -<div class="card border-danger mb-3"> | ||
14 | - <div class="card-body text-danger"> | ||
15 | -{% end %} | ||
16 | - <h3 class="card-title">{{ question['title'] }}</h3> | ||
17 | - <p class="card-text"> | ||
18 | - {{ md(question['text']) }} | ||
19 | - </p> | ||
20 | - </div> | 3 | +<h2 class="page-header">{{ question['title'] }}</h4> |
4 | + | ||
5 | +<div id="text"> | ||
6 | + {{ md(question['text']) }} | ||
21 | </div> | 7 | </div> |
22 | 8 | ||
23 | <input type="hidden" name="question_ref" value="{{ question['ref'] }}"> | 9 | <input type="hidden" name="question_ref" value="{{ question['ref'] }}"> |
tools.py
@@ -22,8 +22,8 @@ logger = logging.getLogger(__name__) | @@ -22,8 +22,8 @@ logger = logging.getLogger(__name__) | ||
22 | # Block math: $$x$$ or \begin{equation}x\end{equation} | 22 | # Block math: $$x$$ or \begin{equation}x\end{equation} |
23 | # ------------------------------------------------------------------------- | 23 | # ------------------------------------------------------------------------- |
24 | class MathBlockGrammar(mistune.BlockGrammar): | 24 | class MathBlockGrammar(mistune.BlockGrammar): |
25 | - block_math = re.compile(r"^\$\$(.*?)\$\$", re.DOTALL) | ||
26 | - latex_environment = re.compile(r"^\\begin\{([a-z]*\*?)\}(.*?)\\end\{\1\}", re.DOTALL) | 25 | + block_math = re.compile(r'^\$\$(.*?)\$\$', re.DOTALL) |
26 | + latex_environment = re.compile(r'^\\begin\{([a-z]*\*?)\}(.*?)\\end\{\1\}', re.DOTALL) | ||
27 | 27 | ||
28 | 28 | ||
29 | class MathBlockLexer(mistune.BlockLexer): | 29 | class MathBlockLexer(mistune.BlockLexer): |
@@ -35,7 +35,7 @@ class MathBlockLexer(mistune.BlockLexer): | @@ -35,7 +35,7 @@ class MathBlockLexer(mistune.BlockLexer): | ||
35 | super().__init__(rules, **kwargs) | 35 | super().__init__(rules, **kwargs) |
36 | 36 | ||
37 | def parse_block_math(self, m): | 37 | def parse_block_math(self, m): |
38 | - """Parse a $$math$$ block""" | 38 | + '''Parse a $$math$$ block''' |
39 | self.tokens.append({ | 39 | self.tokens.append({ |
40 | 'type': 'block_math', | 40 | 'type': 'block_math', |
41 | 'text': m.group(1) | 41 | 'text': m.group(1) |
@@ -50,8 +50,8 @@ class MathBlockLexer(mistune.BlockLexer): | @@ -50,8 +50,8 @@ class MathBlockLexer(mistune.BlockLexer): | ||
50 | 50 | ||
51 | 51 | ||
52 | class MathInlineGrammar(mistune.InlineGrammar): | 52 | class MathInlineGrammar(mistune.InlineGrammar): |
53 | - math = re.compile(r"^\$(.+?)\$", re.DOTALL) | ||
54 | - block_math = re.compile(r"^\$\$(.+?)\$\$", re.DOTALL) | 53 | + math = re.compile(r'^\$(.+?)\$', re.DOTALL) |
54 | + block_math = re.compile(r'^\$\$(.+?)\$\$', re.DOTALL) | ||
55 | text = re.compile(r'^[\s\S]+?(?=[\\<!\[_*`~$]|https?://| {2,}\n|$)') | 55 | text = re.compile(r'^[\s\S]+?(?=[\\<!\[_*`~$]|https?://| {2,}\n|$)') |
56 | 56 | ||
57 | 57 |