Skip to content

Commit 7722d92

Browse files
committed
Added a small script to convert documents in *.hbs to html format, for easier copy-paste.
1 parent 46406bb commit 7722d92

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

script.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
Little script that replaces comment characters to html,
5+
found in the *.hbs files.
6+
"""
7+
8+
import os
9+
import glob
10+
11+
if __name__ == '__main__':
12+
13+
os.chdir(os.path.join(os.environ['HOME'],
14+
"Downloads", "Casper-master"))
15+
for filename in glob.glob("*.hbs"):
16+
print(filename)
17+
18+
# Read in the file
19+
with open(filename, 'r') as infile :
20+
filedata = infile.read()
21+
22+
# Replace the target string
23+
# Replacing comments
24+
filedata = filedata.replace('{{!--', '<!--')
25+
filedata = filedata.replace('--}}', '-->')
26+
27+
# Write the file out again
28+
with open(filename, 'w') as outfile:
29+
outfile.write(filedata)

0 commit comments

Comments
 (0)