[PATCH 07/10] doc: allow .md with py3-sphinx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The current support for markdown source files is fine
for py2-sphinx but not for py3.

Fix it by checking python's version and add the reference
to the mardown parser module accordingly.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 Documentation/conf.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 0e475c07e..b1d2694a6 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -17,7 +17,7 @@
 
 #
 # import os
-# import sys
+import sys
 import datetime
 
 # -- General configuration ------------------------------------------------
@@ -32,9 +32,16 @@ import datetime
 extensions = [
 ]
 
-source_parsers = {
-   '.md': 'recommonmark.parser.CommonMarkParser',
-}
+# support .md with python2 & python3
+if sys.version_info[0] > 2:
+    from recommonmark.parser import CommonMarkParser
+    source_parsers = {
+        '.md': CommonMarkParser,
+    }
+else:
+    source_parsers = {
+        '.md': 'recommonmark.parser.CommonMarkParser',
+    }
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['templates']
-- 
2.16.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux