mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-06-06 02:36:49 +08:00

* Rewrite the setting API to use same API as ESP3D-TFT or at least close enough to be improved - WIP * Add isValidXXX setting API * Factorize dispatch_setting for ESP400 * ESP400 refactoring
41 lines
895 B
Python
41 lines
895 B
Python
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
input_file = "espXXX.md"
|
|
output_file_head = "esp"
|
|
output_ext = ".md"
|
|
|
|
|
|
|
|
f = open(input_file, "r")
|
|
lines = f.readlines()
|
|
#parse each lines
|
|
head = ""
|
|
have_command = False
|
|
fo=0
|
|
count = 0
|
|
for line in lines:
|
|
if not have_command:
|
|
count=0
|
|
head+=line
|
|
if line.startswith("title ="):
|
|
have_command = True
|
|
num = line.split("ESP")[1].split("]")[0]
|
|
fo = open(output_file_head+num+output_ext, "w")
|
|
fo.write(head)
|
|
have_command = True
|
|
else:
|
|
if line.startswith("+++"):
|
|
count+=1
|
|
if count==2:
|
|
fo.close()
|
|
have_command = False
|
|
head = line
|
|
print("close file "+output_file_head+num+output_ext)
|
|
else:
|
|
fo.write(line)
|
|
else:
|
|
fo.write(line)
|
|
|
|
f.close() |