新增工程数据
This commit is contained in:
@@ -56,9 +56,21 @@ class MarkDown:
|
||||
return strTitle + "\n" + markdown_table
|
||||
|
||||
|
||||
# prjSon = ProjectJson('C:\\Users\\wanyaokun\\Desktop\\markdown\\Project\\110千伏思科变电站工程')
|
||||
# prjSon.parse()
|
||||
# tables = prjSon.tables()
|
||||
# for name,table in tables.items():
|
||||
# mdObj = MarkDown(table,f'C:\\Users\\wanyaokun\\Desktop\\markdown\\data\\110千伏思科变电站工程\\{table.name()}.md')
|
||||
# mdObj.build()
|
||||
if __name__ == "__main__":
|
||||
intputDir = ''
|
||||
outputDir = ''
|
||||
|
||||
subdirectories = {}
|
||||
for dp, dn, fn in os.walk(intputDir):
|
||||
for d in dn:
|
||||
subdirectories[d] = os.path.join(dp, d)
|
||||
for dirName,dirPath in subdirectories.items():
|
||||
prjSon = ProjectJson(dirPath)
|
||||
prjSon.parse()
|
||||
tables = prjSon.tables()
|
||||
for name,table in tables.items():
|
||||
outputPath = os.path.join(outputDir,dirName,f'{table.name()}.md')
|
||||
mdObj = MarkDown(table,outputPath)
|
||||
mdObj.build()
|
||||
|
||||
|
||||
|
||||
@@ -76,19 +76,4 @@ class ProjectJson:
|
||||
def tables(self):
|
||||
return self._tables
|
||||
|
||||
def getProjectName(dir:str):
|
||||
result = dir.split('\\')
|
||||
if len(result) > 0:
|
||||
return result[-1]
|
||||
return "未知工程名称"
|
||||
|
||||
prjJson = ProjectJson(dir)
|
||||
prjJson.parse()
|
||||
tb:JsonTable = prjJson.table('工程属性')
|
||||
records = tb.records()
|
||||
for record in records:
|
||||
name = record.value('名称')
|
||||
if name == '工程名称':
|
||||
return record.value('值')
|
||||
return ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user