Skip to content

Commit ea63311

Browse files
committed
Remove bad c2rst and fix the other for sphinx 1.7.1
1 parent 737007c commit ea63311

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

c2rst.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# If extensions (or modules to document with autodoc) are in another directory,
2222
# add these directories to sys.path here. If the directory is relative to the
2323
# documentation root, use os.path.abspath to make it absolute, like shown here.
24+
sys.path.insert(0, os.path.abspath('docs'))
2425
sys.path.insert(0, os.path.abspath('.'))
2526

2627
master_doc = 'docs/index'

docs/c2rst.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import sphinx.parsers
2-
import docutils.parsers.rst as rst
32

43
class CStrip(sphinx.parsers.Parser):
5-
def __init(self):
6-
self.rst_parser = rst.Parser()
4+
def __init__(self):
5+
self.rst_parser = sphinx.parsers.RSTParser()
76

8-
def parse(self, inputstring, document):
9-
print(inputstring)
10-
self.rst_parser(stripped, document)
7+
def parse(self, inputstring, document):
8+
# This setting is missing starting with Sphinx 1.7.1 so we set it ourself.
9+
document.settings.tab_width = 4
10+
stripped = []
11+
for line in inputstring.split("\n"):
12+
line = line.strip()
13+
if line == "//|":
14+
stripped.append("")
15+
elif line.startswith("//| "):
16+
stripped.append(line[len("//| "):])
17+
stripped = "\r\n".join(stripped)
18+
self.rst_parser.parse(stripped, document)

0 commit comments

Comments
 (0)