You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by js...@apache.org on 2017/01/25 18:52:50 UTC

[trafficserver] branch master updated (fdcf3d3 -> 111e7f5)

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

jsime pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

      from  fdcf3d3   Issue #1360: REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) sometimes crashes
       new  11bfc4b   Revert "Fix nested role (not supported)"
       new  ffc906a   Revert "Fix documentation build for docutils 0.13.1 (2/2)"
       new  97723e7   Revert "Fix documentation build for docutils 0.13.1 (1/2)"
       new  111e7f5   TS-5107: Changes to autolinking in Docutils 0.13

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 doc/admin-guide/configuration/cache-basics.en.rst  |   2 +-
 doc/admin-guide/files/records.config.en.rst        |   2 +-
 doc/conf.py                                        |  74 ++++++++++-
 .../functions/TSHttpTxnClientPacketMarkSet.en.rst  |   2 +-
 .../functions/TSHttpTxnClientPacketTosSet.en.rst   |   2 +-
 .../functions/TSHttpTxnServerPacketMarkSet.en.rst  |   2 +-
 .../functions/TSHttpTxnServerPacketTosSet.en.rst   |   2 +-
 .../api/functions/TSLifecycleHookAdd.en.rst        |   2 +-
 .../architecture/architecture.en.rst               |   6 +-
 .../architecture/consistency.en.rst                |   2 +-
 doc/ext/traffic-server.py                          | 135 ++-------------------
 11 files changed, 87 insertions(+), 144 deletions(-)

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

[trafficserver] 03/04: Revert "Fix documentation build for docutils 0.13.1 (1/2)"

Posted by js...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jsime pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 97723e740802cfa4a5105227df13e268c98472a9
Author: Jack Bates <ja...@nottheoilrig.com>
AuthorDate: Fri Jan 6 12:49:46 2017 -0700

    Revert "Fix documentation build for docutils 0.13.1 (1/2)"
    
    This reverts commit ac0db847e841d50fd38920234166a45762b00398.
---
 doc/conf.py               |  43 +++++++++++++--
 doc/ext/traffic-server.py | 135 +++-------------------------------------------
 2 files changed, 46 insertions(+), 132 deletions(-)

diff --git a/doc/conf.py b/doc/conf.py
index 760570c..8ee27b8 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -166,9 +166,44 @@ pygments_style = 'sphinx'
 nitpicky=1
 
 # Autolink issue references
-# moved into traffic_server Sphinx extension
-trafficserver_jira_url='https://issues.apache.org/jira/browse/'
-trafficserver_github_url='https://github.com/apache/trafficserver/issues/'
+
+from docutils import nodes
+from docutils.parsers.rst import states
+from docutils.utils import unescape
+
+# Customize parser.inliner in the only way that Sphinx supports.
+# docutils.parsers.rst.Parser takes an instance of states.Inliner or a
+# subclass but Sphinx initializes it from
+# SphinxStandaloneReader.set_parser('restructuredtext') which is called
+# from Publisher.set_components() and initializes the parser without
+# arguments.
+
+BaseInliner = states.Inliner
+class Inliner(BaseInliner):
+  def __init__(self):
+    BaseInliner.__init__(self)
+
+    issue_pattern = re.compile(u'''
+      {start_string_prefix}
+      TS-\d+
+      {end_string_suffix}'''.format(
+        start_string_prefix=self.start_string_prefix,
+        end_string_suffix=self.end_string_suffix),
+      re.VERBOSE | re.UNICODE)
+
+    self.implicit_dispatch.append((issue_pattern, self.issue_reference))
+
+  def issue_reference(self, match, lineno):
+    text = match.group(0)
+
+    rawsource = unescape(text, True)
+    text = unescape(text, False)
+
+    refuri = 'https://issues.apache.org/jira/browse/' + text
+
+    return [nodes.reference(rawsource, text, refuri=refuri)]
+
+states.Inliner = Inliner
 
 # -- Options for HTML output ---------------------------------------------------
 
