Skip to content

Commit

Permalink
Update people table
Browse files Browse the repository at this point in the history
  • Loading branch information
mfherbst committed Nov 4, 2023
1 parent 7b467eb commit f70cc1e
Show file tree
Hide file tree
Showing 13 changed files with 147 additions and 35 deletions.
Binary file added _assets/icons/arxiv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/icons/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/icons/gscholar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/icons/orcid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/icons/website.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 30 additions & 9 deletions _css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,34 @@ a.sidebar-nav-subitem:focus {
/* TODO styling of news-block on front page */
}

.franklin-content img.profile-img {
border-radius: 50% !important;
height: auto;
width: 3.8rem;
max-width: 100%;
min-width: 40px;
margin: 0;
padding: 0;
margin-top: -2px;
margin-bottom: -2px;
}

.franklin-content img.social-logo {
width: 16px;
min-width: 16px;
height: 16px;
min-height: 16px;
display: inline-block;
margin: 0;
padding: 0;
margin-right: .6ex;
vertical-align: -0.2em;
opacity: 0.95;
}

.content .weak-text {
color: #909090;
}

/*
* EPFL adaption
Expand Down Expand Up @@ -194,12 +222,5 @@ a.sidebar-nav-subitem:focus {

.sidebar .sidebar-nav a:hover { color: #ee3333; text-decoration: none; }

.profile-img {
border-radius: 50% !important;
height: auto;
max-width: 100%;
margin: 0;
padding: 0;
margin-top: -2px;
margin-bottom: -2px;
}


1 change: 1 addition & 0 deletions _data/0_update_people_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function augment_defaults!(data::AbstractDict)
get!(data, "website", "https://people.epfl.ch/$(data["sciper"])")
get!(data, "gscholar", "")
get!(data, "orcid", "")
get!(data, "arxiv", "")
get!(data, "github", "")
get!(data, "current", true)
data
Expand Down
6 changes: 5 additions & 1 deletion _data/people.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[charles-julie]
arxiv = ""
current = true
email = "[email protected]"
firstname = "Julie"
Expand All @@ -13,11 +14,12 @@ sciper = 372532
website = "https://people.epfl.ch/372532"

[herbst-michael]
arxiv = "herbst_m_1"
current = true
email = "[email protected]"
firstname = "Michael F."
github = "mfherbst"
gscholar = "https://scholar.google.com/citations?user=9jBO8o4AAAAJ"
gscholar = "9jBO8o4AAAAJ"
name = "Herbst"
orcid = "0000-0003-0378-7921"
phone = "+41216938989"
Expand All @@ -28,6 +30,7 @@ sciper = 368484
website = "https://michael-herbst.com"

[schmitz-niklas]
arxiv = ""
current = true
email = "[email protected]"
firstname = "Niklas Frederik"
Expand All @@ -42,6 +45,7 @@ sciper = 299719
website = "https://people.epfl.ch/299719"

[travelletti-cedric]
arxiv = ""
current = true
email = "[email protected]"
firstname = "Cédric"
Expand Down
6 changes: 0 additions & 6 deletions _layout/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ <h1><a href="/">Mathematics for Materials Modelling</a></h1>
{{end}}
<a class="sidebar-nav-item {{ispage contact/*}}active{{end}}" href="/contact/" >Contact</a>
</nav>
<!--
<form id="lunrSearchForm" name="lunrSearchForm">
<input class="search-input" name="q" placeholder="Enter search term" type="text">
<input type="submit" value="Search" formaction="/search/index.html">
</form>
-->
<br />
<br />
</div>
Expand Down
2 changes: 1 addition & 1 deletion config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prepath = ""
# these files might be copied and, if markdown, processed by Franklin which
# you might not want. Indicate directories by ending the name with a `/`.
# Base files such as LICENSE.md and README.md are ignored by default.
ignore = ["node_modules/", "_data"]
ignore = ["node_modules/", "_data", "Project.toml", "Manifest.toml"]

# RSS (the website_{title, descr, url} must be defined to get RSS)
generate_rss = false
Expand Down
6 changes: 4 additions & 2 deletions contact.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@def title = "Contact"

{{ email_unprotect_js }}

# Contact

## Head of group
**Prof. Michael F. Herbst**\newline
Email: [email protected]\newline
Email: {{ protect_email [email protected] }}\newline
Office: [MA B1 467](https://plan.epfl.ch/?room==MA%20B1%20467)

## Administration
**Ms. Julie Charles**\newline
Email: [email protected]\newline
Email: {{ protect_email [email protected] }}\newline
Tel: +41 21 693 83 56\newline
Office: [MA B1 483](http://plan.epfl.ch/?room==MA%20B1%20483)

Expand Down
4 changes: 2 additions & 2 deletions people.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@def title = "People"

# People
{{ email_unprotect_js }}

<!-- Larger box of Michael -->
# People

{{ people_table }}
118 changes: 104 additions & 14 deletions utils.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
using TOML
using Markdown: htmlesc

"""Insert a javascript blob for assembling emails"""
function hfun_email_unprotect_js()
return """<script>
function msgto(mailID, mailDomain) {
var txt = mailID;
txt = txt + "@" + mailDomain;
document.write('<a href="mailto:'+ txt + '">' + txt + '</a>');
}
</script>"""
end

function protected_email_link(email::AbstractString)
dest, domain = split(email, "@")
("""<script>msgto('$dest', '$domain')</script>""" *
"""<noscript>Enable JavaScript to see email</noscript>""")
end
hfun_protect_email(params) = protected_email_link(params[1])


"""Get all news sorted by publication date"""
Expand Down Expand Up @@ -96,28 +115,99 @@ function normalised_from_email(s::AbstractString)
join(reverse(components), "-")
end

function roomlink(room::AbstractString)
if isempty(room)
room
else
"""<a href="https://plan.epfl.ch/?room==$(htmlesc(room))">$room</a>"""
end
end

function social_imagelink(key, value)
linkprefix = Dict(
"arxiv" => "https://arxiv.org/a/",
"orcid" => "https://orcid.org/",
"gscholar" => "https://scholar.google.com/citations?user=",
"github" => "https://github.com/",
)
linktext = Dict(
"gscholar" => "Google Scholar",
"arxiv" => "ArXiv",
"orcid" => "ORCID",
)

io = IOBuffer()
print(io, """<a href="$(get(linkprefix, key, ""))$value" >""")
print(io, """<img class="social-logo" alt="$key" src="/assets/icons/$key.png"/>""")
print(io, """$(get(linktext, key, uppercasefirst(key)))""")
print(io, """</a>""")
String(take!(io))
end

function people_row(data::AbstractDict; showroom=true)
maxsocial = showroom ? 4 : 3

io = IOBuffer()
print(io, "<tr>")

# Profile picture
imgkey = normalised_from_email(data["email"])
print(io, """<td><a href="$(data["website"])">""")
print(io, """<img class="profile-img" src="/assets/people/$imgkey.jpg" />""")
print(io, """</a></td>""")

# Name, Email, Function, Office
print(io, """<td><strong><a href="$(data["website"])">$(data["firstname"]) """ *
"""$(data["name"])</a></strong>""")
print(io, """<br />$(data["position"])""")
print(io, """<br /><span class="weak-text">Email:</span> """ *
"""$(protected_email_link(data["email"]))""")
if showroom
print(io, """<br /><span class="weak-text">Office:</span> """ *
"""$(roomlink(data["room"]))""")
end
print(io, """</td>""")

# Social links
print(io, "<td>")
nsocial = 0
for key in ["website", "gscholar", "orcid", "github", "arxiv"]
value = get(data, key, "")
if !isempty(value) && nsocial < maxsocial
print(io, social_imagelink(key, value))
nsocial += 1
nsocial < maxsocial && print(io, "<br />")
end
end
print(io, "<br />"^(maxsocial-nsocial))
print(io, "</td>")

print(io, "</tr>")
String(take!(io))
end

function hfun_people_table()
data = open(TOML.parse, "_data/people.toml", "r")
people = sort(collect(values(data)), by=d -> (get(d, "priority", 0), d["name"]))

io = IOBuffer()

println(io, "<table>")
for p in people
imgkey = normalised_from_email(p["email"])
print(io, "<tr>")
print(io, replace("""<td>
<a href="$(p["website"])">
<img style="width:1.9rem;" class="profile-img" src="/assets/people/$imgkey.jpg" />
</a></td>
""", "\n" => ""))
print(io, """<td><a href="$(p["website"])">$(p["firstname"] * " " * p["name"])</a></td>""")
print(io, "<td>$(p["position"])</td>")
print(io, "<td>$(p["email"])</td>")
print(io, "<td>$(p["room"])</td>")
print(io, "<td></td>") # TODO Extra stuff (website, scholar, github, etc.)

println(io, "</tr>")
p["current"] || continue
println(io, people_row(p; showroom=true))
end
println(io, "</table>")

if !all(p -> p["current"], people)
println(io, "<h2>Former members</h2>")
println(io, "<table>")
for p in people
p["current"] && continue
println(io, people_row(p; showroom=false))
end
println(io, "</table>")
end

String(take!(io))
end

0 comments on commit f70cc1e

Please sign in to comment.