@@ -62,8 +62,6 @@ def get_books(): | |||
@book.route('/books/<int:book_id>') | |||
def show_book(book_id): | |||
book = get_full_resource(book_id) | |||
# render Markdown as HTML | |||
book.description = markdown.markdown(book.description) | |||
return render_template('book.html', resource=book) | |||
# route for editing a single book based on the ID in the database |
@@ -16,6 +16,7 @@ from isbntools.app import * | |||
import requests | |||
import re | |||
from sqlalchemy.sql import func | |||
import markdown | |||
# function to retrieve data about a single resource from the database | |||
def get_resource(resource_id): | |||
@@ -29,6 +30,8 @@ def get_full_resource(resource_id): | |||
resource = get_resource(resource_id) | |||
resource = append_relationships(resource) | |||
if resource.type == 'book': | |||
# render Markdown as HTML | |||
resource.description = markdown.markdown(resource.description) | |||
book_data = get_book_data(resource.isbn) | |||
if book_data: | |||
resource.__dict__.update(book_data) |
@@ -1516,4 +1516,20 @@ a.menuitem:hover { | |||
width:1px; | |||
height:1px; | |||
overflow:hidden; | |||
} | |||
#about { | |||
display: inline-block; | |||
width: 60%; | |||
} | |||
#colophon { | |||
float: right; | |||
width: 30%; | |||
} | |||
hr { | |||
clear: both; | |||
margin-bottom: 25%; | |||
visibility: hidden; | |||
} |
@@ -2,8 +2,12 @@ | |||
{% block content %} | |||
<div class="cell-margin text max-w-[65ch]"> | |||
<div id="about" class="cell-margin text max-w-[65ch]"> | |||
{{ about_text|safe }} | |||
</div> | |||
<div id="colophon" class="cell-margin text"> | |||
{{ colophon_text | safe }} | |||
</div> | |||
{% endblock %} |