changeset 7923:29a666d8a70d

issue2551285 - Remove StructuredText support Asked on the users mailing list if anybody was using it. Got no responses. I have never seen CI installing structuredtext packages so it's untested as well.
author John Rouillard <rouilj@ieee.org>
date Tue, 30 Apr 2024 22:27:57 -0400
parents ded9f1c3f112
children 141225d2981e
files CHANGES.txt doc/upgrading.txt roundup/cgi/templating.py test/test_templating.py
diffstat 4 files changed, 5 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Tue Apr 30 22:17:50 2024 -0400
+++ b/CHANGES.txt	Tue Apr 30 22:27:57 2024 -0400
@@ -131,6 +131,8 @@
 - issue2551302 - Remove support for sqlite version 1 from
   back_sqlite.py. We have been using sqlite3 for over a decade. (John
   Rouillard)
+- issue2551285 - Remove StructuredText support. reStructuredText is
+  still supported. (John Rouillard)
 
 Features:
 
--- a/doc/upgrading.txt	Tue Apr 30 22:17:50 2024 -0400
+++ b/doc/upgrading.txt	Tue Apr 30 22:27:57 2024 -0400
@@ -491,6 +491,9 @@
 
 Support for SQLite version 1 has been removed in 2.4.0.
 
+Support for StructuredText has been removed in 2.4.0. Support for
+reStructuredText remains.
+
 Support for the `PySQLite <https://github.com/ghaering/pysqlite>`_
 library will be removed in 2.5.0. Only the Python supplied sqlite3
 library will be supported.
--- a/roundup/cgi/templating.py	Tue Apr 30 22:17:50 2024 -0400
+++ b/roundup/cgi/templating.py	Tue Apr 30 22:27:57 2024 -0400
@@ -38,13 +38,6 @@
 from .KeywordsExpr import render_keywords_expression_editor
 
 try:
-    from StructuredText.StructuredText import HTML as StructuredText
-except ImportError:
-    try:  # older version
-        import StructuredText
-    except ImportError:
-        StructuredText = None
-try:
     from docutils.core import publish_parts as ReStructuredText
 except ImportError:
     ReStructuredText = None
@@ -1866,19 +1859,6 @@
             s = self.hyper_re.sub(self._hyper_repl, s)
         return s
 
-    def stext(self, escape=0, hyperlink=1):
-        """ Render the value of the property as StructuredText.
-
-            This requires the StructureText module to be installed separately.
-        """
-        if not self.is_view_ok():
-            return self._('[hidden]')
-
-        s = self.plain(escape=escape, hyperlink=hyperlink)
-        if not StructuredText:
-            return s
-        return StructuredText(s, level=1, header=0)
-
     def rst(self, hyperlink=1):
         """ Render the value of the property as ReStructuredText.
 
--- a/test/test_templating.py	Tue Apr 30 22:17:50 2024 -0400
+++ b/test/test_templating.py	Tue Apr 30 22:27:57 2024 -0400
@@ -23,12 +23,6 @@
     skip_rst = mark_class(pytest.mark.skip(
         reason='ReStructuredText not available'))
 
-if StructuredText:
-    skip_stext = lambda func, *args, **kwargs: func
-else:
-    skip_stext = mark_class(pytest.mark.skip(
-        reason='StructuredText not available'))
-
 import roundup.cgi.templating
 if roundup.cgi.templating._import_mistune():
     skip_mistune = lambda func, *args, **kwargs: func
@@ -570,11 +564,6 @@
         self.assertEqual(t.rst(), u2s(t_result))
         self.assertEqual(u.rst(), u2s(u_result))
 
-    @skip_stext
-    def test_string_stext(self):
-        p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
-        self.assertEqual(p.stext(), u2s(u'<p>A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> <em>embedded</em> \u00df</p>\n'))
-
     def test_string_field(self):
         p = StringHTMLProperty(self.client, 'test', '1', None, 'test', 'A string <b> with rouilj@example.com embedded &lt; html</b>')
         self.assertEqual(p.field(), '<input name="test1@test" size="30" type="text" value="A string &lt;b&gt; with rouilj@example.com embedded &amp;lt; html&lt;/b&gt;">')
@@ -1103,23 +1092,6 @@
         p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
         self.assertEqual(p.rst(), u2s(u'A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> *embedded* \u00df'))
 
-class NoStextTestCase(TemplatingTestCase) :
-    def setUp(self):
-        TemplatingTestCase.setUp(self)
-
-        from roundup.cgi import templating
-        self.__StructuredText = templating.StructuredText
-        templating.StructuredText = None
-
-    def tearDown(self):
-        from roundup.cgi import templating
-        templating.StructuredText = self.__StructuredText
-
-    def test_string_stext(self):
-        p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
-        self.assertEqual(p.stext(), u2s(u'A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> *embedded* \u00df'))
-
-
 class ZUtilsTestcase(TemplatingTestCase):
 
     def test_Iterator(self):

Roundup Issue Tracker: http://roundup-tracker.org/