You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/01/26 19:35:53 UTC

[trafficserver] 05/05: TS-5107: init_customizations() isn't new in Docutils 0.13

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 3c70cfca3b62010afe5c064b415df8eaf7af8367
Author: Jack Bates <ja...@nottheoilrig.com>
AuthorDate: Wed Jan 25 13:35:47 2017 -0700

    TS-5107: init_customizations() isn't new in Docutils 0.13
    
    We can use it in 0.12 and 0.13.
    
    (cherry picked from commit 977aa2c9caae1d24a8635b02c672a3cac0e2a66a)
---
 doc/conf.py | 46 +++++++++++++++++-----------------------------
 1 file changed, 17 insertions(+), 29 deletions(-)

diff --git a/doc/conf.py b/doc/conf.py
index 7a1ae44..ad7c8bc 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -182,35 +182,23 @@ from docutils.utils import unescape
 # states.Inliner isn't a new-style class, so super() isn't an option.
 BaseInliner = states.Inliner
 class Inliner(states.Inliner):
-  if hasattr(states.Inliner, 'init_customizations'):
-    def init_customizations(self, settings):
-      self.__class__ = BaseInliner
-      BaseInliner.init_customizations(self, settings)
-      self.__class__ = Inliner
-
-      # Copied from states.Inliner.init_customizations().
-      # In Docutils 0.13 these are locals.
-      if settings.character_level_inline_markup:
-        self.start_string_prefix = u'(^|(?<!\x00))'
-        self.end_string_suffix = u''
-      else:
-        self.start_string_prefix = (u'(^|(?<=\\s|[%s%s]))' %
-                                    (punctuation_chars.openers,
-                                     punctuation_chars.delimiters))
-        self.end_string_suffix = (u'($|(?=\\s|[\x00%s%s%s]))' %
-                                  (punctuation_chars.closing_delimiters,
-                                   punctuation_chars.delimiters,
-                                   punctuation_chars.closers))
-
-      self.init()
-  else:
-    def __init__(self):
-      BaseInliner.__init__(self)
-      self.init()
-
-  # Called from __init__() in Docutils < 0.13, otherwise from
-  # init_customizations(), which was added in Docutils 0.13.
-  def init(self):
+  def init_customizations(self, settings):
+    self.__class__ = BaseInliner
+    BaseInliner.init_customizations(self, settings)
+    self.__class__ = Inliner
+
+    # Copied from states.Inliner.init_customizations().
+    # In Docutils 0.13 these are locals.
+    if not hasattr(self, 'start_string_prefix'):
+      self.start_string_prefix = (u'(^|(?<=\\s|[%s%s]))' %
+                                  (punctuation_chars.openers,
+                                   punctuation_chars.delimiters))
+    if not hasattr(self, 'end_string_suffix'):
+      self.end_string_suffix = (u'($|(?=\\s|[\x00%s%s%s]))' %
+                                (punctuation_chars.closing_delimiters,
+                                 punctuation_chars.delimiters,
+                                 punctuation_chars.closers))
+
     issue = re.compile(
       ur'''
       {start_string_prefix}

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.