From 20cc96096fb907f643a8a817c0749f00fa17a74a Mon Sep 17 00:00:00 2001 From: Willi Goesgens Date: Fri, 7 Aug 2015 11:45:07 +0200 Subject: [PATCH] Add checks whether inline example replacers fail to snap on the right end --- Documentation/Books/generateMdFiles.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/Books/generateMdFiles.py b/Documentation/Books/generateMdFiles.py index 32d4d3eb99..270a9c1bd9 100644 --- a/Documentation/Books/generateMdFiles.py +++ b/Documentation/Books/generateMdFiles.py @@ -121,7 +121,19 @@ def replaceTextInline(text, pathOfFile, searchText): print '*' * 80 print text exit(1) - return re.sub(r' *@startDocuBlockInline\s+'+ searchText +'.*@endDocuBlock\s' + searchText, dokuBlocks[1][searchText], text, flags=re.DOTALL) + rePattern = r'\s*@startDocuBlockInline\s+'+ searchText +'.*@endDocuBlock\s' + searchText + match = re.search(rePattern, text, flags=re.DOTALL); + + if (match == None): + print "failed to match with '%s' for %s in file %s in: \n%s" % (rePattern, searchText, pathOfFile, text) + exit(1) + + subtext = match.group(0) + if (len(re.findall('@startDocuBlock', subtext)) > 1): + print "failed to snap with '%s' on end docublock for %s in %s our match is:\n%s" % (rePattern, searchText, pathOfFile, subtext) + exit(1); + + return re.sub(rePattern, dokuBlocks[1][searchText], text, flags=re.DOTALL) ################################################################################ # Read the docublocks into memory