docs/test2rst.py
changeset 2960 1a4f26eec0af
parent 2959 ef361938dfa1
child 4801 16c1398b0063
--- 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