Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SWIFTweb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTweb
Commits
665bb3a0
Commit
665bb3a0
authored
7 years ago
by
Josh Borrow
Browse files
Options
Downloads
Patches
Plain Diff
Added markdown compilation for individual templates
parent
23f68b32
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
compiler.py
+22
-7
22 additions, 7 deletions
compiler.py
data/contact.md
+21
-0
21 additions, 0 deletions
data/contact.md
data/contact.yaml
+17
-0
17 additions, 0 deletions
data/contact.yaml
templates/contact.html
+26
-0
26 additions, 0 deletions
templates/contact.html
with
86 additions
and
7 deletions
compiler.py
+
22
−
7
View file @
665bb3a0
...
...
@@ -9,6 +9,7 @@ from distutils.dir_util import copy_tree
import
jinja2
import
yaml
import
pypandoc
def
get_from_filesystem
(
template_names
,
template_dir
=
"
.
"
,
data_dir
=
"
../data
"
):
...
...
@@ -26,22 +27,35 @@ def get_from_filesystem(template_names, template_dir=".", data_dir="../data"):
def
get_associated_data
(
template_names
,
data_dir
=
"
../data
"
):
"""
Grabs the data from yaml files within the data directory if they
exist,
and if not returns an empty dictionary for that item.
"""
"""
Grabs the data from yaml
/md
files within the data directory if they
exist,
and if not returns an empty dictionary for that item.
"""
data
=
[]
for
template
in
template_names
:
# swap that .html for a .yaml
# swap that .html for a .yaml
and a .md
stub
=
template
.
split
(
"
.
"
)[
0
]
filename
=
f
"
{
data_dir
}
/
{
stub
}
.yaml
"
this_data
=
{}
# we will start with empty and add to it.
# YAML Search
try
:
with
open
(
f
ilename
,
"
r
"
)
as
handle
:
data
.
append
(
yaml
.
load
(
handle
))
with
open
(
f
"
{
data_dir
}
/
{
stub
}
.yaml
"
,
"
r
"
)
as
handle
:
this_data
=
dict
(
yaml
.
load
(
handle
)
,
**
this_data
)
except
FileNotFoundError
:
data
.
append
({})
pass
# Markdown Search
try
:
with
open
(
f
"
{
data_dir
}
/
{
stub
}
.md
"
,
"
r
"
)
as
handle
:
markdown
=
pypandoc
.
convert_text
(
handle
.
read
(),
'
html
'
,
'
md
'
)
this_data
[
"
markdown_content
"
]
=
markdown
except
FileNotFoundError
:
pass
data
.
append
(
this_data
)
return
data
...
...
@@ -131,6 +145,7 @@ if __name__ == "__main__":
"
pubs.html
"
,
"
talks.html
"
,
"
about.html
"
,
"
contact.html
"
]
STATIC
=
[
...
...
This diff is collapsed.
Click to expand it.
data/contact.md
0 → 100644
+
21
−
0
View file @
665bb3a0
## Contact Us
Hello there! You can contact us using the form below (that goes out to a third party where you'll have to use a capatcha).
<form action="https://formspree.io/your@email.com"
method="POST">
<input
type=
"text"
name=
"name"
>
<input
type=
"email"
name=
"_replyto"
>
<textarea>
Your message here...
</textarea>
<input
type=
"submit"
value=
"Send"
>
</form>
If you would prefer to contact us through the post, you can do that at the following address:
The SWIFT Team
<br/>
Institute for Computational Cosmology
<br/>
Ogden Centre for Fundamental Physics - West
<br/>
Department of Physics
<br/>
Durham University
<br/>
South Road
<br/>
Durham DH1 3LE
<br/>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/contact.yaml
0 → 100644
+
17
−
0
View file @
665bb3a0
people
:
[
Dr. Pedro Gonnet
,
Dr. Matthieu Schaller
,
Mr. Aidan Chalk
,
Mr. James S. Willis
,
Mr. Angus Lepper
,
Dr. John A. Regan
,
Mr. Stefan Arridge
,
Pr. Tom Theuns
,
Pr. Richard G. Bower
,
Dr. Peter Draper
,
Dr. Lydia Heck
,
Dr. Tobias Weinzierl
,
Dr. Stephen McGough
,
Pr. Georgios Theodoropoulos
,
Mr. Joshua Borrow
,
]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
templates/contact.html
0 → 100644
+
26
−
0
View file @
665bb3a0
{% extends "base.html" %}
{% import "helpers.html" as helper %}
{% block title %}Contact Us{% endblock %}
{% block content %}
{{ helper.wide_header() }}
<div
class=
"container"
>
{{ helper.navbar(navbar, link) }}
<div
class=
"content"
>
<div
class=
"text"
>
{{ markdown_content }}
</div>
<div
class=
"sidebar"
>
<h2>
People
</h2>
<p>
The following people are involved in SWIFT:
</p>
<ul>
{% for person in people %}
<li>
{{ person }}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment