55from obsidian_to_hugo import ObsidianToHugo
66
77
8- def addfrontmatter (wfile ):
9- print (wfile )
8+ def addfrontmatter (wfile , tfile ):
9+ with open (tfile , 'w' ) as tmpfile :
10+ tmpfile .write ('---\n ' )
11+ tmpfile .write ('title: title' )
12+ tmpfile .write ('date: 2025-03-08T11:49:11+09:00' )
13+ tmpfile .write ('---\n ' )
14+ with open (wfile , 'r' ) as wikifile :
15+ while buffer := wikifile .read (1024 ):
16+ tmpfile .write (buffer )
1017
1118
1219def main ():
@@ -24,8 +31,7 @@ def main():
2431 print (tpath )
2532
2633 if '_index.md' in filenames :
27- copy (wfile := join (path , '_index.md' ), join (tpath , '_index.md' ))
28- addfrontmatter (wfile )
34+ addfrontmatter (join (path , '_index.md' ), join (tpath , '_index.md' ))
2935
3036 for filename in filenames :
3137 if not filename .endswith ('.md' ):
@@ -39,8 +45,7 @@ def main():
3945 mkdir (fpath )
4046 print (fpath )
4147
42- copy (wfile := join (path , filename ), join (fpath , '_index.md' ))
43- addfrontmatter (wfile )
48+ addfrontmatter (join (path , filename ), join (fpath , '_index.md' ))
4449
4550
4651 isdir (contentdir ) or mkdir (contentdir )
0 commit comments