themes moved to folder

This commit is contained in:
2024-06-28 14:25:27 +02:00
parent e38231eb33
commit e449f4a25a
5 changed files with 9 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ The script supports several command-line options to customize its behavior. Belo
- `-l LICENSE, --license LICENSE`: Specify a license for the content. Options are `cc-zero`, `cc-by`, `cc-by-sa`, `cc-by-nd`, `cc-by-nc`, `cc-by-nc-sa`, and `cc-by-nc-nd`. - `-l LICENSE, --license LICENSE`: Specify a license for the content. Options are `cc-zero`, `cc-by`, `cc-by-sa`, `cc-by-nd`, `cc-by-nc`, `cc-by-nc-sa`, and `cc-by-nc-nd`.
- `-a AUTHOR, --author AUTHOR`: Specify the author of the content. - `-a AUTHOR, --author AUTHOR`: Specify the author of the content.
- `-t TITLE, --title TITLE`: Specify the title for the root directory HTML file. - `-t TITLE, --title TITLE`: Specify the title for the root directory HTML file.
- `--theme THEME`: Specify the relative link to a custom CSS theme file. Default is `.static/default.css`. - `--theme THEME`: Specify the path to a custom CSS theme file. Default is `themes/default.css`.
### Example ### Example

View File

@@ -20,7 +20,7 @@ _ROOTTITLE = "Pictures"
_STATICFILES = os.path.join(os.path.abspath(os.path.dirname(__file__)), "files") _STATICFILES = os.path.join(os.path.abspath(os.path.dirname(__file__)), "files")
_FAVICON = ".static/favicon.ico" _FAVICON = ".static/favicon.ico"
_STYLE = ".static/global.css" _STYLE = ".static/global.css"
_THEME = ".static/default.css" _THEME = os.path.join(os.path.abspath(os.path.dirname(__file__)), "themes", "default.css")
_AUTHOR = "Author" _AUTHOR = "Author"
# fmt: off # fmt: off
rawext = [".3fr", ".ari", ".arw", ".bay", ".braw", ".crw", ".cr2", ".cr3", ".cap", ".data", ".dcs", ".dcr", ".dng", ".drf", ".eip", ".erf", ".fff", ".gpr", ".iiq", ".k25", ".kdc", ".mdc", ".mef", ".mos", ".mrw", ".nef", ".nrw", ".obm", ".orf", ".pef", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rwl", ".rw2", ".rwz", ".sr2", ".srf", ".srw", ".tif", ".tiff", ".x3f"] rawext = [".3fr", ".ari", ".arw", ".bay", ".braw", ".crw", ".cr2", ".cr3", ".cap", ".data", ".dcs", ".dcr", ".dng", ".drf", ".eip", ".erf", ".fff", ".gpr", ".iiq", ".k25", ".kdc", ".mdc", ".mef", ".mos", ".mrw", ".nef", ".nrw", ".obm", ".orf", ".pef", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rwl", ".rw2", ".rwz", ".sr2", ".srf", ".srw", ".tif", ".tiff", ".x3f"]
@@ -123,7 +123,7 @@ def listfolder(folder: str, title: str):
title=title, title=title,
favicon=f"{args.webroot}{_FAVICON}", favicon=f"{args.webroot}{_FAVICON}",
stylesheet=f"{args.webroot}{_STYLE}", stylesheet=f"{args.webroot}{_STYLE}",
theme=f"{args.webroot}{urllib.parse.quote(args.theme)}", theme=f"{args.webroot}.static/theme.css",
root=args.webroot, root=args.webroot,
parent=parent, parent=parent,
header=header, header=header,
@@ -180,7 +180,7 @@ def main():
parser.add_argument("-l", "--license", help="License", default=None, required=False, choices=["cc-zero", "cc-by", "cc-by-sa", "cc-by-nd", "cc-by-nc", "cc-by-nc-sa", "cc-by-nc-nd"], dest="license") parser.add_argument("-l", "--license", help="License", default=None, required=False, choices=["cc-zero", "cc-by", "cc-by-sa", "cc-by-nd", "cc-by-nc", "cc-by-nc-sa", "cc-by-nc-nd"], dest="license")
parser.add_argument("-a", "--author", help="Author", default=_AUTHOR, required=False, type=str, dest="author") parser.add_argument("-a", "--author", help="Author", default=_AUTHOR, required=False, type=str, dest="author")
parser.add_argument("-t", "--title", help="Title", default=_ROOTTITLE, required=False, type=str, dest="title") parser.add_argument("-t", "--title", help="Title", default=_ROOTTITLE, required=False, type=str, dest="title")
parser.add_argument("--theme", help="Relative link to CSS theme file", default=_THEME, required=False, type=str, dest="theme") parser.add_argument("--theme", help="Path to CSS theme file", default=_THEME, required=False, type=str, dest="theme")
parser.add_argument("--fancyfolders", help="Use fancy folders instead of default apache ones", action="store_true", default=False, required=False, dest="fancyfolders") parser.add_argument("--fancyfolders", help="Use fancy folders instead of default apache ones", action="store_true", default=False, required=False, dest="fancyfolders")
args = parser.parse_args() args = parser.parse_args()
# fmt: on # fmt: on
@@ -205,6 +205,7 @@ def main():
print("Copying static files...") print("Copying static files...")
shutil.copytree(_STATICFILES, os.path.join(args.root, ".static"), dirs_exist_ok=True) shutil.copytree(_STATICFILES, os.path.join(args.root, ".static"), dirs_exist_ok=True)
shutil.copyfile(args.theme, os.path.join(args.root, ".static", "theme.css"))
if args.non_interactive: if args.non_interactive:
print("Generating html files...") print("Generating html files...")

View File

@@ -22,4 +22,8 @@
body { body {
color: #e8e6e3; color: #e8e6e3;
background-color: #181a1b; background-color: #181a1b;
}
a {
color: #0042dd;
} }