From 01c2770030bc4df19d89be787e507b49568716e8 Mon Sep 17 00:00:00 2001 From: Thomas Schmidts Date: Wed, 18 Jun 2014 16:52:35 +0200 Subject: [PATCH] Fixed a small bug in the python script --- Documentation/Books/Makefile | 2 ++ Documentation/Books/bot.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/Books/Makefile b/Documentation/Books/Makefile index 61aa92cf0d..b10d72c117 100644 --- a/Documentation/Books/Makefile +++ b/Documentation/Books/Makefile @@ -17,6 +17,8 @@ build-books: md-files build-book: @test -d books/$(NAME) || mkdir books/$(NAME) + python codeBlockReader.py python bot.py cd $(NAME) && gitbook build -o ../books/$(NAME) cp Users/Arangodb_Logo.png books/Users/ + @for file in $(basename $(MD_FILES)); do echo "remove $${file}.md";rm $${file}.md;done diff --git a/Documentation/Books/bot.py b/Documentation/Books/bot.py index b0f8906db5..409d900657 100644 --- a/Documentation/Books/bot.py +++ b/Documentation/Books/bot.py @@ -23,9 +23,10 @@ def findStartCode(textFile,full_path): def getTextFromSourceFile(searchText, full_path): f=open("allComments.txt", 'rU') s=f.read() - match = re.search(r'@startDocuBlock\s+'+re.escape(searchText)+'(.+?)@endDocuBlock', s,re.DOTALL) + match = re.search(r'@startDocuBlock\s+'+ searchText + "(?:\s+|$)" +'(.+?)@endDocuBlock', s,re.DOTALL) if match: textExtracted = match.group(1) + textExtracted = textExtracted.replace("
","\n") replaceText(textExtracted, full_path, searchText) def replaceText(text, pathOfFile, searchText): @@ -35,7 +36,7 @@ def replaceText(text, pathOfFile, searchText): f.close() f=open(pathOfFile,'w') - replaced=re.sub('@startDocuBlock\s+'+ searchText + "(?:\s+|$)",text,s) + replaced=re.sub("@startDocuBlock\s+"+ searchText + "(?:\s+|$)",text,s) f.write(replaced) f.close()