88STEP_START = 'STEP_START'
99STEP_END = 'STEP_END'
1010EXAMPLE = 'EXAMPLE:'
11+ BINDER_ID = 'BINDER_ID'
1112GO_OUTPUT = 'Output:'
1213TEST_MARKER = {
1314 'java' : '@Test' ,
@@ -45,6 +46,7 @@ class Example(object):
4546 hidden = None
4647 highlight = None
4748 named_steps = None
49+ binder_id = None
4850
4951 def __init__ (self , language : str , path : str ) -> None :
5052 logging .debug ("ENTERING: " )
@@ -59,6 +61,7 @@ def __init__(self, language: str, path: str) -> None:
5961 self .hidden = []
6062 self .highlight = []
6163 self .named_steps = {}
64+ self .binder_id = None
6265 self .make_ranges ()
6366 self .persist (self .path )
6467 logging .debug ("EXITING: " )
@@ -88,6 +91,7 @@ def make_ranges(self) -> None:
8891 rstart = re .compile (f'{ PREFIXES [self .language ]} \\ s?{ REMOVE_START } ' )
8992 rend = re .compile (f'{ PREFIXES [self .language ]} \\ s?{ REMOVE_END } ' )
9093 exid = re .compile (f'{ PREFIXES [self .language ]} \\ s?{ EXAMPLE } ' )
94+ binder = re .compile (f'{ PREFIXES [self .language ]} \\ s?{ BINDER_ID } \\ s+([a-f0-9]{{40}})' )
9195 go_output = re .compile (f'{ PREFIXES [self .language ]} \\ s?{ GO_OUTPUT } ' )
9296 go_comment = re .compile (f'{ PREFIXES [self .language ]} ' )
9397 test_marker = re .compile (f'{ TEST_MARKER .get (self .language )} ' )
@@ -150,6 +154,13 @@ def make_ranges(self) -> None:
150154 elif re .search (exid , l ):
151155 output = False
152156 pass
157+ elif re .search (binder , l ):
158+ # Extract BINDER_ID hash value
159+ match = re .search (binder , l )
160+ if match :
161+ self .binder_id = match .group (1 )
162+ logging .debug (f'Found BINDER_ID: { self .binder_id } in { self .path } :L{ curr + 1 } ' )
163+ output = False
153164 elif self .language == "go" and re .search (go_output , l ):
154165 if output :
155166 logging .error ("Nested Go Output anchor in {self.path}:L{curr+1} - aborting." )
0 commit comments