Fix Roam journal entries, plus move tools to util by convention.

This commit is contained in:
2020-11-16 14:37:07 +01:00
parent bbcf4b945e
commit f3d4634357
152 changed files with 20 additions and 8 deletions
Executable
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/python3
import pathlib
import titlecase
for filename in pathlib.Path('.').glob('**/*.md'):
f = open(filename)
print('file: %s' % filename)
lines = f.readlines()
if lines:
if lines[0].startswith('#'):
print(filename, 'has a header')
else:
sanitized_filename = str(filename).replace('-', ' ')
sanitized_filename = sanitized_filename.replace('.md', '')
sanitized_filename = sanitized_filename.replace('journal/', '')
header = '# ' + titlecase.titlecase(sanitized_filename)
print('would add header:', header)