Skip to content
Permalink
Browse files

Restructure site to contain an english-only blog

  • Loading branch information...
Jakob Holderbaum
Jakob Holderbaum committed Nov 28, 2018
1 parent 80a44b2 commit 2a214f677ea07bdfcd04845b074233a156a82e8f
@@ -2,5 +2,6 @@ source 'https://rubygems.org'

gem 'faraday'
gem 'kramdown'
gem 'kramdown-metadata-parsers'
gem 'sinatra'
gem 'sinatra-contrib'
@@ -13,6 +13,8 @@ GEM
i18n (1.1.1)
concurrent-ruby (~> 1.0)
kramdown (1.17.0)
kramdown-metadata-parsers (0.9.0)
kramdown (>= 1.4)
minitest (5.11.3)
multi_json (1.13.1)
multipart-post (2.0.0)
@@ -44,6 +46,7 @@ PLATFORMS
DEPENDENCIES
faraday
kramdown
kramdown-metadata-parsers
sinatra
sinatra-contrib

@@ -0,0 +1,5 @@
# Think About! Blog

This is our conference blog where we keep you posted about things..

We would also like to have a better text here..
@@ -5,23 +5,35 @@ class Builder
def initialize(source_dir, target_dir)
@source_dir = source_dir
@target_dir = target_dir
@renderer = Renderer.new(@source_dir)
end

def run
renderer = Renderer.new(@source_dir)
languages = %w[en de]

languages.each do |lang|
Dir['pages/**'].each do |page|
file = page.gsub(/\.erb$/, '').gsub(%r{^pages/}, '')
file = '' if file == 'index.html'
result = renderer.render(lang, file)
target_path = File.join(@target_dir, lang, result.filename)
FileUtils.mkdir_p(File.dirname(target_path))
File.write(target_path, result.content)
Dir['pages/*'].each do |page|
next if File.directory? page
build_page File.join(@target_dir, lang), lang, page
end
end

Dir['pages/blog/*'].each do |page|
next if File.directory? page
build_page @target_dir, 'en', page.gsub(/\.md$/, '.html')
end

FileUtils.cp_r(File.join(@source_dir, 'assets'), @target_dir)
end

private

def build_page(target_dir, lang, page)
file = page.gsub(/\.erb$/, '').gsub(%r{^pages/}, '')
file = '' if file == 'index.html'
result = @renderer.render(lang, file)
target_path = File.join(target_dir, result.filename)
FileUtils.mkdir_p(File.dirname(target_path))
File.write(target_path, result.content)
end
end
@@ -11,12 +11,23 @@ def initialize(source_dir = nil)
def render(lang, url)
file = resolve_path(url)
type = resolve_type(file)
if type == 'text/html'
template = ERB.new(File.read('template.html.erb'))
values = TemplateValues.new(lang, url, file, render_page(lang, url, file))
if type == 'text/html' || type == 'text/markdown'
type = 'text/html'
template = ERB.new(File.read(template_for(file)))
page = render_page(lang, url, file)
values = TemplateValues.new(lang, url, file, page.content, page.meta)
Result.new(template.result(values._context), url, type)
else
Result.new(render_page(lang, url, file), url, type)
page = render_page(lang, url, file)
Result.new(page.content, url, type)
end
end

def template_for(file)
if file.start_with? 'blog/'
'template-blog.html.erb'
else
'template.html.erb'
end
end

@@ -41,6 +52,7 @@ def file?(path)

def resolve_path(file)
return file if file?(path(file))
return file.gsub(/\.html$/, '.md') if file?(path(file).gsub(/\.html$/, '.md'))
return resolve_path(file + '.erb') if file?(path(file + '.erb'))
return resolve_path(File.join(file, 'index.html')) if dir?(path(file))
raise RenderError.new(404, "File not found: #{file}")
@@ -54,18 +66,40 @@ def resolve_type(filename)
'image/svg+xml'
when '.png'
'image/png'
when '.md'
'text/html'
else
'text/html'
end
end

