Browse Source

Merge branch 'joel' of https://github.com/COPIM/expub_compendium into joel

joel
Joel Galvez 1 year ago
parent
commit
dabf36a954
2 changed files with 12 additions and 1 deletions
  1. +5
    -1
      web/app/main.py
  2. +7
    -0
      web/app/resources.py

+ 5
- 1
web/app/main.py View File

@@ -9,6 +9,8 @@
from flask import Blueprint, render_template
from flask_login import login_required, current_user
from .models import Resource
from .resources import *
from .relationships import *
from sqlalchemy.sql import func
import markdown

@@ -24,7 +26,9 @@ def index():
with open('content/home.md', 'r') as f:
text = f.read()
text = markdown.markdown(text)
return render_template('index.html', text=text, tools=tools,books=books, tools2=tools2,books2=books2)
book_showcase = get_book('69')
book_showcase_relationships = get_relationships('69')
return render_template('index.html', text=text, tools=tools, book=book_showcase, book_relationships=book_showcase_relationships)

# route for profile page
@main.route('/profile')

+ 7
- 0
web/app/resources.py View File

@@ -63,6 +63,13 @@ def get_book_data(isbn):
except:
pass

# function to get full metadata for a book and combine into one object
def get_book(resource_id):
book = get_resource(resource_id)
book_data = get_book_data(book.isbn)
book.__dict__.update(book_data)
return book

# function to replace embedded URL strings with href links
def replace_urls(input):
# Compile a regular expression to match URLs.

Loading…
Cancel
Save