def reading_plan(): page_title = "A Daily Reading" start = dt.datetime(2004, 1, 1) dates = [start + dt.timedelta(days=i) for i in range(365)] content = [(d, data.get_day_title(d.month, d.day)) for d in dates] return render_template('reading_plan_t.html', page_title=page_title, content=content)
def format_datetime(date, pre=None, post=None): pre = "" if pre is None else pre post = "" if post is None else post title = data.get_day_title(date.strftime('%m'), date.strftime('%d')) return Markup("<a href=\"/westminster-daily/{month}/{day}\" title=\"{title}\">{pre}{Month} {Day}{post}</a>".format( month=date.strftime('%m'), day=date.strftime('%d'), Month=date.strftime("%-b"), Day=date.strftime("%-d"), pre=pre, post=post, title=title ))
def render_daily_page(month, day, content, page_title=None, template='content_page_t.html', static=False, url=None): if page_title is None: page_title = data.get_day_title(month, day) if url is None: url = request.url prooftexts = any(len(c["prooftexts"]) for c in content) description = ", ".join(c['long_citation'] for c in content) return render_template(template, prooftexts = prooftexts, content=content, date=get_date(month, day), page_title=page_title, description=description, static=static, url=url)
def _feed_test(prooftexts): feed = AtomFeed(app.config['SITE_TITLE'], author=app.config['SITE_TITLE'], feed_url=request.url, url=request.url_root) now = dt.datetime.now(tz=pytz.timezone(app.config['TZ'])) for date in (now - dt.timedelta(n) for n in range(30)): month = date.strftime('%m') day = date.strftime('%d') content = data.get_day(str(date.month), str(date.day), prooftexts=prooftexts) page_title = data.get_day_title(month, day) url = "http://{}/westminster-daily/{}/{}".format(request.host, month, day) feed.add(page_title, render_daily_page(month, day, content, template='feed_item_t.html', url=url), content_type='html', url=url, published=date, updated=date) return feed