def render_page(lang, url, file)
result = RenderedPage.new

if File.extname(file) == '.erb'
template = ERB.new(File.read(path(file)))
values = PageValues.new(lang, url, file)
template.result(values._context)
result.content = template.result(values._context)
elsif File.extname(file) == '.md'
text = File.read(path(file))
doc = Kramdown::Document.new(text, input: 'MetadataKramdown')
result.content = doc.to_html
result.meta = doc.root.metadata
else
File.read(path(file))
result.content = File.read(path(file))
end

result
end
end

class Renderer
class RenderedPage
attr_accessor :content
attr_writer :meta

def meta
@meta ||= {}
end
end
end
@@ -93,15 +127,19 @@ def filename
class Renderer
class Values
attr_reader :lang, :url, :file
attr_accessor :locals

def initialize(lang, url, file)
@lang = lang
@url = url
@file = file
@locals = {}
end

def partial(key)
ERB.new(File.read("partials/#{key}.html.erb")).result(_context)
def partial(key, locals = {})
copy = dup
copy.locals = locals
ERB.new(File.read("partials/#{key}.html.erb")).result(copy._context)
end

def content(key)
@@ -145,11 +183,18 @@ def _context

class Renderer
class TemplateValues < Values
attr_reader :main
attr_reader :main, :meta

def initialize(lang, url, file, main)
def initialize(lang, url, file, main, meta = {})
super lang, url, file
@main = main
@meta = meta.each_with_object({}) do |(k, v), result|
result[k.to_sym] = v
end
end

def is_blog_post?
file.start_with?('blog/') && file.end_with?('md')
end
end
end
@@ -7,6 +7,14 @@ class Server < Sinatra::Application
status 404
end

get '/:ignore.png' do
status 404
end

get '/:ignore.svg' do
status 404
end

get '/assets/*' do
renderer = Renderer.new
file = params[:splat].first
@@ -15,11 +23,24 @@ class Server < Sinatra::Application
result.content
end

get '/:lang/*' do
get '/blog/**' do
begin
renderer = Renderer.new
lang = 'en'
file = 'blog' + params[:splat].join('/')
result = renderer.render(lang, file)
content_type result.type
result.content
rescue Renderer::RenderError => e
[e.type, e.text]
end
end

get '/:lang/**' do
begin
renderer = Renderer.new
lang = params[:lang]
file = params[:splat].first
file = params[:splat].join('/')
result = renderer.render(lang, file)
content_type result.type
result.content
@@ -0,0 +1,132 @@
---
title: This is a Blog Post
date: 2018-12-02
author: Jakob
---

All attendees, speakers, sponsors, organizers and volunteers at our conference
are required to agree with the following code of conduct. Our Awareness-Team
will enforce this code throughout the event. We expect cooperation from all
participants to help ensure a safe environment for everybody.

## The Quick Version

Our conference is dedicated to provide a harassment-free conference experience
for everyone, regardless of gender, gender identity and expression, age, sexual
orientation, disability, physical appearance, body size, race, ethnicity,
religion (or lack thereof), or technology choices. We do not tolerate
harassment of conference participants in any form.

Sexual language and imagery is not appropriate for any conference venue,
including talks, workshops, parties, Twitter and other online media. If talks
are related to sexuality exceptions can be made if this is discussed with the
organizers beforehand and is announced in advance. Conference participants
violating these rules may be sanctioned or expelled from the conference without
a refund at the discretion of the conference’s Awareness-Team.

## The Less Quick Version

Harassment includes offensive verbal comments related to gender, gender
identity and expression, age, sexual orientation, disability, physical
appearance, body size, race, ethnicity, religion, technology choices, sexual
images in public spaces, deliberate intimidation, stalking, following,
harassing photography or recording, sustained disruption of talks or other
events, inappropriate physical contact, and unwelcome sexual attention.

Participants asked to stop any harassing behavior are expected to comply immediately.

Sponsors are also subject to this code. In particular,
sponsors should not use sexualised images, activities, or other material. Booth
staff (including volunteers) should not use sexualised
clothing/uniforms/costumes, or otherwise create a sexualised environment.

