Explorar el Código

Add basic support for style

master
Marien Fressinaud hace 5 años
padre
commit
444c06e751
Se han modificado 3 ficheros con 17 adiciones y 2 borrados
  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 Ver fichero

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

+ 5
- 0
Herisson/style/main.css Ver fichero

@@ -0,0 +1,5 @@
body {
color: #fff;

background-color: #222;
}

+ 11
- 2
boop.py Ver fichero

@@ -1,6 +1,7 @@
#!/usr/bin/env python3

import os
import shutil

from jinja2 import Environment, PackageLoader, select_autoescape

@@ -17,12 +18,19 @@ def list_galleries_in(path):

def generate_output_dir():
output_path = os.path.join(os.curdir, OUTPUT_DIR_NAME)
shutil.rmtree(output_path)
if not os.path.isdir(output_path):
os.mkdir(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")

theme_path = os.path.join(os.curdir, THEME)
@@ -41,7 +49,8 @@ def main():

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


if __name__ == "__main__":

Cargando…
Cancelar
Guardar