Quellcode durchsuchen

Add basic support for style

master
Marien Fressinaud vor 6 Jahren
Ursprung
Commit
444c06e751
3 geänderte Dateien mit 17 neuen und 2 gelöschten Zeilen
  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 Datei anzeigen

@@ -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 Datei anzeigen

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

background-color: #222;
}

+ 11
- 2
boop.py Datei anzeigen

@@ -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__":

Laden…
Abbrechen
Speichern