summaryrefslogtreecommitdiff
path: root/site.py
blob: 3ff05c0d734f84205d49c013c3f13a5e3dbfcf26 (plain)
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
30
31
#!/usr/bin/env python
#script creates searchable website for different operation manuals

import os

folder = "manuals"
header = """"""
middlepart = """"""
footer = """<script src="http://listjs.com/no-cdn/list.js"></script>"""
for file in os.listdir(folder):
	if file.endswith(".txt"):
		print(file)
		filename = file
		text = open(folder+"/"+filename, 'r')
		title = ""
		filename = ""
		tags = []
		description = ""
		for line in text: 
			line = line.replace('\n','')
			if "Title:" in line: 
				title = line.replace("Title: ", "")
			if "File:" in line:
				filename = line.replace("File: ", "")
			if "Tags:" in line:
				tags = line.replace("Tags: ", "").split(",")
			if "Description:" in line:
				description = line.replace("Description: ", "")
		if