mirror of https://gitee.com/bigwinds/arangodb
Fixed a small bug in the python script
This commit is contained in:
parent
2b3c686e42
commit
01c2770030
|
@ -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
|
||||
|
|
|
@ -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("<br />","\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()
|
||||
|
|
Loading…
Reference in New Issue