Selaa lähdekoodia

adding more books Markdown conversion

joel
Simon Bowie 1 vuosi sitten
vanhempi
commit
7a97764dad
2 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. +3
    -0
      web/app/relationships.py
  2. +1
    -0
      web/app/resources.py

+ 3
- 0
web/app/relationships.py Näytä tiedosto

@@ -8,6 +8,7 @@
from .models import Resource
from .models import Relationship
from . import db
import markdown

# function to retrieve linked resources
def get_relationships(primary_id):
@@ -51,6 +52,8 @@ def append_relationships(resource):
else:
resource.__dict__['practices'].append(relationship)
elif relationship.type == 'book':
# render Markdown as HTML
relationship.description = markdown.markdown(relationship.description)
if 'books' not in resource.__dict__.keys():
resource.__dict__['books'] = []
resource.__dict__['books'].append(relationship)

+ 1
- 0
web/app/resources.py Näytä tiedosto

@@ -32,6 +32,7 @@ def get_full_resource(resource_id):
if resource.type == 'book':
# render Markdown as HTML
resource.description = markdown.markdown(resource.description)
# get additional book metadata
book_data = get_book_data(resource.isbn)
if book_data:
resource.__dict__.update(book_data)

Loading…
Peruuta
Tallenna