コード例 #1
0
def ajax_richtext_preview(request, obj_type, obj_ref, obj_revi):
    """
    Ajax view to get an HTML preview of a raw content (in richtext
    syntax).

    GET paramerer:

        ``content``
            raw content to be rendered

    This view returns a JSON response with one key, ``html``, the rendered
    content that can be included in a div element.
    """
    content = request.GET["content"]
    if obj_type in ("create", "object"):
        return {"html": richtext(content, None)}
    obj = get_obj(obj_type, obj_ref, obj_revi, request.user)
    obj.check_readable()
    return {"html": richtext(content, obj)}
コード例 #2
0
ファイル: plmapp_tags.py プロジェクト: amarh/openPLM
def richtext_filter(content, obj=None):
    """
    This template filter takes a string value and passes it through the
    function specified by the RICHTEXT_FILTER setting.
    """
    return richtext(content, obj)
コード例 #3
0
def richtext_filter(content, obj=None):
    """
    This template filter takes a string value and passes it through the
    function specified by the RICHTEXT_FILTER setting.
    """
    return richtext(content, obj)
コード例 #4
0
ファイル: filters.py プロジェクト: pcon-world/pcon_db
 def test_richtext_test(self):
     html = richtext("test", self.ctrl)
     self.assertHTMLEqual(html, "TEST")
コード例 #5
0
ファイル: filters.py プロジェクト: pcon-world/pcon_db
 def test_richtext_disabled(self):
     html = richtext(SIMPLE_TEXT, self.ctrl)
     self.assertHTMLEqual(html, u"<p>%s</p>" % SIMPLE_TEXT)
     self.assertTrue(isinstance(html, SafeData))
コード例 #6
0
ファイル: filters.py プロジェクト: pcon-world/pcon_db
 def test_richtext_default_settings(self):
     html = richtext(SIMPLE_TEXT, self.ctrl)
     self.assertHTMLEqual(html, u"<p><em>a</em> simple text</p>")
     self.assertTrue(isinstance(html, SafeData))