Explorar el Código

adding more books Markdown conversion

joel
Simon Bowie hace 1 año
padre
commit
7a97764dad
Se han modificado 2 ficheros con 4 adiciones y 0 borrados
  1. +3
    -0
      web/app/relationships.py
  2. +1
    -0
      web/app/resources.py

+ 3
- 0
web/app/relationships.py Ver fichero

@@ -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 Ver fichero

@@ -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)

Cargando…
Cancelar
Guardar