Browse Source

Add basic support for style

master
Marien Fressinaud 6 years ago
parent
commit
444c06e751
3 changed files with 17 additions and 2 deletions
  1. 1
    0
      Herisson/index.html.j2
  2. 5
    0
      Herisson/style/main.css
  3. 11
    2
      boop.py

+ 1
- 0
Herisson/index.html.j2 View File

<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0" /> <meta name="viewport" content="initial-scale=1.0" />
<link rel="stylesheet" href="style/main.css">
<title>Boop</title> <title>Boop</title>
</head> </head>
<body> <body>

+ 5
- 0
Herisson/style/main.css View File

body {
color: #fff;

background-color: #222;
}

+ 11
- 2
boop.py View File

#!/usr/bin/env python3 #!/usr/bin/env python3


import os import os
import shutil


from jinja2 import Environment, PackageLoader, select_autoescape from jinja2 import Environment, PackageLoader, select_autoescape




def generate_output_dir(): def generate_output_dir():
output_path = os.path.join(os.curdir, OUTPUT_DIR_NAME) output_path = os.path.join(os.curdir, OUTPUT_DIR_NAME)
shutil.rmtree(output_path)
if not os.path.isdir(output_path): if not os.path.isdir(output_path):
os.mkdir(output_path) os.mkdir(output_path)
return output_path return output_path




def generate_index(galleries, output_path):
def generate_style(output_path):
style_path = os.path.join(os.curdir, THEME, "style")
style_output_path = os.path.join(output_path, "style")
shutil.copytree(style_path, style_output_path)


def generate_index(output_path, galleries):
index_path = os.path.join(output_path, "index.html") index_path = os.path.join(output_path, "index.html")


theme_path = os.path.join(os.curdir, THEME) theme_path = os.path.join(os.curdir, THEME)


if len(galleries) > 0: if len(galleries) > 0:
output_path = generate_output_dir() output_path = generate_output_dir()
generate_index(galleries, output_path)
generate_style(output_path)
generate_index(output_path, galleries)




if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save