Georg Brandl  committed 9ce528f

Activate oldcmarkup by default, but warn when the markup is used.

  • Participants
  • Parent commits b347bac

Comments (0)

Files changed (3)

   - JavaScript
   - reStructuredText
-* The old markup for defining and linking to C directives will not work
-  anymore without activating the :mod:`~sphinx.ext.oldcmarkup`
-  extension.
+* The old markup for defining and linking to C directives is now
+  deprecated.  It will not work anymore in future versions without
+  activating the :mod:`~sphinx.ext.oldcmarkup` extension; in Sphinx
+  1.0, it is activated by default.
 * Removed support for old dependency versions; requirements are now:

File sphinx/

         if self.confdir is None:
             self.confdir = self.srcdir
-        # load all extension modules
+        # backwards compatibility: activate old C markup
+        self.setup_extension('sphinx.ext.oldcmarkup')
+        # load all user-given extension modules
         for extension in self.config.extensions:
         # the config file itself can be an extension

File sphinx/ext/

 from sphinx.util.compat import Directive
+_warned_oldcmarkup = False
+WARNING_MSG = 'using old C markup; please migrate to new-style markup ' \
+              '(e.g. c:function instead of cfunction), see ' \
+              ''
 class OldCDirective(Directive):
     has_content = True
     def run(self):
         env = self.state.document.settings.env
+        if not
+            env.warn(env.docname, WARNING_MSG, self.lineno)
+   = True
         newname = 'c:' +[1:]
         newdir = env.lookup_domain_element('directive', newname)[0]
         return newdir(newname, self.arguments, self.options,
 def old_crole(typ, rawtext, text, lineno, inliner, options={}, content=[]):
     env = inliner.document.settings.env
+    if not
+        env.warn(env.docname, WARNING_MSG)
+ = True
     newtyp = 'c:' + typ[1:]
     newrole = env.lookup_domain_element('role', newtyp)[0]
     return newrole(newtyp, rawtext, text, lineno, inliner, options, content)
 def setup(app):
+    app._oldcmarkup_warned = False
     app.add_directive('cfunction', OldCDirective)
     app.add_directive('cmember', OldCDirective)
     app.add_directive('cmacro', OldCDirective)