1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
From 34a08ad7e3321f36a1258cc11090c5d3a2ba8649 Mon Sep 17 00:00:00 2001
From: Takeshi KOMIYA <i.tkomiya@gmail.com>
Date: Thu, 7 Jun 2018 21:54:03 +0900
Subject: [PATCH] Fix #5016: crashed when recommonmark.AutoStrictify is enabled
---
sphinx/io.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sphinx/io.py b/sphinx/io.py
index 8f1da22bd..4cb59c90e 100644
--- a/sphinx/io.py
+++ b/sphinx/io.py
@@ -13,6 +13,7 @@ import re
from docutils.core import Publisher
from docutils.io import FileInput, NullOutput
+from docutils.parsers.rst import Parser as RSTParser
from docutils.readers import standalone
from docutils.statemachine import StringList, string2lines
from docutils.writers import UnfilteredWriter
@@ -282,6 +283,13 @@ def read_doc(app, env, filename):
source = input_class(app, env, source=None, source_path=filename,
encoding=env.config.source_encoding)
parser = app.registry.create_source_parser(app, filename)
+ if parser.__class__.__name__ == 'CommonMarkParser' and parser.settings_spec == ():
+ # a workaround for recommonmark
+ # If recommonmark.AutoStrictify is enabled, the parser invokes reST parser
+ # internally. But recommonmark-0.4.0 does not provide settings_spec for reST
+ # parser. As a workaround, this copies settings_spec for RSTParser to the
+ # CommonMarkParser.
+ parser.settings_spec = RSTParser.settings_spec
pub = Publisher(reader=reader,
parser=parser,
--
2.18.0
|