templates
This commit is contained in:
parent
7cc0f4be39
commit
a7cf317346
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ books-2023
|
||||
output
|
||||
cookbooks
|
||||
calvin-and-hobbes
|
||||
build.sh
|
13
main.py
13
main.py
@ -156,7 +156,7 @@ if __name__ == '__main__':
|
||||
# create parser
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='bookshelf-generator',
|
||||
description='generates HTML for a web-page to display a bookshelf using bookwyrm or a csv as input',
|
||||
description='generates HTML for a web-page to display a bookshelf using bookwyrm or a yaml as input',
|
||||
epilog='<3')
|
||||
|
||||
# subparser for building website
|
||||
@ -184,25 +184,22 @@ if __name__ == '__main__':
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.subparser == "bookwyrm-download":
|
||||
|
||||
# subargs = bookwyrm_parser.parse_args()
|
||||
print(args.list_url)
|
||||
print(args.output_dir)
|
||||
|
||||
if not os.path.exists(args.output_dir):
|
||||
os.makedirs(args.output_dir)
|
||||
|
||||
processed_items = process_list(args.list_url)
|
||||
download_images(processed_items, output_dir=args.output_dir)
|
||||
write_yaml(processed_items, output_dir=args.output_dir)
|
||||
|
||||
else:
|
||||
elif args.subparser == "generate-html":
|
||||
yaml_path = args.yaml_path
|
||||
images_dir = args.images_dir
|
||||
output_path = args.output_path
|
||||
template_vars = load_yaml(yaml_path)
|
||||
build_site(output_dir=output_path, images_dir=images_dir, relative_template_path=args.template, template_vars=template_vars)
|
||||
|
||||
else:
|
||||
raise Exception("invalid subcommand. must be either bookwyrm-download or generate-html")
|
||||
|
||||
|
||||
|
||||
|
||||
|
14
run.sh
14
run.sh
@ -1,11 +1,11 @@
|
||||
# download
|
||||
# notplants-2023
|
||||
#python3 main.py bookwyrm-download --list-url="https://bookwyrm.social/list/2458/s/notplants-2023" --output-dir="books-2023"
|
||||
# python3 main.py generate-html --yaml-path="books-2023/books.yaml" --images-dir="books-2023" --template="bookshelf.html" --output-path="output/notplants-2023"
|
||||
#python3 main.py generate-html --yaml-path="books-2023/books.yaml" --images-dir="books-2023" --template="templates/bookshelf.html" --output-path="output/notplants-2023"
|
||||
|
||||
# calvin-and-hobbes
|
||||
#python3 main.py bookwyrm-download --list-url="https://bookwyrm.social/list/2634/s/calvin-and-hobbes" --output-dir="calvin-and-hobbes"
|
||||
#python3 main.py generate-html --yaml-path="calvin-and-hobbes/books.yaml" --images-dir="calvin-and-hobbes" --template="calvin-and-hobbes.html" --output-path="output/calvin-and-hobbes"
|
||||
python3 main.py generate-html --yaml-path="calvin-and-hobbes/books.yaml" --images-dir="calvin-and-hobbes" --template="templates/calvin-and-hobbes.html" --output-path="output/calvin-and-hobbes"
|
||||
|
||||
|
||||
|
||||
python3 main.py bookwyrm-download --list-url="https://bookwyrm.social/list/2609/s/cookbooks" --output-dir="cookbooks"
|
||||
python3 main.py generate-html --yaml-path="cookbooks/books.yaml" --images-dir="cookbooks" --template="cookbooks.html" --output-path="output/cookbooks"
|
||||
# cookbooks
|
||||
#python3 main.py bookwyrm-download --list-url="https://bookwyrm.social/list/2609/s/cookbooks" --output-dir="cookbooks"
|
||||
#python3 main.py generate-html --yaml-path="cookbooks/books.yaml" --images-dir="cookbooks" --template="templates/cookbooks.html" --output-path="output/cookbooks"
|
@ -25,6 +25,8 @@ padding: 40px;
|
||||
body {
|
||||
font-family: "Roboto Mono,monospace";
|
||||
background-color: mediumpurple;
|
||||
padding-bottom: 30px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.page-title {
|
||||
width: 90%;
|
||||
@ -57,11 +59,32 @@ padding: 40px;
|
||||
.page-footer a:hover {
|
||||
background-color: yellow;
|
||||
}
|
||||
.home-button {
|
||||
display: none;
|
||||
width: 28px;
|
||||
margin: auto;
|
||||
margin-bottom: auto;
|
||||
margin-bottom: 25px;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
/*border: 1px solid black;*/
|
||||
padding: 3px;
|
||||
line-height: 14px;
|
||||
font-size: 32px;
|
||||
}
|
||||
.home-button:hover {
|
||||
background-color:white;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<a href="../" class="home-button">
|
||||
<!-- 🞻-->
|
||||
←
|
||||
</a>
|
||||
|
||||
<div class="main">
|
||||
<div class="page-title">
|
@ -25,6 +25,8 @@ padding: 40px;
|
||||
body {
|
||||
font-family: "Roboto Mono,monospace";
|
||||
background-color: mediumpurple;
|
||||
padding-bottom: 30px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.page-title {
|
||||
width: 90%;
|
||||
@ -56,11 +58,32 @@ padding: 40px;
|
||||
}
|
||||
.page-footer a:hover {
|
||||
background-color: yellow;
|
||||
}
|
||||
.home-button {
|
||||
display:none;
|
||||
width: 28px;
|
||||
margin: auto;
|
||||
margin-bottom: auto;
|
||||
margin-bottom: 25px;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
/*border: 1px solid black;*/
|
||||
padding: 3px;
|
||||
line-height: 14px;
|
||||
font-size: 32px;
|
||||
}
|
||||
.home-button:hover {
|
||||
background-color:white;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a href="../" class="home-button">
|
||||
<!-- 🞻-->
|
||||
←
|
||||
</a>
|
||||
|
||||
|
||||
<div class="main">
|
@ -25,6 +25,8 @@ padding: 40px;
|
||||
body {
|
||||
/*font-family: "Roboto Mono", monospace;*/
|
||||
background-color: mediumpurple;
|
||||
padding-bottom: 30px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.page-title {
|
||||
width: 90%;
|
||||
@ -56,11 +58,33 @@ padding: 40px;
|
||||
}
|
||||
.page-footer a:hover {
|
||||
background-color: yellow;
|
||||
}
|
||||
.home-button {
|
||||
width: 28px;
|
||||
margin: auto;
|
||||
margin-bottom: auto;
|
||||
margin-bottom: 25px;
|
||||
display: block;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
/*border: 1px solid black;*/
|
||||
padding: 3px;
|
||||
line-height: 14px;
|
||||
font-size: 32px;
|
||||
display:none;
|
||||
}
|
||||
.home-button:hover {
|
||||
background-color:white;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a href="../" class="home-button">
|
||||
<!-- 🞻-->
|
||||
←
|
||||
</a>
|
||||
|
||||
|
||||
<div class="main">
|
Loading…
x
Reference in New Issue
Block a user