-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtmlIO.py
31 lines (25 loc) · 937 Bytes
/
htmlIO.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
30
31
def writeHeaderHTMLTable(filePath, tableName):
htmlHeader = '''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Ownership Lists</title>
<link rel="stylesheet" href="_static/styles.css">
</head>
<body>
'''
htmlHeader+=f'''\n<input type="text" id="{tableName+"_search_bar"}" onkeyup="searchTable('{tableName+"_search_bar"}', '{tableName}')" placeholder="Search for usernames or game names..">'''
htmlHeader+=f'\n <table id="{tableName}">'
with open(filePath,'w') as f:
f.write(htmlHeader)
def writeFooterHTMLTable(filePath):
htmlFooter = '''
</table>
<script src="_static/search.js"></script>
</body>
</html>
'''
with open(filePath,'a') as f:
f.write(htmlFooter)