📄 run.py.~1.6.~
字号:
#!/usr/bin/pythonimport os,re,systry: lang = str(sys.argv[1])except IndexError: lang=""print "lang: " + langif (not(lang == '')): langsuffix = "_" + lang langparam = "lang=" + lang langsuffixparam = "langsuffix=" + langsuffixelse: langsuffix = "" langparam = "" langsuffixparam = ""if re.compile("Python\Z").search(os.getcwd()): os.chdir("..") os.chdir("ExampleSources" + langsuffix)data=''for f in os.listdir("."): if not(re.compile("\.xml\Z").search(f)): continue input=open(f) data = data + input.read() input.close()os.chdir('..')### data=re.compile('<description lang="cs">.*?</description>',re.S).sub('',data)output=open("Data" + langsuffix + "/source.xml","w")sys.stdout = outputprint """<!-- generated by run.py --><!DOCTYPE allExamples [ <!ENTITY eacute 'é'> <!ENTITY ugrave 'ù'> <!ENTITY agrave 'à'> <!ENTITY egrave 'è'> <!ENTITY ograve 'ò'> <!ENTITY icirc 'î'> <!ENTITY ecirc 'ê'> <!ENTITY ccedil 'ç'>]><allExamples>"""print dataprint "</allExamples>"output.close()sys.stdout = sys.__stdout__command = "saxonclient -o General" + langsuffix + "/contents.html Data" + langsuffix + "/source.xml XSL/stylesheet.xsl pwd=${PWD}/ " + langparam +" "+ langsuffixparamprint "command: " + commandos.system(command)os.chdir("Output" + langsuffix)def aaa(hit):# print hit.group(2) text = re.compile("\n",re.S).sub('<br>',hit.group(2)) text = re.compile(" ",re.S).sub(' ',text) text = re.compile("\t",re.S).sub(' ',text) text = re.compile("span class",re.S).sub('span class',text)# print text return hit.group(1) + text +hit.group(3)for f in os.listdir("."):# print "file " + f if not(re.compile("\.html\Z").search(f)): continue input=open(f) data = input.read() input.close() data=re.compile('(<td class="doc">)(.*?)(</td>)',re.S).sub(aaa,data) output=open(f,'w') output.write(data) output.close()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -