mirror of https://gitee.com/bigwinds/arangodb
52 lines
3.5 KiB
Python
52 lines
3.5 KiB
Python
import sys
|
|
import re
|
|
import os
|
|
|
|
def walk_on_files(dirpath, newVersionNumber):
|
|
for root, dirs, files in os.walk(dirpath):
|
|
for file in files:
|
|
if file.endswith(".html"):
|
|
full_path= os.path.join(root, file)
|
|
replaceCode(full_path, newVersionNumber)
|
|
return
|
|
|
|
def replaceCode(pathOfFile, newVersionNumber):
|
|
f=open(pathOfFile,"rU")
|
|
if f:
|
|
s=f.read()
|
|
f.close()
|
|
f=open(pathOfFile,'w')
|
|
lines = s.replace("<a href=\"../Blueprint-Graphs/README.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../Blueprint-Graphs/README.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../Blueprint-Graphs/VertexMethods.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../Blueprint-Graphs/VertexMethods.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../Blueprint-Graphs/GraphConstructor.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../Blueprint-Graphs/GraphConstructor.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../Blueprint-Graphs/EdgeMethods.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../Blueprint-Graphs/EdgeMethods.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../HttpGraphs/README.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../HttpGraphs/README.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../HttpGraphs/Vertex.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../HttpGraphs/Vertex.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../HttpGraphs/Edge.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../HttpGraphs/Edge.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../ModuleGraph/README.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../ModuleGraph/README.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../ModuleGraph/GraphConstructor.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../ModuleGraph/GraphConstructor.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../ModuleGraph/VertexMethods.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../ModuleGraph/VertexMethods.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
lines = lines.replace("<a href=\"../ModuleGraph/EdgeMethods.html\">","<a style=\"color:rgba(240,210,0,1)\" href=\"../ModuleGraph/EdgeMethods.html\"><i class=\"fa fa-exclamation-triangle\"></i> ")
|
|
#lines = lines.replace("!CHAPTER","#")
|
|
lines = re.sub("!CHAPTER\s+" + "(.*)", r"<h1>\g<1></h1>", lines)
|
|
#lines = lines.replace("!SECTION","##")
|
|
lines = re.sub("!SECTION\s+" + "(.*)", r"<h2>\g<1></h2>", lines)
|
|
#lines = lines.replace("!SUBSECTION","###")
|
|
lines = re.sub("!SUBSECTION\s+" + "(.*)", r"<h3>\g<1></h3>", lines)
|
|
#lines = lines.replace("!SUBSUBSECTION","####")
|
|
lines = re.sub("!SUBSUBSECTION\s+" + "(.*)", r"<h4>\g<1></h4>", lines)
|
|
lines = lines.replace("VERSION_NUMBER", newVersionNumber)
|
|
f.write(lines)
|
|
f.close()
|
|
|
|
if __name__ == '__main__':
|
|
path = ["Documentation/Books/books/Users"]
|
|
g = open(os.path.abspath(os.path.join(os.path.dirname( __file__ ), os.pardir, "ArangoDB/../../VERSION")))
|
|
if g:
|
|
newVersionNumber=g.read()
|
|
g.close
|
|
for i in path:
|
|
dirpath = os.path.abspath(os.path.join(os.path.dirname( __file__ ), os.pardir,"ArangoDB/../../"+i))
|
|
print "Tagging deprecated files"
|
|
walk_on_files(dirpath, newVersionNumber)
|