finishing the background-image change from yesterday

master
mb 1 year ago
parent 036855c687
commit 311e3b55aa

@ -52,19 +52,17 @@ for folder in materials:
md = file.read() md = file.read()
card = markdown.markdown(md) card = markdown.markdown(md)
#print(card) # the print of all the md files #print(card) # the print of all the md files
card = f'<div class="card text">{ card }</div>'
cards[folder][card_folder].append(card) cards[folder][card_folder].append(card)
elif my_file.endswith(('.jpg', '.jpeg', '.png')): elif my_file.endswith(('.jpg', '.jpeg', '.png')):
if 'prototype_' in my_file: if 'prototype_' in my_file:
my_file= my_file.replace('.jpg', '').replace('.jpeg', '').replace('.png', '').replace('prototype_', '').replace('_', ' ') my_file= my_file.replace('.jpg', '').replace('.jpeg', '').replace('.png', '').replace('prototype_', '').replace('_', ' ')
image_html = f'<img src="{relative_file_path}" alt="{my_file}" />' + f"<div class='image_titles'>{my_file}</div>" image_html = f'<img src="{relative_file_path}" alt="{my_file}" />' + f"<div class='image_titles'>{my_file}</div>"
else: else:
image_html = f'<img src="{relative_file_path}" alt="{my_file}" />' image_html = f'<img src="{relative_file_path}" alt="{my_file}" />'
mycard = f'<div class="card" style="background-image: url("{relative_file_path}");">{image_html}</div> ' mycard = f'<div class="card img" style="background-image: url(\'{relative_file_path}\');">{image_html}</div> '
cards[folder][card_folder].append(mycard) cards[folder][card_folder].append(mycard)
#print(my_file) # print(mycard)
#print(card_folder) #print(card_folder)
#print(file_path) #print(file_path)
@ -97,22 +95,19 @@ for page in range(number_pages):
card_8= choice(cards["4_add_ons"]["make-a-notebook-that"]) card_8= choice(cards["4_add_ons"]["make-a-notebook-that"])
cards["4_add_ons"]["make-a-notebook-that"].remove(card_8) cards["4_add_ons"]["make-a-notebook-that"].remove(card_8)
page_html = f''' page_html = f'''
<div class="page"> <div class="page">
<div class="card left-card">{card_1}</div> {card_1}
<div class="card right-card">{card_2}</div> {card_2}
<div class="card left-card">{card_3}</div> {card_3}
<div class="card right-card">{card_4}</div> {card_4}
<div class="card left-card">{card_5}</div> {card_5}
<div class="card right-card">{card_6}</div> {card_6}
<div class="card left-card">{card_7}</div> {card_7}
<div class="card right-card">{card_8}</div> {card_8}
</div> </div>
''' '''
pages.append(page_html) pages.append(page_html)

@ -20,18 +20,18 @@ body{
.card { .card {
float: left; float: left;
width: calc(210mm / 2 - 10mm); /* Adjusted width to fit 2 cards per row with margins */ width: calc(210mm / 2); /* Adjusted width to fit 2 cards per row with margins */
height: calc(297mm / 4 - 10mm); /* Adjusted height to fit 4 rows per page with margins */ height: calc(297mm / 4); /* Adjusted height to fit 4 rows per page with margins */
/*border: 1mm solid salmon;*/ border: 1px solid black;
margin: 5mm;
box-sizing: border-box; /* Includes the border in the width and height calculation */ box-sizing: border-box; /* Includes the border in the width and height calculation */
overflow: hidden; overflow: hidden;
} }
.card.img{
}
.card.text{
padding: 5mm;
}
.card.left-card { .card.left-card {
padding-right: 10mm; padding-right: 10mm;

Loading…
Cancel
Save