forked from manuelvicnt/manuelvicnt.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.py
29 lines (22 loc) · 727 Bytes
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
"""
Little script that replaces comment characters to html,
found in the *.hbs files.
"""
import os
import glob
if __name__ == '__main__':
os.chdir(os.path.join(os.environ['HOME'],
"Downloads", "Casper-master"))
for filename in glob.glob("*.hbs"):
print(filename)
# Read in the file
with open(filename, 'r') as infile :
filedata = infile.read()
# Replace the target string
# Replacing comments
filedata = filedata.replace('{{!--', '<!--')
filedata = filedata.replace('--}}', '-->')
# Write the file out again
with open(filename, 'w') as outfile:
outfile.write(filedata)