Skip to content

Commit

Permalink
Restored support for restructuredtext on wiki pages
Browse files Browse the repository at this point in the history
The docutils dependency was removed by mistake in
d9356b4.

Fixes #187
  • Loading branch information
bmispelon committed Mar 21, 2024
1 parent 21bc47f commit 35bd21d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions DjangoPlugin/tracdjangoplugin/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
from django.contrib.auth.models import User
from django.test import SimpleTestCase, TestCase

from trac.mimeview.api import Mimeview
from trac.mimeview.rst import (
ReStructuredTextRenderer, # noqa: needed for RSTWikiTestCase to work
)
from trac.test import EnvironmentStub, MockRequest
from trac.web.api import RequestDone

Expand Down Expand Up @@ -228,3 +232,15 @@ def test_anonymous_goes_through(self):
handler = object()
retval = self.component.pre_process_request(request, handler=handler)
self.assertIs(retval, handler)


class RSTWikiTestCase(SimpleTestCase):
def test_wiki_can_render_rst(self):
renderer = Mimeview(EnvironmentStub())
output = renderer.render(
content="====\nTEST\n====\n", mimetype="text/x-rst", context=None
)
self.assertHTMLEqual(
str(output),
'<div class="document" id="test"><h1 class="title">TEST</h1></div>',
)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# spam-filter doesn't work without babel (but somehow doesn't list it in its requirements)
Trac[pygments, babel]==1.6.0
# rest is needed to support wiki pages written in rst
Trac[babel, pygments, rest]==1.6.0
psycopg2==2.9.9 --no-binary=psycopg2
Django==3.2.25
libsass==0.23.0
Expand Down
1 change: 1 addition & 0 deletions trac-env/conf/trac.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ wiki_format_messages = enabled
[components]
trac.about.* = disabled
trac.admin.web_ui.PluginAdminPanel = disabled
trac.mimeview.rst.* = enabled
trac.ticket.query.* = enabled
trac.ticket.query.querymodule = enabled
trac.ticket.query.ticketquerymacro = enabled
Expand Down

0 comments on commit 35bd21d

Please sign in to comment.