forked from huderlem/linoone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
60 lines (52 loc) · 1.75 KB
/
main.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
import argparse
import os
import re
from jinja2 import Environment, FileSystemLoader, select_autoescape
from setup.core_data import load_core_data
from setup.core_funcs import load_core_funcs
from settings import load_project_settings
from generators import (
AbilitiesGenerator,
IndexGenerator,
MapSectionsGenerator,
MapsGenerator,
MonPicsGenerator,
MonSummariesGenerator,
MovesGenerator,
PokedexGenerator,
TypesGenerator,
)
if __name__ == "__main__":
argparser = argparse.ArgumentParser("Linoone - Decomp Website Builder")
argparser.add_argument("project_dir", help="directory of the decomp project")
args = argparser.parse_args()
# Load program config.
config = {}
config["project_dir"] = args.project_dir
config["website_title"] = "pokeemerald"
config["dist_dir"] = os.path.join(os.path.dirname(os.path.realpath(__file__)), "dist")
config["base_url"] = None
# Load core data and functions to be used by generators and their templates.
core_data = load_core_data(config)
core_funcs = load_core_funcs(config)
project_settings = load_project_settings(config)
# Create Jinja templating environment
env = Environment(
loader=FileSystemLoader("templates"),
autoescape=select_autoescape(["html"])
)
# Execute all of the artifact generators to build the static website.
artifact_generators = [
MonPicsGenerator,
IndexGenerator,
PokedexGenerator,
MonSummariesGenerator,
TypesGenerator,
AbilitiesGenerator,
MovesGenerator,
MapSectionsGenerator,
MapsGenerator,
]
for generator in artifact_generators:
g = generator(config, core_data, core_funcs, project_settings)
g.run(env)