-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.py
90 lines (81 loc) · 2.08 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""
script.py
runs the script mode
Russell Lee
"""
import site_generator
from dataclasses import dataclass
# FileParameters helps organize how to export the files
@dataclass
class FileParameters:
mode: str
settings: list
title: str
text: str
number: str
multi: list
titles: list
def file_builder():
"""
builds a file by collecting all the names needed
:return: a list of the names of the files
"""
repeater = True
files = []
while repeater is True:
files.append(input('What is the file name? '))
more = input("Do you want to add another file? [yes] ")
if more == 'yes' or more == '':
pass
else:
repeater = False
return files
def file_writer(file):
"""
writes the file and sends all the lines as a string
:param file: the file name
:return: the entire file as a string
"""
doc = open(file)
generator = []
final = ''
for line in doc:
generator += line.strip().split('\n')
for i in generator:
final += i + '\n'
return final
def title_finder(files):
"""
returns the title of files
:param files: the list of the files
:return: the titles of the files in list form
"""
thing = []
for i in files:
holder = open(i)
for line in holder:
thing += line.strip().split('\n')
break
return thing
def script_main(background, font_color, font_header, font_type):
"""
main function of the script mode
:param background: the background for the file
:param font_color: the text color
:param font_header: the color of the header
:param font_type: the type of font used
:return:
"""
files = file_builder()
for i in range(0, len(files)):
final = file_writer(files[i])
titles = title_finder(files)
site_generator.generator_main(FileParameters(
'script',
[background, font_color, font_header, font_type],
'',
final,
str(i),
files,
titles
))