def _fill_annotation_window_text_rendered(session, window):
    query = (session.query(Annotation).filter(
        Annotation.updated.between(window.start, window.end)).order_by(
            Annotation.updated.asc()))

    for a in query:
        a.text_rendered = markdown.render(a.text)
コード例 #2
0
ファイル: annotation.py プロジェクト: wisdom-garden/h
 def text(self, value):
     self._text = value
     # N.B. We MUST take care here of appropriately escaping the user
     # input. Code elsewhere will assume that the content of the
     # `text_rendered` field is safe for printing without further escaping.
     #
     # `markdown.render` does the hard work for now.
     self._text_rendered = markdown.render(value)
コード例 #3
0
ファイル: annotation.py プロジェクト: hypothesis/h
 def text(self, value):
     self._text = value
     # N.B. We MUST take care here of appropriately escaping the user
     # input. Code elsewhere will assume that the content of the
     # `text_rendered` field is safe for printing without further escaping.
     #
     # `markdown.render` does the hard work for now.
     self._text_rendered = markdown.render(value)
コード例 #4
0
ファイル: markdown_test.py プロジェクト: zhiiker/hypothesis
 def test_it_renders_markdown(self):
     actual = markdown.render("_emphasis_ **bold**")
     assert "<p><em>emphasis</em> <strong>bold</strong></p>\n" == actual
コード例 #5
0
ファイル: markdown_test.py プロジェクト: zhiiker/hypothesis
 def test_it_sanitizes_the_output(self, markdown_render, sanitize):
     markdown.render("foobar")
     sanitize.assert_called_once_with(markdown_render.return_value)
コード例 #6
0
ファイル: markdown_test.py プロジェクト: zhiiker/hypothesis
 def test_it_ignores_inline_match(self):
     actual = markdown.render(r"Foobar \(1 + 1 = 2\)")
     assert "<p>Foobar \\(1 + 1 = 2\\)</p>\n" == actual
コード例 #7
0
ファイル: markdown_test.py プロジェクト: zhiiker/hypothesis
 def test_it_ignores_math_block(self):
     actual = markdown.render("$$1 + 1 = 2$$")
     assert "<p>$$1 + 1 = 2$$</p>\n" == actual
コード例 #8
0
 def test_it_ignores_inline_match(self):
     actual = markdown.render(r'Foobar \(1 + 1 = 2\)')
     assert '<p>Foobar \\(1 + 1 = 2\\)</p>\n' == actual
コード例 #9
0
 def test_it_ignores_math_block(self):
     actual = markdown.render('$$1 + 1 = 2$$')
     assert '<p>$$1 + 1 = 2$$</p>\n' == actual
コード例 #10
0
ファイル: markdown_test.py プロジェクト: hypothesis/h
 def test_it_sanitizes_the_output(self, markdown_render, sanitize):
     markdown.render("foobar")
     sanitize.assert_called_once_with(markdown_render.return_value)
コード例 #11
0
ファイル: markdown_test.py プロジェクト: hypothesis/h
 def test_it_ignores_inline_match(self):
     actual = markdown.render(r"Foobar \(1 + 1 = 2\)")
     assert "<p>Foobar \\(1 + 1 = 2\\)</p>\n" == actual
コード例 #12
0
ファイル: markdown_test.py プロジェクト: hypothesis/h
 def test_it_ignores_math_block(self):
     actual = markdown.render("$$1 + 1 = 2$$")
     assert "<p>$$1 + 1 = 2$$</p>\n" == actual
コード例 #13
0
ファイル: markdown_test.py プロジェクト: hypothesis/h
 def test_it_renders_markdown(self):
     actual = markdown.render("_emphasis_ **bold**")
     assert "<p><em>emphasis</em> <strong>bold</strong></p>\n" == actual
コード例 #14
0
ファイル: markdown_test.py プロジェクト: chinmaygghag/h
 def test_it_ignores_inline_match(self):
     actual = markdown.render('Foobar \(1 + 1 = 2\)')
     assert '<p>Foobar \(1 + 1 = 2\)</p>\n' == actual
コード例 #15
0
ファイル: markdown_test.py プロジェクト: chinmaygghag/h
 def test_it_ignores_math_block(self):
     actual = markdown.render('$$1 + 1 = 2$$')
     assert '<p>$$1 + 1 = 2$$</p>\n' == actual