rename journal module to pages
this better represents the general purpose of this module, rather than just "journal" stuff (though that will likely be a use)
This commit is contained in:
@@ -35,7 +35,7 @@ def create_app(instance_path=None, test_config=None):
|
||||
def log_request():
|
||||
logger.info("REQUEST: [ %s ]", request.path)
|
||||
|
||||
from . import journal
|
||||
app.register_blueprint(journal.bp)
|
||||
from . import pages
|
||||
app.register_blueprint(pages.bp)
|
||||
|
||||
return app
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Journal functionality."""
|
||||
"""General page functionality."""
|
||||
import logging
|
||||
|
||||
import markdown
|
||||
@@ -6,15 +6,15 @@ from flask import Blueprint, Markup, abort, current_app as app, render_template
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
bp = Blueprint('journal', __name__, url_prefix='/')
|
||||
bp = Blueprint('pages', __name__, url_prefix='/')
|
||||
md = markdown.Markdown(extensions=['meta'])
|
||||
|
||||
|
||||
@bp.route('/', defaults={'path': 'index'})
|
||||
@bp.route('/<path:path>')
|
||||
def display_journal_entry(path):
|
||||
def display_page(path):
|
||||
"""Get the file contents of the requested path and render the file."""
|
||||
resolved_path = journal_file_resolver(path)
|
||||
resolved_path = page_file_resolver(path)
|
||||
logger.info("received request for path '%s', resolved to '%s'", path, resolved_path)
|
||||
try:
|
||||
with app.open_instance_resource(resolved_path, 'r') as entry_file:
|
||||
@@ -30,8 +30,8 @@ def display_journal_entry(path):
|
||||
return render_template('base.html', title=title, content=content)
|
||||
|
||||
|
||||
def journal_file_resolver(path):
|
||||
"""Manipulate the request path to find appropriate journal files.
|
||||
def page_file_resolver(path):
|
||||
"""Manipulate the request path to find appropriate page file.
|
||||
|
||||
* convert dir requests to index files
|
||||
|
||||
@@ -40,5 +40,5 @@ def journal_file_resolver(path):
|
||||
"""
|
||||
if path.endswith('/'):
|
||||
path = f'{path}index'
|
||||
path = f'journal/{path}.md'
|
||||
path = f'pages/{path}.md'
|
||||
return path
|
||||
Reference in New Issue
Block a user