Georg Brandl avatar Georg Brandl committed 4f2aaa4

Register custom roles as local, saves system_messages which can cause problems e.g. in .. |abc| replace:: :role:`foo`

Comments (0)

Files changed (2)

sphinx/application.py

         directives.register_directive(name, func)
 
     def add_role(self, name, role):
-        roles.register_canonical_role(name, role)
+        roles.register_local_role(name, role)
 
     def add_description_unit(self, directivename, rolename, indextemplate='',
                              parse_node=None, ref_nodeclass=None):
         additional_xref_types[directivename] = (rolename, indextemplate, parse_node)
         directives.register_directive(directivename, desc_directive)
-        roles.register_canonical_role(rolename, xfileref_role)
+        roles.register_local_role(rolename, xfileref_role)
         if ref_nodeclass is not None:
             innernodetypes[rolename] = ref_nodeclass
 
                           ref_nodeclass=None):
         additional_xref_types[directivename] = (rolename, indextemplate, None)
         directives.register_directive(directivename, target_directive)
-        roles.register_canonical_role(rolename, xfileref_role)
+        roles.register_local_role(rolename, xfileref_role)
         if ref_nodeclass is not None:
             innernodetypes[rolename] = ref_nodeclass
 
 }
 
 for rolename, nodeclass in generic_docroles.iteritems():
-    roles.register_generic_role(rolename, nodeclass)
+    role = roles.GenericRole(rolename, nodeclass)
+    roles.register_local_role(rolename, role)
 
 
 def indexmarkup_role(typ, rawtext, etext, lineno, inliner, options={}, content=[]):
         rn += sn
         return [indexnode, targetnode, rn], []
 
-roles.register_canonical_role('envvar', indexmarkup_role)
+roles.register_local_role('envvar', indexmarkup_role)
 roles.register_local_role('pep', indexmarkup_role)
 roles.register_local_role('rfc', indexmarkup_role)
 
 }
 
 for rolename, func in specific_docroles.iteritems():
-    roles.register_canonical_role(rolename, func)
+    roles.register_local_role(rolename, func)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.