templates
This commit is contained in:
parent
7cc0f4be39
commit
a7cf317346
|
@ -4,4 +4,5 @@ dist
|
|||
books-2023
|
||||
output
|
||||
cookbooks
|
||||
calvin-and-hobbes
|
||||
calvin-and-hobbes
|
||||
build.sh
|
15
main.py
15
main.py
|
@ -75,7 +75,7 @@ def fetch_list(list_url):
|
|||
# to use this next field to direct the pagination instead of an increment
|
||||
page += 1
|
||||
if not next:
|
||||
more_results = False
|
||||
more_results = False
|
||||
else:
|
||||
more_results = False
|
||||
except:
|
||||
|
@ -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"
|
|
@ -12,7 +12,7 @@
|
|||
margin-right: 20px;
|
||||
box-shadow: 12px 14px yellow;
|
||||
background-color: lightpink;
|
||||
padding: 40px;
|
||||
padding: 40px;
|
||||
}
|
||||
.main {
|
||||
max-width: 600px;
|
||||
|
@ -23,8 +23,10 @@ padding: 40px;
|
|||
background-color: white;
|
||||
}
|
||||
body {
|
||||
font-family: "Roboto Mono,monospace";
|
||||
font-family: "Roboto Mono,monospace";
|
||||
background-color: mediumpurple;
|
||||
padding-bottom: 30px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.page-title {
|
||||
width: 90%;
|
||||
|
@ -34,7 +36,7 @@ padding: 40px;
|
|||
background-color: white;
|
||||
box-shadow: 8px 12px blue;
|
||||
margin-bottom: 50px;
|
||||
padding-bottom: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
|
@ -57,28 +59,49 @@ 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">
|
||||
Calvin & Hobbes
|
||||
</div>
|
||||
{% for book in books %}
|
||||
Calvin & Hobbes
|
||||
</div>
|
||||
{% for book in books %}
|
||||
|
||||
<div class="book-item">
|
||||
<div>
|
||||
<img src="static/{{book.cover_image_path}}" class="cover-image"/>
|
||||
</div>
|
||||
<div>
|
||||
{{ book.title }} by {{ book.author }} {% if book.published_year %} ({{book.published_year}}) {% endif %}
|
||||
</div>
|
||||
<img src="static/{{book.cover_image_path}}" class="cover-image"/>
|
||||
</div>
|
||||
<div>
|
||||
{{ book.title }} by {{ book.author }} {% if book.published_year %} ({{book.published_year}}) {% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
<div class="page-footer">
|
||||
source: <a href="https://bookwyrm.social/list/2634/s/calvin-and-hobbes">https://bookwyrm.social/list/2634/s/calvin-and-hobbes</a>
|
||||
</div>
|
|
@ -12,7 +12,7 @@
|
|||
margin-right: 20px;
|
||||
box-shadow: 12px 14px yellow;
|
||||
background-color: lightpink;
|
||||
padding: 40px;
|
||||
padding: 40px;
|
||||
}
|
||||
.main {
|
||||
max-width: 600px;
|
||||
|
@ -23,8 +23,10 @@ padding: 40px;
|
|||
background-color: white;
|
||||
}
|
||||
body {
|
||||
font-family: "Roboto Mono,monospace";
|
||||
font-family: "Roboto Mono,monospace";
|
||||
background-color: mediumpurple;
|
||||
padding-bottom: 30px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.page-title {
|
||||
width: 90%;
|
||||
|
@ -34,7 +36,7 @@ padding: 40px;
|
|||
background-color: white;
|
||||
box-shadow: 8px 12px blue;
|
||||
margin-bottom: 50px;
|
||||
padding-bottom: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
|
@ -56,29 +58,50 @@ 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">
|
||||
Cookbooks
|
||||
</div>
|
||||
{% for book in books %}
|
||||
Cookbooks
|
||||
</div>
|
||||
{% for book in books %}
|
||||
|
||||
<div class="book-item">
|
||||
<div>
|
||||
<img src="static/{{book.cover_image_path}}" class="cover-image"/>
|
||||
</div>
|
||||
<div>
|
||||
{{ book.title }} by {{ book.author }} {% if book.published_year %} ({{book.published_year}}) {% endif %}
|
||||
</div>
|
||||
<img src="static/{{book.cover_image_path}}" class="cover-image"/>
|
||||
</div>
|
||||
<div>
|
||||
{{ book.title }} by {{ book.author }} {% if book.published_year %} ({{book.published_year}}) {% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
<div class="page-footer">
|
||||
source: <a href="https://bookwyrm.social/list/2609/s/cookbooks">https://bookwyrm.social/list/2609/s/cookbooks</a>
|
||||
</div>
|
|
@ -12,7 +12,7 @@
|
|||
margin-right: 20px;
|
||||
box-shadow: 12px 14px yellow;
|
||||
background-color: lightpink;
|
||||
padding: 40px;
|
||||
padding: 40px;
|
||||
}
|
||||
.main {
|
||||
max-width: 600px;
|
||||
|
@ -23,8 +23,10 @@ padding: 40px;
|
|||
background-color: white;
|
||||
}
|
||||
body {
|
||||
/*font-family: "Roboto Mono", monospace;*/
|
||||
/*font-family: "Roboto Mono", monospace;*/
|
||||
background-color: mediumpurple;
|
||||
padding-bottom: 30px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.page-title {
|
||||
width: 90%;
|
||||
|
@ -34,7 +36,7 @@ padding: 40px;
|
|||
background-color: white;
|
||||
box-shadow: 8px 12px blue;
|
||||
margin-bottom: 50px;
|
||||
padding-bottom: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
|
@ -56,29 +58,51 @@ 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">
|
||||
<div class="page-title">
|
||||
2023
|
||||
</div>
|
||||
{% for book in books %}
|
||||
2023
|
||||
</div>
|
||||
{% for book in books %}
|
||||
|
||||
<div class="book-item">
|
||||
<div>
|
||||
<img src="static/{{book.cover_image_path}}" class="cover-image"/>
|
||||
</div>
|
||||
<div>
|
||||
{{ book.title }} by {{ book.author }} {% if book.published_year %} ({{book.published_year}}) {% endif %}
|
||||
</div>
|
||||
<img src="static/{{book.cover_image_path}}" class="cover-image"/>
|
||||
</div>
|
||||
<div>
|
||||
{{ book.title }} by {{ book.author }} {% if book.published_year %} ({{book.published_year}}) {% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</body>
|
Loading…
Reference in New Issue