From patchwork Thu Apr 30 13:34:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mcnamara, John" X-Patchwork-Id: 4556 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 2DAA2CB40; Thu, 30 Apr 2015 15:34:39 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C1262CB3A for ; Thu, 30 Apr 2015 15:34:36 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 30 Apr 2015 06:34:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,677,1422950400"; d="scan'208";a="721622257" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by orsmga002.jf.intel.com with ESMTP; 30 Apr 2015 06:34:16 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.76]) by IRSMSX152.ger.corp.intel.com ([169.254.6.7]) with mapi id 14.03.0224.002; Thu, 30 Apr 2015 14:34:15 +0100 From: "Mcnamara, John" To: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH 0/2] doc: refactored fig and table nums into references Thread-Index: AQHQfpA8J0zr7EQ+/ESRicUEUY/zUJ1kIMIAgAFk/JA= Date: Thu, 30 Apr 2015 13:34:15 +0000 Message-ID: References: <1429881109-16684-1-git-send-email-john.mcnamara@intel.com> <4018323.hxXVqqSkHq@xps13> In-Reply-To: <4018323.hxXVqqSkHq@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 0/2] doc: refactored fig and table nums into references X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, April 29, 2015 5:13 PM > To: Mcnamara, John > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 0/2] doc: refactored fig and table nums > into references > > is really a great work but I think it's not reasonnable to require > sphinx 1.3. As almost nobody is using this version, it would be equivalent > to prevent users and developers to generate the doc by themselves. Hi Thomas, Yes. That is probably right. > It produces this error: > ERROR: Unknown interpreted text role "numref". > > Do you think it's possible to implement a fallback in our conf.py in order > to ignore this new role if not supported? It would be possible but a full implementation probably wouldn't be worth it. We could add a workaround like the following to conf.py that would just render the figure/table ref numbers as the target name as a fallback. That would allow people to generate the docs with older versions of sphinx: $ git diff doc/guides/conf.py That is just a workaround though, and maybe not worth it either. P.S. Also note, Sphinx 1.3.1 has a nice but very different default Html style. John diff --git a/doc/guides/conf.py b/doc/guides/conf.py index 1bc031f..bbf40f1 100644 --- a/doc/guides/conf.py +++ b/doc/guides/conf.py @@ -82,3 +82,16 @@ class CustomLatexFormatter(LatexFormatter): # Replace the default latex formatter. PygmentsBridge.latex_formatter = CustomLatexFormatter + +from docutils import nodes +from distutils.version import LooseVersion +from sphinx import __version__ as sphinx_version + +# Workaround to ignore :numref: in older versions of Sphinx. +def setup(app): + + if LooseVersion(sphinx_version) < LooseVersion('1.3.1'): + print('[dpdk docs] Upgrade sphinx to version >= 1.3.1 for ' + 'improved Figure/Table number handling.') + app.add_generic_role('numref', nodes.emphasis) +