20221007 night
This commit is contained in:
parent
dcc46c10a6
commit
6bb2725264
|
|
@ -25,7 +25,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"import os,re,time,json\n",
|
||||
"import os,re,time,json,sys\n",
|
||||
"\n",
|
||||
"\"\"\"\n",
|
||||
"\"/模板文件\"目录下 课时划分.tex 与 课时目标及单元目标.tex 文件不能缺失\n",
|
||||
|
|
@ -132,6 +132,10 @@
|
|||
"#替换单元课时目标的latex文件的内容并编译\n",
|
||||
"with open(\"模板文件/课时目标及单元目标.tex\",\"r\",encoding = \"utf8\") as f:\n",
|
||||
" obj_latex_file_raw = f.read()\n",
|
||||
"#识别操作系统\n",
|
||||
"if sys.platform != \"win32\":\n",
|
||||
" obj_latex_file_raw = re.sub(r\"fontset[\\s]*=[\\s]*windows\",\"fontset = fandol\",obj_latex_file_raw)\n",
|
||||
" obj_latex_file_raw = re.sub(r\"\\\\setCJKmainfont\",r\"% \\\\setCJKmainfont\",obj_latex_file_raw)\n",
|
||||
"obj_latex_file_new = obj_latex_file_raw.replace(\"课时目标待替换\",lessons_obj_string).replace(\"单元目标待替换\",units_obj_string)\n",
|
||||
"with open(lessonobj_file,\"w\",encoding = \"utf8\") as f:\n",
|
||||
" f.write(obj_latex_file_new)\n",
|
||||
|
|
@ -144,6 +148,10 @@
|
|||
"#替换课时划分的latex文件的内容并编译\n",
|
||||
"with open(\"模板文件/课时划分.tex\",\"r\",encoding = \"utf8\") as f:\n",
|
||||
" lessons_cut_latex_file_raw = f.read()\n",
|
||||
"#识别操作系统\n",
|
||||
"if sys.platform != \"win32\":\n",
|
||||
" lessons_cut_latex_file_raw = re.sub(r\"fontset[\\s]*=[\\s]*windows\",\"fontset = fandol\",lessons_cut_latex_file_raw)\n",
|
||||
" lessons_cut_latex_file_raw = re.sub(r\"\\\\setCJKmainfont\",r\"% \\\\setCJKmainfont\",lessons_cut_latex_file_raw)\n",
|
||||
"lessons_cut_latex_file_new = lessons_cut_latex_file_raw.replace(\"待替换\",lessons_cut_string)\n",
|
||||
"with open(lessoncut_file,\"w\",encoding = \"utf8\") as f:\n",
|
||||
" f.write(lessons_cut_latex_file_new)\n",
|
||||
|
|
|
|||
Reference in New Issue