Commit 1af496935addff8a807744a89c28ed8cd087e58b

Authored by Miguel Barão
1 parent 6818d19c
Exists in master and in 1 other branch dev

- fix 'info' vs 'information' in topic.js.

- information now looks like the other text (not warning panels).
static/js/topic.js
... ... @@ -66,7 +66,7 @@ function new_question(type, question, tries, progress) {
66 66 $("#question_div").html(question).animateCSS('bounceInDown');
67 67 showTriesLeft(tries);
68 68 $("#comments, #solution").html("");
69   - var btntext = (type == "info") ? "Continuar" : "Responder";
  69 + var btntext = (type == "information") ? "Continuar" : "Responder";
70 70 $("#submit").html(btntext).off().click(postAnswer);
71 71 $('#topic_progress').css('width', (100*progress)+'%').attr('aria-valuenow', 100*progress);
72 72 MathJax.Hub.Queue(["Typeset",MathJax.Hub,"question_div"]);
... ... @@ -120,7 +120,7 @@ function getFeedback(response) {
120 120 var method = response["method"];
121 121 var params = response["params"];
122 122  
123   - if (params['type'] == "info") {
  123 + if (params['type'] == "information") {
124 124 getQuestion();
125 125 return;
126 126 }
... ...
templates/question-information.html
1 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 7 </div>
22 8  
23 9 <input type="hidden" name="question_ref" value="{{ question['ref'] }}">
... ...
tools.py
... ... @@ -22,8 +22,8 @@ logger = logging.getLogger(__name__)
22 22 # Block math: $$x$$ or \begin{equation}x\end{equation}
23 23 # -------------------------------------------------------------------------
24 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 29 class MathBlockLexer(mistune.BlockLexer):
... ... @@ -35,7 +35,7 @@ class MathBlockLexer(mistune.BlockLexer):
35 35 super().__init__(rules, **kwargs)
36 36  
37 37 def parse_block_math(self, m):
38   - """Parse a $$math$$ block"""
  38 + '''Parse a $$math$$ block'''
39 39 self.tokens.append({
40 40 'type': 'block_math',
41 41 'text': m.group(1)
... ... @@ -50,8 +50,8 @@ class MathBlockLexer(mistune.BlockLexer):
50 50  
51 51  
52 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 55 text = re.compile(r'^[\s\S]+?(?=[\\<!\[_*`~$]|https?://| {2,}\n|$)')
56 56  
57 57  
... ...