Reformat
This commit is contained in:
@@ -15,42 +15,42 @@ jsonData['tasks'] = []
|
||||
numberOfTasks = int(input('Number of tasks: '))
|
||||
|
||||
for i in range(0, numberOfTasks):
|
||||
#Define variables
|
||||
realTaskNumber = i+1
|
||||
dirPath = './oppgaver/oppgave' + str(realTaskNumber) + '/'
|
||||
htmlPath = dirPath + 'oppgave.html'
|
||||
jsPath = dirPath + 'oppgave.js'
|
||||
#Define variables
|
||||
realTaskNumber = i+1
|
||||
dirPath = './oppgaver/oppgave' + str(realTaskNumber) + '/'
|
||||
htmlPath = dirPath + 'oppgave.html'
|
||||
jsPath = dirPath + 'oppgave.js'
|
||||
|
||||
#Make html file
|
||||
with open('./task-template/oppgave.html', 'r') as file:
|
||||
data = file.read()
|
||||
data = data.replace("taskNumber", str(realTaskNumber))
|
||||
os.makedirs(dirPath)
|
||||
with open(htmlPath, 'w') as file:
|
||||
file.write(data)
|
||||
|
||||
#Make js file
|
||||
with open(jsPath, 'w') as file:
|
||||
file.write('')
|
||||
#Make html file
|
||||
with open('./task-template/oppgave.html', 'r') as file:
|
||||
data = file.read()
|
||||
data = data.replace("taskNumber", str(realTaskNumber))
|
||||
os.makedirs(dirPath)
|
||||
with open(htmlPath, 'w') as file:
|
||||
file.write(data)
|
||||
|
||||
#Make js file
|
||||
with open(jsPath, 'w') as file:
|
||||
file.write('')
|
||||
|
||||
#Add to JSON
|
||||
jsonData['tasks'].append({
|
||||
'name': 'Oppgave ' + str(realTaskNumber),
|
||||
'path': str(htmlPath)
|
||||
#Add to JSON
|
||||
jsonData['tasks'].append({
|
||||
'name': 'Oppgave ' + str(realTaskNumber),
|
||||
'path': str(htmlPath)
|
||||
})
|
||||
|
||||
jsVariable = "const tasks = " + json.dumps(jsonData)
|
||||
|
||||
#Update JSON
|
||||
with open(jsonPath, 'w') as file:
|
||||
file.write(jsVariable)
|
||||
file.write(jsVariable)
|
||||
|
||||
#Delete the template
|
||||
deleteBool = input('Delete the template? (yes/No): ')
|
||||
if deleteBool == "yes":
|
||||
rmtree('./task-template', ignore_errors=True)
|
||||
rmtree('./task-template', ignore_errors=True)
|
||||
|
||||
#Delete itself
|
||||
deleteBool = input('Delete the program? (yes/No): ')
|
||||
if deleteBool == "yes":
|
||||
os.remove(argv[0])
|
||||
os.remove(argv[0])
|
@@ -1,21 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<title>Test</title>
|
||||
<link rel="stylesheet" href="./resources/css/main.css">
|
||||
<link rel="stylesheet" href="./resources/css/main.css" />
|
||||
<script src="./resources/js/tasksJSON.js"></script>
|
||||
<script async src="./resources/js/linkConnector.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test</h1>
|
||||
|
||||
<div class="center">
|
||||
<div class="textboxGrid"></div>
|
||||
<div class="textboxGrid"></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,20 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<title>Oppgave taskNumber</title>
|
||||
<link rel="stylesheet" href="../../resources/css/main.css">
|
||||
<link rel="stylesheet" href="../../resources/css/main.css" />
|
||||
<script async src="./script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Oppgave taskNumber</h1>
|
||||
|
||||
<div class="center">
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user