--- a/docs/test2rst.py Thu Sep 21 10:45:27 2017 +0200
+++ b/docs/test2rst.py Thu Sep 21 16:55:17 2017 +0200
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+import re
import os
import os.path as op
import sys
@@ -12,6 +13,13 @@
:maxdepth: 1
'''
+ignored_patterns = [
+ re.compile('^#if'),
+ re.compile('^#else'),
+ re.compile('^#endif'),
+ re.compile('#rest-ignore$'),
+]
+
def rstify(orig, name):
newlines = []
@@ -28,8 +36,12 @@
sphinx_directive_mode = False
continue
- # Ignore line
- if line.endswith('#rest-ignore'):
+ ignored = False
+ for pattern in ignored_patterns:
+ if pattern.search(line):
+ ignored = True
+ break
+ if ignored:
continue
# Sphinx directives mode