Skip to content

Commit

Permalink
Fixed #187 -- 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.
  • Loading branch information
bmispelon committed Mar 21, 2024
1 parent 21bc47f commit b125cb5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions .TRACFREEZE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ trac.mimeview.api.plaintextrenderer
trac.mimeview.api.wikitextrenderer
trac.mimeview.patch.patchrenderer
trac.mimeview.pygments.pygmentsrenderer
trac.mimeview.rst.restructuredtextrenderer
trac.notification.api.notificationsystem
trac.notification.mail.alwaysemailsubscriber
trac.notification.mail.emaildistributor
Expand Down
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

0 comments on commit b125cb5

Please sign in to comment.