Skip to content

Commit 8d1ab38

Browse files
committed
new contentify
1 parent 8d52883 commit 8d1ab38

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

contentify.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
from 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

1219
def 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)

wiki

Submodule wiki updated from 679036a to 436fa12

0 commit comments

Comments
 (0)