Skip to content

Commit

Permalink
Use markdown for static content
Browse files Browse the repository at this point in the history
Mostly because life is too short for translating things into HTML when
a computer can do it for us.
  • Loading branch information
jellybob committed Dec 17, 2023
1 parent d7a6066 commit 2096154
Show file tree
Hide file tree
Showing 35 changed files with 614 additions and 835 deletions.
127 changes: 41 additions & 86 deletions apps/base/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,110 +5,65 @@
although some legacy content remains here.
"""

from flask import redirect, render_template, url_for
from . import base


@base.route("/about")
def about():
return render_template("about/index.html")


@base.route("/about/travel")
def travel():
return render_template("about/getting-there.html")


@base.route("/about/arrival-times")
def arrival():
return render_template("about/arrival-times.html")


@base.route("/about/covid")
def covid():
return redirect(url_for(".health"))


@base.route("/about/health")
def health():
return render_template("about/health.html")


@base.route("/about/privacy")
def privacy():
return render_template("about/privacy.html")


@base.route("/about/power")
def power():
return render_template("about/power.html")
from flask import abort, redirect, render_template, url_for
from markdown import markdown
from os import path


# @base.route("/about/internet")
# def internet():
# return render_template("about/internet.html")
from markupsafe import Markup
from yaml import safe_load as parse_yaml
from . import base


@base.route("/about/accessibility")
def accessibility():
return render_template("about/accessibility.html")
def page_template(metadata):
if "show_nav" not in metadata or metadata["show_nav"]:
return "about/page_with_nav.html"
else:
return "about/page.html"


@base.route("/about/villages")
def villages():
return render_template("about/villages.html")
def render_markdown(source, template, **view_variables):
if not path.exists(f"templates/{source}.md"):
abort(404)

with open(f"templates/{source}.md", "r") as f:
source = f.read()
(metadata, content) = source.split("---", 2)
metadata = parse_yaml(metadata)
content = Markup(markdown(content, extensions=["markdown.extensions.nl2br"]))

@base.route("/about/childcare")
def childcare():
return render_template("about/childcare.html")
view_variables.update(content=content, title=metadata["title"])
return render_template(template, **view_variables)


@base.route("/about/branding")
def branding():
return render_template("branding.html")
@base.route("/about/<page_name>")
def page(page_name: str):
return render_markdown(
f"about/{page_name}", "about/template.html", page_name=page_name
)


@base.route("/about/design-elements")
def design_elements():
return render_template("design.html")
# About and Contact have actual logic in them, so remain as HTML rather than
# markdown
@base.route("/about")
def about():
return render_template("about/index.html")


@base.route("/about/company")
@base.route("/company")
def company():
return render_template("about/company.html")


@base.route("/about/volunteering")
def volunteering():
return render_template("about/volunteering.html")


@base.route("/about/volunteer-roles")
def volunteer_roles():
return render_template("about/volunteer-roles.html")


@base.route("/about/what_to_bring")
def what_to_bring_redirect():
return redirect(url_for(".what_to_bring"))
return render_markdown("about/company", "static_page.html")


@base.route("/about/what-to-bring")
def what_to_bring():
return render_template("about/what-to-bring.html")


@base.route("/about/bring-and-donate")
def bring_and_donate():
return render_template("about/bring-and-donate.html")


@base.route("/about/food")
def food():
return render_template("about/food.html")
@base.route("/about/privacy")
def privacy():
return render_markdown("about/privacy", "static_page.html")


@base.route("/about/contact")
def contact():
return render_template("about/contact.html")


@base.route("/about/covid")
def covid():
return redirect(url_for(".health"))
97 changes: 49 additions & 48 deletions templates/_footer.html
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
<footer role="contentinfo">
<div id="bottom-menu-container">
<ul class="menu" role="menu">
<li role="presentation">
<a role="menuitem" rel="noopener" target="_blank" href="https://wiki.emfcamp.org">Wiki</a>
</li>
<li role="presentation">
<a role="menuitem" rel="noopener" target="_blank" href="https://blog.emfcamp.org">Blog</a>
</li>
<li role="presentation">
<a role="menuitem" target="_blank" href="{{ url_for('base.code_of_conduct') }}">
Code of Conduct</a>
</li>
{% if SITE_STATE != 'before-sales' %}
{% if current_user.is_authenticated %}
<li role="presentation">
<a role="menuitem" href="{{ url_for('users.account') }}">My account</a>
</li>
{% else %}
<li role="presentation">
<a role="menuitem" href="{{ url_for('users.login') }}">Log in</a>
</li>
{% endif %}
{% endif %}
{% if not feature_enabled('VOLUNTEERS_SIGNUP') %}
<li role="presentation">
<a role="menuitem" href="{{ url_for('base.volunteering')}}">Volunteering</a>
</li>
{% endif %}
<li role="presentation">
<a role="menuitem" href="http://developer.emfcamp.org/">API</a>
</li>
<li role="presentation">
<a role="menuitem" href="{{ url_for('base.feedback') }}">Feedback</a>
</li>
<li role="presentation">
<a role="menuitem" href="{{ url_for('base.contact') }}">Contact</a>
</li>
</ul>
<div class="share">
<a rel="noreferrer" target="_blank" href="https://social.emfcamp.org/@emf">@[email protected]</a>
</div>
<div style="clear: both"></div>
<div id="bottom-menu-container">
<ul class="menu" role="menu">
<li role="presentation">
<a role="menuitem" rel="noopener" target="_blank" href="https://wiki.emfcamp.org">Wiki</a>
</li>
<li role="presentation">
<a role="menuitem" rel="noopener" target="_blank" href="https://blog.emfcamp.org">Blog</a>
</li>
<li role="presentation">
<a role="menuitem" target="_blank" href="{{ url_for('base.code_of_conduct') }}">
Code of Conduct</a>
</li>
{% if SITE_STATE != 'before-sales' %}
{% if current_user.is_authenticated %}
<li role="presentation">
<a role="menuitem" href="{{ url_for('users.account') }}">My account</a>
</li>
{% else %}
<li role="presentation">
<a role="menuitem" href="{{ url_for('users.login') }}">Log in</a>
</li>
{% endif %}
{% endif %}
{% if not feature_enabled('VOLUNTEERS_SIGNUP') %}
<li role="presentation">
<a role="menuitem" href="{{ url_for('base.volunteering')}}">Volunteering</a>
</li>
{% endif %}
<li role="presentation">
<a role="menuitem" href="http://developer.emfcamp.org/">API</a>
</li>
<li role="presentation">
<a role="menuitem" href="{{ url_for('base.feedback') }}">Feedback</a>
</li>
<li role="presentation">
<a role="menuitem" href="{{ url_for('base.contact') }}">Contact</a>
</li>
</ul>
<div class="share">
<a rel="noreferrer" target="_blank" href="https://social.emfcamp.org/@emf">@[email protected]</a>
</div>
<div id="credits">
<p>&copy; {{ year }} <a href="{{url_for('base.company')}}">Electromagnetic Field</a> |
<a href="{{url_for('base.privacy')}}">Privacy</a> |
Kindly hosted by <a href="http://www.sargasso.co.uk/from/emfcamp">Sargasso Networks</a></p>
</div>
<div style="clear:both"></div>
<div style="clear: both"></div>
</div>
<div id="credits">
<p>&copy; {{ year }} <a href="{{url_for('base.company')}}">Electromagnetic Field</a> |
<a href="{{url_for('base.page', page_name='privacy')}}">Privacy</a> |
Kindly hosted by <a href="http://www.sargasso.co.uk/from/emfcamp">Sargasso Networks</a>
</p>
</div>
<div style="clear:both"></div>
</footer>
22 changes: 0 additions & 22 deletions templates/about/_nav.html

This file was deleted.

35 changes: 0 additions & 35 deletions templates/about/accessibility.html

This file was deleted.

19 changes: 19 additions & 0 deletions templates/about/accessibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
title: Accessibility
---
# Accessibility
We try and do everything we can to make EMF as accessible as possible, however it is ultimately a camping event in a field, and we can't work miracles.

The site will be well-lit during the event, and we will aim to cover access to the stages with trackway. Travelling between stages may take some time, and the site is quite hilly.

## Arriving by train
Ledbury train station is not wheelchair-accessible. The London/Birmingham-bound platform can only be accessed via a narrow footbridge with a significant number of steps. Consequently we have decided not to provide a wheelchair-accessible shuttle bus to the station.

## Parking and Camping
There is a designated accessible parking area just outside the main gate. Please let the stewards know where you're heading and they can direct you there.

The accessible camping area is located at the quiet end of the site, close to the parking area, and close to accessible toilets and showers.

As with everywhere on site, [power will be available](/about/power). However, we're unable to guarantee the 24/7 availability of power for medical devices such as CPAP machines.

## Carer Tickets
If you require a ticket for a carer to come to EMF with you, we are happy to provide these for free. Once you've bought your ticket, please [email us](mailto:[email protected]) with the name and email address of your carer, and we will issue them a ticket.
28 changes: 0 additions & 28 deletions templates/about/arrival-times.html

This file was deleted.

21 changes: 21 additions & 0 deletions templates/about/arrival-times.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
title: Arrival & Departure Times
fixme: EVENT_START, EVENT_END, if you're updating them you need to set times here too!
---
# Arrival & Departure Times

<ul id="opening-times" class="well">
<li>The site is open to the public from: <strong>Thursday 30 May 10am</strong></li>
<li>It closes at: <strong>Monday 3 June 12pm (midday)</strong></li>
</ul>

## More detailed times

**Thursday 30 May 10am** -- Gates open. You can be on site from now; it's intended for folks to have a chance to set up their tents, find one another and get comfortable.
**Friday 31 May 12pm (midday)** -- Talks start on our stages.
**Monday 3 June 12pm (midday)** -- Site closes to the public.

## Set up & tear down

The site is not open before **Thursday 10am**. A number of people will be on-site before then setting things up (e.g. volunteers, villages and installations). To be on site during the set-up you must have organised it with us, and received confirmation, before you arrive. Please, do not turn up before Thursday unless we're expecting you.

Similarly, from **Monday midday** we will be tearing down the site and if you're still on-site, you will need to have arranged this with us.
Loading

0 comments on commit 2096154

Please sign in to comment.