If a participant engages in harassing behavior, the conference’s Awareness-Team
may take any action they deem appropriate, including warning the offender or
expulsion from the conference with no refund.

If you are being harassed, notice that someone else is being harassed, or have
any other concerns, please contact a member of conference staff or the
conference’s Awareness-team immediately.

The Awareness-team can be visually identified – details will be published here
in advance. We expect participants to follow these rules at the conference
venues and conference-related social events.

Inspired by: [http://confcodeofconduct.com/](http://confcodeofconduct.com/)

# Our Awareness Teams {#awareness}

[Back to top](#backtotop)

To create a pleasant, safe and respectful atmosphere for all participants of
the Think About! conference we have two Awareness-Teams available during the
conference. "Awareness" in this case means the recognition or perception of
verbal, psychological or physical violations of personal boundaries.

The Teams consist of two people of different genders and are experienced in the
care and consultation of people who have experienced boundary-crossing
situations. One team will be moving freely on the location, another one can be
reached at a fixed position which will be communicated in advance. They will
also be available via a phone number which will be published here as well.

One can also contact the Awareness Team through any of the other conference officials (people working at the conference).

The Awareness Team may warn offenders or exclude them from the conference with no refund.

Further details about our Awareness-Structure and our conduct during incidents will be published here in the future.

You can contact us before or after the conference as well.

The organization team may be reached via mail under the following addresses:

[chrissi@think-about.io](mailto:chrissi@think-about.io) ([GPG](/assets/chrissi.asc))
[jakob@think-about.io](mailto:jakob@think-about.io) ([GPG](/assets/jakob.asc))
[andreas@think-about.io](mailto:andreas@think-about.io) ([GPG](/assets/andreas.asc))

We shall soon be providing a list of external organizations you may also wish to contact.

# Message of Empowerment {#empowerment}

[Back to top](#backtotop)

You don't have to be able to hack NASA in order to be a part of the Think About! conference. As long as you are considerate of others and intend to learn, you have a place here.

You have the right to decide when, where and by
whom you want to be photographed or filmed. We have available colour-coded conference lanyards for anyone who would prefer not to be photographed or filmed.

You have the right to be treated fairly. Nobody has the right to threaten you or scare you. No matter how. Nobody is allowed to blackmail you, treat you
poorly or hurt you. You decide what goes beyond your limits, nobody else.

You have the right to decide how close people can be to you. Nobody is allowed to touch you, massage you, caress you, kiss you without your consent, or push you to do so to someone else.

You have the right to say NO and to resist when someone oversteps your borders, hurts your feelings or those of someone else. You can say NO with facial
expressions, words or body language. Even if you have said YES before.

Adapted from Amyna e.V., Institute for prevention of sexual abuse via
[Geheimorganisation.org](http://diversity.geheim.org/) at the 34C3.

# Respecting Data Sovereignty {#privacy}

[Back to top](#backtotop)

To conduct this conference, we have to store a certain amount of data about
attendees, speakers and sponsors. We believe that the personal data of
individuals should be respected as a private good - so our promise to you is
that we will never share your personal data beyond the minimal technical
necessity. That would be:

* Storing it at out ticket provider ([Pretix](https://pretix.eu) in Germany)
* Giving payment information to the payment provider selected during checkout
\- unless you wire the money via regular bank transaction
* Storing it in our conference management tool Frab (hosted by
[Hetzner](https://hetzner.de) in Germany)
* Storing it in our newsletter management tool Mailtrain if you subscribed to
our newsletter (hosted by [Hetzner](https://hetzner.de) in Germany)

We will neither sell your data nor give it away to any third party without your explicit consent, not even sponsors.

# Disclaimer

This document is a work in progress and will be updated from time to time. In
case you want to participate we welcome you to get in touch with us and send us
your feedback or your suggestions.
Oops, something went wrong.

0 comments on commit 2a214f6

Please sign in to comment.
You can’t perform that action at this time.