@@ -14,12 +14,17 @@ from .relationships import * | |||
from . import db | |||
import os | |||
from sqlalchemy.sql import func | |||
import markdown | |||
book = Blueprint('book', __name__) | |||
# route for displaying all books in database | |||
@book.route('/books') | |||
def get_books(): | |||
# get introductory paragraph Markdown | |||
with open('content/books.md', 'r') as f: | |||
intro_text = f.read() | |||
intro_text = markdown.markdown(intro_text) | |||
view = request.args.get('view') | |||
resource_type = 'book' | |||
books_query = Resource.query.filter_by(type=resource_type).order_by(func.random()) | |||
@@ -38,6 +43,9 @@ def get_books(): | |||
count = len(books) | |||
# reorder books by book name | |||
books = sorted(books, key=lambda d: d.__dict__['name'].lower()) | |||
# render Markdown as HTML | |||
for book in books: | |||
book.description = markdown.markdown(book.description) | |||
if view != 'list': | |||
# append relationships to each book | |||
append_relationships_multiple(books) | |||
@@ -48,12 +56,14 @@ def get_books(): | |||
year_filter = get_filter_values('year', resource_type) | |||
# typology | |||
typology_filter = get_filter_values('typology', resource_type) | |||
return render_template('resources.html', resources=books, type=resource_type, practices_filter=practices_filter, year_filter=year_filter, typology_filter=typology_filter, count=count, view=view) | |||
return render_template('resources.html', resources=books, type=resource_type, practices_filter=practices_filter, year_filter=year_filter, typology_filter=typology_filter, count=count, view=view, intro_text=intro_text) | |||
# route for displaying a single book based on the ID in the database | |||
@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 |
@@ -28,6 +28,9 @@ def index(): | |||
resource_ids = tool_ids + practice_ids + book_ids | |||
# get data for curated resources | |||
curated = get_curated_resources(resource_ids) | |||
# render Markdown as HTML | |||
for resource in curated: | |||
resource.description = markdown.markdown(resource.description) | |||
with open('content/home.md', 'r') as f: | |||
text = f.read() | |||
text = markdown.markdown(text) |
@@ -21,6 +21,10 @@ practice = Blueprint('practice', __name__) | |||
# route for displaying all practices in database | |||
@practice.route('/practices') | |||
def get_practices(): | |||
# get introductory paragraph Markdown | |||
with open('content/practices.md', 'r') as f: | |||
intro_text = f.read() | |||
intro_text = markdown.markdown(intro_text) | |||
view = request.args.get('view') | |||
practices = Resource.query.filter_by(type='practice').order_by(func.random()).all() | |||
# get number of practices | |||
@@ -30,7 +34,7 @@ def get_practices(): | |||
if view != 'list': | |||
# append relationships to each practice | |||
append_relationships_multiple(practices) | |||
return render_template('resources.html', resources=practices, type='practice', count=count, view=view) | |||
return render_template('resources.html', resources=practices, type='practice', count=count, view=view, intro_text=intro_text) | |||
# route for displaying a single practice based on the ID in the database | |||
@practice.route('/practices/<int:practice_id>') |
@@ -298,7 +298,7 @@ | |||
{% endif %} | |||
<div class="{% if size==1 %} big-text {% else %} small-text {% endif %} mb-[1em]"> | |||
{{ resource['description'] | truncate(150) }} | |||
{{ resource['description'] | truncate(150) | safe }} | |||
</div> | |||
</a> |
@@ -116,7 +116,7 @@ | |||
Experimental aspects: | |||
</h3> | |||
<div> | |||
{{ resource['description'] }} | |||
{{ resource['description']|safe }} | |||
</div> | |||
</div> | |||
{% endif %} |
@@ -72,9 +72,7 @@ | |||
<div class="border-b-2 border-black grid lg:grid-cols-[52rem,30rem] content-start"> | |||
<div class="mx-2 lg:ml-[13rem] text my-8 meta lg:max-w-[30rem]"> | |||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultricies egestas felis at dignissim. Morbi ut bibendum | |||
nisl. Integer ac sollicitudin risus. Vivamus et est est. Ut vitae lacus nec justo tincidunt interdum. Fusce sapien odio, | |||
commodo nec est et, interdum varius risus. Curabitur vehicula consequat auctor. | |||
{{ intro_text|safe }} | |||
</div> | |||
</div> | |||
@@ -14,12 +14,17 @@ from .relationships import * | |||
from . import db | |||
import os | |||
from sqlalchemy.sql import func | |||
import markdown | |||
tool = Blueprint('tool', __name__) | |||
# route for displaying all tools in database | |||
@tool.route('/tools') | |||
def get_tools(): | |||
# get introductory paragraph Markdown | |||
with open('content/tools.md', 'r') as f: | |||
intro_text = f.read() | |||
intro_text = markdown.markdown(intro_text) | |||
view = request.args.get('view') | |||
resource_type = 'tool' | |||
tools_query = Resource.query.filter_by(type=resource_type).order_by(func.random()) | |||
@@ -53,7 +58,7 @@ def get_tools(): | |||
languages_filter = get_filter_values('scriptingLanguage', resource_type) | |||
# status | |||
status_filter = get_filter_values('status', resource_type) | |||
return render_template('resources.html', resources=tools, type=resource_type, practices_filter=practices_filter, licenses_filter=licenses_filter, languages_filter=languages_filter, status_filter=status_filter, count=count, view=view) | |||
return render_template('resources.html', resources=tools, type=resource_type, practices_filter=practices_filter, licenses_filter=licenses_filter, languages_filter=languages_filter, status_filter=status_filter, count=count, view=view, intro_text=intro_text) | |||
# route for displaying a single tool based on the ID in the database | |||
@tool.route('/tools/<int:tool_id>') |
@@ -0,0 +1 @@ | |||
Experimental books undo, critique, reinvent, and expand the processes and norms of scholarly publishing. |
@@ -0,0 +1 @@ | |||
Sorting the compendium by practice (annotating, collaborative writing, forking, remixing, reviewing, translating, versioning) provides inspiration on how-to make experimental books. |
@@ -0,0 +1 @@ | |||
Open source software tools and platforms enable experimentation with scholarly books: changing how people, collate, write, assemble, review, publish, share, reuse, and read long-form texts. |