Loading sustech-setup.tex +6 −6 Changes for sustech-setup.tex: 6 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -107,14 +107,14 @@ %%%%%% 顺序编码制的文献引用形式 %%%%%% 参考文献编译方式二选一,不要同时开启。 %%%% 选择一:使用 BibTeX + natbib 宏包 % \usepackage[sort&compress]{gbt7714} % \citestyle{super} % 全局上标数字模式,中文主体采用 % % \citestyle{numbers} % 全局行间数字模式,英文主体采用 % \bibliographystyle{sustechthesis-numeric} \usepackage[sort&compress]{gbt7714} \citestyle{super} % 全局上标数字模式,中文主体采用 % \citestyle{numbers} % 全局行间数字模式,英文主体采用 \bibliographystyle{sustechthesis-numeric} %%%% 选择二:使用 BibLaTeX 宏包(兼容性不佳,不太推荐) \usepackage[backend=biber,style=gb7714-2015,gbalign=left]{biblatex} \addbibresource{ref/refs.bib} % 声明 BibLaTeX 的数据库 % \usepackage[backend=biber,style=gb7714-2015,gbalign=left]{biblatex} % \addbibresource{ref/refs.bib} % 声明 BibLaTeX 的数据库 % 定义所有的图片文件在 figures 子目录下 \graphicspath{{figures/}} Loading sustechthesis-example.tex +2 −2 Changes for sustechthesis-example.tex: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -67,8 +67,8 @@ % 参考文献 % \bibliography{ref/refs} % 参考文献使用 BibTeX 编译 \printbibliography % 参考文献使用 BibLaTeX 编译(兼容性不佳,不太推荐) \bibliography{ref/refs} % 参考文献使用 BibTeX 编译 % \printbibliography % 参考文献使用 BibLaTeX 编译(兼容性不佳,不太推荐) % 附录 \appendix Loading test/test-files.py +36 −0 Changes for test/test-files.py: 36 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -25,6 +25,30 @@ def change_line(filename, old, new): rollback(filename, mode=0) def comment_line(filename, pattern, action): try: rollback(filename, mode=1) with open(filename, "r", encoding="utf-8") as f1: with open(f"{filename}.part", "w", encoding="utf-8") as f2: for line in f1: if re.findall(pattern, line): print(line) if action: line = f"% {line}" else: line = re.sub("^[%\s]+", "", line) f2.write(line) print(line) else: f2.write(line) os.remove(filename) os.rename(f"{filename}.part", filename) except: rollback(filename, mode=2) finally: rollback(filename, mode=0) def rollback(filename, mode): if mode == 1: # running 1 Loading Loading @@ -57,3 +81,15 @@ if __name__ == "__main__": "documentclass.+{sustechthesis}", "documentclass[degree=master,language=english,cjk-font=external]{sustechthesis}" ) elif args.recipe == 3: # biber filename = "sustechthesis-example.tex" comment_line(filename,"bibliography{ref/refs}",True) comment_line(filename,"printbibliography",False) filename = "sustech-setup.tex" comment_line(filename,"{gbt7714}",True) comment_line(filename,"citestyle{super}",True) comment_line(filename,"citestyle{numbers}",True) comment_line(filename,"bibliographystyle{sustechthesis-numeric}",True) comment_line(filename,"{biblatex}",False) comment_line(filename,"addbibresource{ref/refs.bib}",False) Loading
sustech-setup.tex +6 −6 Changes for sustech-setup.tex: 6 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -107,14 +107,14 @@ %%%%%% 顺序编码制的文献引用形式 %%%%%% 参考文献编译方式二选一,不要同时开启。 %%%% 选择一:使用 BibTeX + natbib 宏包 % \usepackage[sort&compress]{gbt7714} % \citestyle{super} % 全局上标数字模式,中文主体采用 % % \citestyle{numbers} % 全局行间数字模式,英文主体采用 % \bibliographystyle{sustechthesis-numeric} \usepackage[sort&compress]{gbt7714} \citestyle{super} % 全局上标数字模式,中文主体采用 % \citestyle{numbers} % 全局行间数字模式,英文主体采用 \bibliographystyle{sustechthesis-numeric} %%%% 选择二:使用 BibLaTeX 宏包(兼容性不佳,不太推荐) \usepackage[backend=biber,style=gb7714-2015,gbalign=left]{biblatex} \addbibresource{ref/refs.bib} % 声明 BibLaTeX 的数据库 % \usepackage[backend=biber,style=gb7714-2015,gbalign=left]{biblatex} % \addbibresource{ref/refs.bib} % 声明 BibLaTeX 的数据库 % 定义所有的图片文件在 figures 子目录下 \graphicspath{{figures/}} Loading
sustechthesis-example.tex +2 −2 Changes for sustechthesis-example.tex: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -67,8 +67,8 @@ % 参考文献 % \bibliography{ref/refs} % 参考文献使用 BibTeX 编译 \printbibliography % 参考文献使用 BibLaTeX 编译(兼容性不佳,不太推荐) \bibliography{ref/refs} % 参考文献使用 BibTeX 编译 % \printbibliography % 参考文献使用 BibLaTeX 编译(兼容性不佳,不太推荐) % 附录 \appendix Loading
test/test-files.py +36 −0 Changes for test/test-files.py: 36 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -25,6 +25,30 @@ def change_line(filename, old, new): rollback(filename, mode=0) def comment_line(filename, pattern, action): try: rollback(filename, mode=1) with open(filename, "r", encoding="utf-8") as f1: with open(f"{filename}.part", "w", encoding="utf-8") as f2: for line in f1: if re.findall(pattern, line): print(line) if action: line = f"% {line}" else: line = re.sub("^[%\s]+", "", line) f2.write(line) print(line) else: f2.write(line) os.remove(filename) os.rename(f"{filename}.part", filename) except: rollback(filename, mode=2) finally: rollback(filename, mode=0) def rollback(filename, mode): if mode == 1: # running 1 Loading Loading @@ -57,3 +81,15 @@ if __name__ == "__main__": "documentclass.+{sustechthesis}", "documentclass[degree=master,language=english,cjk-font=external]{sustechthesis}" ) elif args.recipe == 3: # biber filename = "sustechthesis-example.tex" comment_line(filename,"bibliography{ref/refs}",True) comment_line(filename,"printbibliography",False) filename = "sustech-setup.tex" comment_line(filename,"{gbt7714}",True) comment_line(filename,"citestyle{super}",True) comment_line(filename,"citestyle{numbers}",True) comment_line(filename,"bibliographystyle{sustechthesis-numeric}",True) comment_line(filename,"{biblatex}",False) comment_line(filename,"addbibresource{ref/refs.bib}",False)