@@ -317,8 +352,6 @@ latex_documents = [
 # documents and includes the same brief description in both the HTML
 # and manual page outputs.
 
-from docutils import nodes
-from docutils.utils import unescape
 from docutils.transforms import frontmatter
 from sphinx.writers import manpage
 
diff --git a/doc/ext/traffic-server.py b/doc/ext/traffic-server.py
index bdfc321..c11a20d 100644
--- a/doc/ext/traffic-server.py
+++ b/doc/ext/traffic-server.py
@@ -26,8 +26,7 @@
     :license: Apache
 """
 
-from docutils import nodes, utils
-from docutils.parsers.rst.roles import set_classes
+from docutils import nodes
 from docutils.parsers import rst
 from docutils.parsers.rst import directives
 from sphinx.domains import Domain, ObjType, std
@@ -35,102 +34,6 @@ from sphinx.roles import XRefRole
 from sphinx.locale import l_, _
 import sphinx
 
-# Autolink for Trafficserver issues
-# Moved from doc/conf.py, now integrated into TS domain
-#
-# Two types of issues supported:
-# * Jira: for archive purpose only (after the Jira to Github move)
-# * Github: for new issues (after the Jira to Github move)
-#
-# Syntax:
-# :ts:jira:`XXXX` where XXXX is the issue number
-# :ts:github:`XXXX` where XXXX is the issue number
-#
-# Output
-# * Prefix issue number with 'TS-'
-# * Render HTML link:
-#   - either to https://issues.apache.org/jira/browse/TS-XXXX
-#   - or to https://github.com/apache/trafficserver/issues/XXXX
-
-def ts_jira_role(name, rawtext,  issue_num, lineno, inliner, options={}, content=[]):
-  """Link to a Trafficserver Jira issue.
-
-  Returns 2 part tuple containing list of nodes to insert into the
-  document and a list of system messages.  Both are allowed to be
-  empty.
-
-  :param name: The role name used in the document.
-  :param rawtext: The entire markup snippet, with role.
-  :param issue_num: The issue number marked with the role.
-  :param lineno: The line number where rawtext appears in the input.
-  :param inliner: The inliner instance that called us.
-  :param options: Directive options for customization.
-  :param content: The directive content for customization.
-  """
-  app = inliner.document.settings.env.app
-  try:
-    base_url = app.config.trafficserver_jira_url
-    if not base_url:
-      raise AttributeError
-  except AttributeError, err:
-    raise ValueError('trafficserver_jira_url configuration values not set (%s)' % str(err))
-  #
-  issue_prefix = 'TS-'
-  node = make_link_node(rawtext, app, base_url, issue_prefix, issue_num, options)
-  return [node], []
-
-def ts_github_role(name, rawtext,  issue_num, lineno, inliner, options={}, content=[]):
-  """Link to a Trafficserver Github issue.
-
-  Returns 2 part tuple containing list of nodes to insert into the
-  document and a list of system messages.  Both are allowed to be
-  empty.
-
-  :param name: The role name used in the document.
-  :param rawtext: The entire markup snippet, with role.
-  :param text: The text marked with the role.
-  :param lineno: The line number where rawtext appears in the input.
-  :param inliner: The inliner instance that called us.
-  :param options: Directive options for customization.
-  :param content: The directive content for customization.
-  """
-  app = inliner.document.settings.env.app
-  try:
-    base_url = app.config.trafficserver_github_url
-    if not base_url:
-      raise AttributeError
-  except AttributeError, err:
-    raise ValueError('trafficserver_github_url configuration values not set (%s)' % str(err))
-  #
-  issue_prefix = ''
-  node = make_link_node(rawtext, app, base_url, issue_prefix, issue_num, options)
-  return [node], []
-
-def make_link_node(rawtext, app, base_url, issue_prefix, issue_num, options):
-  """Create a link to a Apache Jira resource.
-
-  :param rawtext: Text being replaced with link node.
-  :param app: Sphinx application context
-  :param type: Link type ('jira' or 'github')
-  :param slug: ID of the thing to link to
-  :param options: Options dictionary passed to role func.
-  """
-  #
-  try:
-      issue_num_int = int(issue_num)
-      if issue_num_int <= 0:
-          raise ValueError
-  except ValueError:
-    raise ValueError('Trafficserver issue number must be a number greater than or equal to 1; '
-                     '"%s" is invalid.' % text, line=lineno)
-  #
-  base_url = base_url + issue_prefix + '{0}'
-  ref = base_url.format(issue_num)
-  set_classes(options)
-  node = nodes.reference(rawtext, issue_prefix + issue_num, refuri=ref,
-                         **options)
-  return node
-
 class TSConfVar(std.Target):
     """
     Description of a traffic server configuration variable.
@@ -370,10 +273,6 @@ class TSStatRef(XRefRole):
     def process_link(self, env, ref_node, explicit_title_p, title, target):
         return title, target
 
-class TSIssueRef(XRefRole):
-    def process_link(self, env, ref_node, explicit_title_p, title, target):
-        return 'TS-' + title, 'https://issues.apache.org/jira/browse/TS-' + target
-
 class TrafficServerDomain(Domain):
     """
     Apache Traffic Server Documentation.
@@ -385,8 +284,7 @@ class TrafficServerDomain(Domain):
 
     object_types = {
         'cv': ObjType(l_('configuration variable'), 'cv'),
-        'stat': ObjType(l_('statistic'), 'stat'),
-        'jira': ObjType(l_('jira'), 'jira')
+        'stat': ObjType(l_('statistic'), 'stat')
     }
 
     directives = {
@@ -396,21 +294,17 @@ class TrafficServerDomain(Domain):
 
     roles = {
         'cv' : TSConfVarRef(),
-        'stat' : TSStatRef(),
-        'jira' : ts_jira_role,
-        'github' : ts_github_role
+        'stat' : TSStatRef()
     }
 
     initial_data = {
         'cv' : {}, # full name -> docname
-        'stat' : {},
-        'issue' : {}
+        'stat' : {}
     }
 
     dangling_warnings = {
         'cv' : "No definition found for configuration variable '%(target)s'",
-        'stat' : "No definition found for statistic '%(target)s'",
-        'issue' : "No definition found for issue '%(target)s'"
+        'stat' : "No definition found for statistic '%(target)s'"
     }
 
     def clear_doc(self, docname):
@@ -422,10 +316,6 @@ class TrafficServerDomain(Domain):
         for var, doc in stat_list.items():
             if doc == docname:
                 del stat_list[var]
-        issue_list = self.data['issue']
-        for var, doc in issue_list.items():
-            if doc == docname:
-                del issue_list[var]
 
     def find_doc(self, key, obj_type):
         zret = None
@@ -434,8 +324,6 @@ class TrafficServerDomain(Domain):
             obj_list = self.data['cv']
         elif obj_type == 'stat' :
             obj_list = self.data['stat']
-        elif obj_type == 'issue' :
-            obj_list = self.data['issue']
         else:
             obj_list = None
 
@@ -445,20 +333,15 @@ class TrafficServerDomain(Domain):
         return zret
 
     def resolve_xref(self, env, src_doc, builder, obj_type, target, node, cont_node):
-        if obj_type == 'issue':
-            return sphinx.util.nodes.make_refnode(builder, src_doc, src_doc, nodes.make_id(target), cont_node, None)
-        else:
-            dst_doc = self.find_doc(target, obj_type)
-            if (dst_doc):
-                return sphinx.util.nodes.make_refnode(builder, src_doc, dst_doc, nodes.make_id(target), cont_node, 'records.config')
+        dst_doc = self.find_doc(target, obj_type)
+        if (dst_doc):
+            return sphinx.util.nodes.make_refnode(builder, src_doc, dst_doc, nodes.make_id(target), cont_node, 'records.config')
 
     def get_objects(self):
         for var, doc in self.data['cv'].iteritems():
             yield var, var, 'cv', doc, var, 1
         for var, doc in self.data['stat'].iteritems():
             yield var, var, 'stat', doc, var, 1
-        for var, doc in self.data['issue'].iteritems():
-            yield var, var, 'issue', doc, var, 1
 
 # These types are ignored as missing references for the C++ domain.
 # We really need to do better with this. Editing this file for each of
@@ -500,8 +383,6 @@ def setup(app):
     rst.roles.register_generic_role('const', nodes.literal)
 
     app.add_domain(TrafficServerDomain)
-    app.add_config_value('trafficserver_jira_url', None, 'env')
-    app.add_config_value('trafficserver_github_url', None, 'env')
 
     # Types that we want the C domain to consider built in
     for word in EXTERNAL_TYPES:

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

[trafficserver] 01/04: Revert "Fix nested role (not supported)"

Posted by js...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jsime pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 11bfc4b3a51c94c4ba891f66a6774a266339a464
Author: Jack Bates <ja...@nottheoilrig.com>
AuthorDate: Fri Jan 6 12:49:30 2017 -0700

    Revert "Fix nested role (not supported)"
    
    This reverts commit 9e374946a6700bf9766d011dadbc05891d92f058.
---
 doc/admin-guide/configuration/cache-basics.en.rst    | 2 +-
 doc/developer-guide/architecture/architecture.en.rst | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/admin-guide/configuration/cache-basics.en.rst b/doc/admin-guide/configuration/cache-basics.en.rst
index 8770e8a..497edcc 100644
--- a/doc/admin-guide/configuration/cache-basics.en.rst
+++ b/doc/admin-guide/configuration/cache-basics.en.rst
@@ -683,7 +683,7 @@ cases the content will be buffered in ram while waiting to be sent to the
 client. This could potentially also happen for ``POST`` requests if the client
 connection is fast and the origin server connection slow. If very large objects
 are being used this can cause the memory usage of Traffic Server to become
-very large (See issue :ts:jira:`1496`).
+`very large :ts:jira:`1496``_.
 
 This problem can be ameliorated by controlling the amount of buffer space used
 by a transaction. A high water and low water mark are set in terms of bytes
diff --git a/doc/developer-guide/architecture/architecture.en.rst b/doc/developer-guide/architecture/architecture.en.rst
index ec2e32c..497e1b5 100644
--- a/doc/developer-guide/architecture/architecture.en.rst
+++ b/doc/developer-guide/architecture/architecture.en.rst
@@ -1147,8 +1147,8 @@ including the size of each stripe.
 
 .. [#store-disk-array]
 
-   Work is under way on extending this to include objects that are in the
-   memory cache. (See issue :ts:jira:`2020`)
+   `Work is under way :ts:jira:`2020``_ on
+   extending this to include objects that are in the memory cache.
 
 .. [#coalesced-spans]
 

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

[trafficserver] 02/04: Revert "Fix documentation build for docutils 0.13.1 (2/2)"

Posted by js...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jsime pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit ffc906a25e156f8dd4ac57f284893878b853c189
Author: Jack Bates <ja...@nottheoilrig.com>
AuthorDate: Fri Jan 6 12:49:42 2017 -0700

    Revert "Fix documentation build for docutils 0.13.1 (2/2)"
    
    This reverts commit f3e37f8e104a74700b35816e50f32f95ee436741.
---
 doc/admin-guide/configuration/cache-basics.en.rst                     | 2 +-
 doc/admin-guide/files/records.config.en.rst                           | 2 +-
 doc/developer-guide/api/functions/TSHttpTxnClientPacketMarkSet.en.rst | 2 +-
 doc/developer-guide/api/functions/TSHttpTxnClientPacketTosSet.en.rst  | 2 +-
 doc/developer-guide/api/functions/TSHttpTxnServerPacketMarkSet.en.rst | 2 +-
 doc/developer-guide/api/functions/TSHttpTxnServerPacketTosSet.en.rst  | 2 +-
 doc/developer-guide/api/functions/TSLifecycleHookAdd.en.rst           | 2 +-
 doc/developer-guide/architecture/architecture.en.rst                  | 4 ++--
 doc/developer-guide/architecture/consistency.en.rst                   | 2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/doc/admin-guide/configuration/cache-basics.en.rst b/doc/admin-guide/configuration/cache-basics.en.rst
index 497edcc..7351d1e 100644
--- a/doc/admin-guide/configuration/cache-basics.en.rst
+++ b/doc/admin-guide/configuration/cache-basics.en.rst
@@ -683,7 +683,7 @@ cases the content will be buffered in ram while waiting to be sent to the
 client. This could potentially also happen for ``POST`` requests if the client
 connection is fast and the origin server connection slow. If very large objects
 are being used this can cause the memory usage of Traffic Server to become
-`very large :ts:jira:`1496``_.
+`very large <https://issues.apache.org/jira/browse/TS-1496>`_.
 
 This problem can be ameliorated by controlling the amount of buffer space used
 by a transaction. A high water and low water mark are set in terms of bytes
diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 58b2667..84d42cc 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1091,7 +1091,7 @@ ip-resolve
          performed. The result is cached (if allowed otherwise). This option is
          vulnerable to cache poisoning if an incorrect ``Host`` header is
          specified, so this option should be used with extreme caution.  See
-         bug :ts:jira:`2954` for details.
+         bug TS-2954 for details.
    ===== ======================================================================
 
    If all of these conditions are met, then the origin server IP address is
diff --git a/doc/developer-guide/api/functions/TSHttpTxnClientPacketMarkSet.en.rst b/doc/developer-guide/api/functions/TSHttpTxnClientPacketMarkSet.en.rst
index 0272a27..437f528 100644
--- a/doc/developer-guide/api/functions/TSHttpTxnClientPacketMarkSet.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpTxnClientPacketMarkSet.en.rst
@@ -41,4 +41,4 @@ See Also
 
 .. _Traffic Shaping:
                  https://cwiki.apache.org/confluence/display/TS/Traffic+Shaping
-   :ts:cv:`proxy.config.net.sock_packet_mark_in` and :ts:jira:`1090`
+   :ts:cv:`proxy.config.net.sock_packet_mark_in` and TS-1090
diff --git a/doc/developer-guide/api/functions/TSHttpTxnClientPacketTosSet.en.rst b/doc/developer-guide/api/functions/TSHttpTxnClientPacketTosSet.en.rst
index d5f1f3a..f1b694b 100644
--- a/doc/developer-guide/api/functions/TSHttpTxnClientPacketTosSet.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpTxnClientPacketTosSet.en.rst
@@ -47,4 +47,4 @@ See Also
 
 .. _Traffic Shaping:
                  https://cwiki.apache.org/confluence/display/TS/Traffic+Shaping
-   :ts:cv:`proxy.config.net.sock_packet_tos_in` and :ts:jira:`1090`
+   :ts:cv:`proxy.config.net.sock_packet_tos_in` and TS-1090
diff --git a/doc/developer-guide/api/functions/TSHttpTxnServerPacketMarkSet.en.rst b/doc/developer-guide/api/functions/TSHttpTxnServerPacketMarkSet.en.rst
index 28c4c0d..af31dd8 100644
--- a/doc/developer-guide/api/functions/TSHttpTxnServerPacketMarkSet.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpTxnServerPacketMarkSet.en.rst
@@ -45,4 +45,4 @@ See Also
 
 .. _Traffic Shaping:
                  https://cwiki.apache.org/confluence/display/TS/Traffic+Shaping
-   :ts:cv:`proxy.config.net.sock_packet_mark_out` and :ts:jira:`1090`
+   :ts:cv:`proxy.config.net.sock_packet_mark_out` and TS-1090
diff --git a/doc/developer-guide/api/functions/TSHttpTxnServerPacketTosSet.en.rst b/doc/developer-guide/api/functions/TSHttpTxnServerPacketTosSet.en.rst
index 60a7f3d..c412be1 100644
--- a/doc/developer-guide/api/functions/TSHttpTxnServerPacketTosSet.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpTxnServerPacketTosSet.en.rst
@@ -49,4 +49,4 @@ See Also
 
 .. _Traffic Shaping:
                  https://cwiki.apache.org/confluence/display/TS/Traffic+Shaping
-   :ts:cv:`proxy.config.net.sock_packet_tos_out` and :ts:jira:`1090`
+   :ts:cv:`proxy.config.net.sock_packet_tos_out` and TS-1090
diff --git a/doc/developer-guide/api/functions/TSLifecycleHookAdd.en.rst b/doc/developer-guide/api/functions/TSLifecycleHookAdd.en.rst
index 45c7313..24ef96d 100644
--- a/doc/developer-guide/api/functions/TSLifecycleHookAdd.en.rst
+++ b/doc/developer-guide/api/functions/TSLifecycleHookAdd.en.rst
@@ -162,7 +162,7 @@ History
 =======
 
 Lifecycle hooks were introduced to solve process initialization ordering issues
-:ts:jira:`1487`. Different API calls required different modules of |TS| to be
+(TS-1487). Different API calls required different modules of |TS| to be
 initialized for the call to work, but others did not work that late in
 initialization, which was problematic because all of them could effectively
 only be called from :func:`TSPluginInit` . The solution was to move
diff --git a/doc/developer-guide/architecture/architecture.en.rst b/doc/developer-guide/architecture/architecture.en.rst
index 497e1b5..a38a1a5 100644
--- a/doc/developer-guide/architecture/architecture.en.rst
+++ b/doc/developer-guide/architecture/architecture.en.rst
@@ -1147,12 +1147,12 @@ including the size of each stripe.
 
 .. [#store-disk-array]
 
-   `Work is under way :ts:jira:`2020``_ on
+   `Work is under way <https://issues.apache.org/jira/browse/TS-2020>`_ on
    extending this to include objects that are in the memory cache.
 
 .. [#coalesced-spans]
 
    This linked list is mostly ignored in later processing, causing all but one
    file or directory storage units on the same device to be ignored. See
-   :ts:jira:`1869`.
+   `TS-1869 <https://issues.apache.org/jira/browse/TS-1869>`_.
 
diff --git a/doc/developer-guide/architecture/consistency.en.rst b/doc/developer-guide/architecture/consistency.en.rst
index 413cff5..c5d5faf 100644
--- a/doc/developer-guide/architecture/consistency.en.rst
+++ b/doc/developer-guide/architecture/consistency.en.rst
@@ -59,7 +59,7 @@ Volume Tagging
 ~~~~~~~~~~~~~~
 
 Currently, :term:`cache volumes <cache volume>` are allocated somewhat
-arbitrarily from storage elements. `This enhancement :ts:jira:`1728``__
+arbitrarily from storage elements. `This enhancement <https://issues.apache.org/jira/browse/TS-1728>`__
 allows :file:`storage.config` to assign :term:`storage units <storage unit>` to
 specific :term:`volumes <cache volume>` although the volumes must still be
 listed in :file:`volume.config` in general and in particular to map domains to

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

[trafficserver] 04/04: TS-5107: Changes to autolinking in Docutils 0.13

Posted by js...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jsime pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 111e7f5b831298cb4cba446c362cfa450e83e99d
Author: Jack Bates <ja...@nottheoilrig.com>
AuthorDate: Fri Jan 6 12:55:44 2017 -0700

    TS-5107: Changes to autolinking in Docutils 0.13
    
    init_customizations() was added in Docutils 0.13.
---
 doc/conf.py | 51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 40 insertions(+), 11 deletions(-)

diff --git a/doc/conf.py b/doc/conf.py
index 8ee27b8..7a1ae44 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -165,25 +165,54 @@ pygments_style = 'sphinx'
 
 nitpicky=1
 
-# Autolink issue references
+# Autolink issue references.
+# See Customizing the Parser in the docutils.parsers.rst module.
 
 from docutils import nodes
 from docutils.parsers.rst import states
+from docutils.utils import punctuation_chars
 from docutils.utils import unescape
 
 # Customize parser.inliner in the only way that Sphinx supports.
 # docutils.parsers.rst.Parser takes an instance of states.Inliner or a
-# subclass but Sphinx initializes it from
-# SphinxStandaloneReader.set_parser('restructuredtext') which is called
-# from Publisher.set_components() and initializes the parser without
-# arguments.
+# subclass, but Sphinx initializes the parser without any arguments,
+# in SphinxStandaloneReader.set_parser('restructuredtext'),
+# which is called from Publisher.set_components().
 
+# states.Inliner isn't a new-style class, so super() isn't an option.
 BaseInliner = states.Inliner
-class Inliner(BaseInliner):
-  def __init__(self):
-    BaseInliner.__init__(self)
-
-    issue_pattern = re.compile(u'''
+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):
+    issue = re.compile(
+      ur'''
       {start_string_prefix}
       TS-\d+
       {end_string_suffix}'''.format(
@@ -191,7 +220,7 @@ class Inliner(BaseInliner):
         end_string_suffix=self.end_string_suffix),
       re.VERBOSE | re.UNICODE)
 
-    self.implicit_dispatch.append((issue_pattern, self.issue_reference))
+    self.implicit_dispatch.append((issue, self.issue_reference))
 
   def issue_reference(self, match, lineno):
     text = match.group(0)

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