Commit 29d4b5e4 authored by David Soria Parra's avatar David Soria Parra
Browse files

Use flask to render site and get rid of submodules

We don't want to use statically generated html files anymore. We are using
flask to do the routing and render the templates for now. This means we also
get rid of the submoduels and put everything together in templates/.
parent b3036c323c2d
content =
rendered =
3aaeece2ed2e681033d6b4d7335789219046f943 content
10dae7cb77c0a3f038c639162f43cf6b297435ed rendered
(1) change your stuff in content
(2) make build
(3) check
(4) commit and push
(5) make deploy
......@@ -3,22 +3,9 @@
This is a fork of the original website. It has two goals:
* Instead of using Django to serve the site, use Blatter to generate a static version which can then be served by a normal webserver like Apache or nginx.
* Move all the content into a subrepository so volunteers can just clone that repository if they just want to edit the content.
The repository is split into three subrepositories. The `main` repository contains
scripts and templates to render the page. The `content` repository contains the
content of each page and defines the structure of the website. The `rendered`
repository contains the auto-generated pages.
If you want to help out with patches, you usually just edit hg-website and hg-website-content
and generate the rendered pages using blatter (or leave that tasks for the
This is the Mercurial website. It uses the microframework flask to serve
jinja2 templates.
......@@ -21,11 +8,6 @@
To use this version of hg-website you need to install a few things:
Blatter's prerequisites:
easy_install jinja2
easy_install werkzeug
To use this version of hg-website you need to install flask.
......@@ -31,14 +13,6 @@
My patched version of blatter (adds the ability to ignore files and add custom Jinja2 filters):
hg clone
cd blatter
python install
The python-markdown module (for rendering the website content):
easy_install markdown
pip install flsak
......@@ -41,10 +15,6 @@
To have blatter serve the page dynamically, use:
blatter serve
You can then visit [http://localhost:8008](http://localhost:8008) to view the site.
To have flask serve the page, use:
......@@ -50,3 +20,3 @@
To render a static version of the site into the `rendered/` directory:
......@@ -52,4 +22,2 @@
blatter blat
For more information on using blatter, check the README file at [](
You can then visit [http://localhost:5000](http://localhost:5000) to view the site.
# 'publish' target can be configured or use --destination
# 'serve' options
import markdown as _markdown
from jinja2 import Markup
md = _markdown.Markdown(extensions=['toc'], safe_mode=False)
def mdown(value):
return Markup(md.convert(value))
\ No newline at end of file
# (c) 2014 David Soria Parra <>
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import os
import flask
app = flask.Flask(__name__)
def indexpage():
return flask.render_template('frontpage.html')
def about(site=None):
if not site:
tpath = os.path.join('templates', site, 'index.html')
if not os.path.exists(tpath):
t = os.path.join(site, 'index.html')
return flask.render_template(t)
app.debug = True
if __name__ == '__main__':
font-family: Optimer;
src: url(/static/MgOpenCosmeticaRegular.ttf);
* Reset
......@@ -195,4 +201,3 @@
font-size: .90em;
font-style: italic;
This diff is collapsed.
This diff is collapsed.
{% extends "base.html" %}
{% block content %}
<h1>Mercurial source control management</h1>
<p><strong>Mercurial is a free, distributed source control management tool. It offers you the power to efficiently handle projects of any size while using an intuitive interface. It is easy to use and hard to break, making it ideal for anyone working with versioned files.
<h2>Distributed architecture</h2>
<p>Traditional version control systems such as Subversion are typical client-server architectures with a central server to store the revisions of a project. In contrast, Mercurial is truly distributed, giving each developer a local copy of the entire development history. This way it works independent of network access or a central server. Committing, branching and merging are fast and cheap.</p>
<p>Mercurials implementation and data structures are designed to be fast. You can generate diffs between revisions, or jump back in time within seconds. Therefore Mercurial is perfectly suitable for large projects such as OpenJDK (<a href="">hg</a>) or NetBeans (<a href="">hg</a>).</p>
<h2>Platform independent</h2>
<p>Mercurial was written with platform independence in mind. Therefore most of Mercurial is written in Python, with a small part in portable C for performance reasons. As a result, binary releases are available on all major platforms.</p>
<p>The functionality of Mercurial can be increased with extensions, either by activating the official ones which are shipped with Mercurial or downloading some <a href="">from the wiki</a> or by <a href="">writing your own</a>. Extensions are written in Python and can change the workings of the basic commands, add new commands and access all the core functions of Mercurial.</p>
<h2>Easy to use</h2>
<p>Mercurial sports a consistent command set in which most subversion users feel right at home. Potentially dangerous actions are available via extensions you need to enable, so the basic interface is easy to use, easy to learn and hard to break. The <a href="/quickstart/">Quick Start</a> should get you going in a just few minutes.</p>
<h2>Open Source</h2>
<p>Mercurial is free software licensed under the terms of the
<a href="">
GNU General Public License Version 2</a> or any later version.</p>
<h3>Similar projects</h3>
<p>Mercurial is used for version control of files. Similar projects include <a href="">Git</a> and <a href="">Bazaar</a>. Version control systems without a distributed architecture include <a href="">Subversion</a> and <a href="">CVS</a>.
<h3>The Website</h3>
<p>The <a href="/thepage">website</a> is a project of the Mercurial community.
The <a href="">source</a> is
licensed under GPLv2 or later. Feel free to send us patches.
{% endblock %}
{% block sidebar %}
{{ super() }}
{% endblock %}
......@@ -3,8 +3,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/css/styles.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="/js/typeface-0.15.js"></script>
<script type="text/javascript" src="/js/optimer_regular.typeface.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<link href="{{ url_for('static', filename='css/styles.css') }}" type="text/css" rel="stylesheet">
<script type="text/javascript" src="{{ url_for('static', filename='js/typeface-0.15.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/optimer_regular.typeface.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/common.js') }}"></script>
<script type="text/javascript" src="/sources.js"></script>
......@@ -10,5 +10,5 @@
<script type="text/javascript" src="/sources.js"></script>
<script type="text/javascript" src="/js/download.js"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/download.js') }}"></script>
<script language="javascript">
var dl =;
......@@ -21,8 +21,8 @@
<h1 id="logo"><a href="/">mercurial</a></h1>
<ul id="nav" class="typeface-js">
<li><a href="/about/">about</a></li>
<li><a href="/guide/">guide</a></li>
<li><a href="/downloads/">download</a></li>
<li><a href="/about">about</a></li>
<li><a href="/guide">guide</a></li>
<li><a href="/downloads">download</a></li>
<li><a href="">extensions</a></li>
<li><a href="">news/wiki</a></li>
......@@ -27,6 +27,6 @@
<li><a href="">extensions</a></li>
<li><a href="">news/wiki</a></li>
<li><a href="/sponsors/">sponsors</a></li>
<li><a href="/sponsors">sponsors</a></li>
<form id="search" method="get" action="">
{% extends "base.html" %}
{% block content %}
<h1>Mercurial downloads</h1>
<script language="javascript">
var versions = Downloader.versions();
var more = Downloader.maxversions &&
versions.length > Downloader.maxversions;
// Show tables for Downloader.maxversions versions
for (i in versions) {
if (more && i >= Downloader.maxversions)
// Need to localize this variable to closure it correctly
var current = versions[i];
document.write(Downloader.table(versions[i], function (o) {
return o.version == current;
function exposeversions (node) {
// Emit but do not render tables for remaining versions
var html = ''
for (i in versions) {
if (i < Downloader.maxversions)
// Need to localize this variable to closure it correctly
var current = versions[i];
html += Downloader.table(versions[i], function (o) {
return o.version == current;
node.innerHTML = html;
if (more) {
<div onclick="exposeversions(this);">\
<center id="more">[more versions]</center>\
<h5>Development Repositories</h5>
<dd>The main development repository of the Mercurial maintainer
<a href="">Matt Mackall</a>
can be found at <a href=""></a>.</dd>
<dd>The development repository of the <a
Mercurial Crew</a>
can be found at <a href=""></a>.</dd>
<dd>Mercurial uses <a href="">Python</a>
(versions <em>2.4</em> through <em>2.7</em>). Most
ready-to-run Mercurial distributions include Python or use
the Python that comes with your operating system. When
building from source you should confirm that an appropriate
Python version is available.</dd>
<h5>Older Releases</h5>
<dt>Python 2.3</dt>
<dd><a href="/release/mercurial-1.2.1.tar.gz">Mercurial 1.2.1</a>
is the last release to support Python 2.3. Use this if you
need to run Mercurial on very old platforms and you cannot update
your Python installation.</dd>
<dt>Older source releases</dt>
<dd><a href="/release/">All previous source releases</a> are available
to download.</dd>
{% endblock %}
{% block sidebar %}
<h3>Get started</h3>
<p>Mercurial is written in Python with platform independence in mind.
As a result, Mercurial is available on
<a href="">Microsoft Windows</a>,
<a href="">GNU/Linux</a>,
<a href="">Mac OS X</a>,
<a href="">Solaris 11 Express</a> and others.
You can either download a binary package for the system of your choice or
build it from sources.</p>
<p>Windows users are likely to enjoy the <a href="">TortoiseHg</a>
GUI the most. It integrates Mercurial directly into your explorer.</p>
<p>Packages for common Linux, BSD and Solaris distributions can be
installed from the system specific repositories</p>
# Debian/Ubuntu
$ apt-get install mercurial
# Fedora
$ yum install mercurial
# Gentoo
$ emerge mercurial
# FreeBSD
$ cd /usr/ports/devel/mercurial
$ make install
# Solaris 11 Express
$ pkg install SUNWmercurial
{% endblock %}
# Example script which shows the actions in the workflow guide.
# make sure , project does not exist before starting.
rm -r project feature1
# plain output
export HGPLAIN=1
echo init, add and commit
hg init project
cd project
echo "[ui]" >> .hg/hgrc
echo "username = Mr. Johnson <>" >> .hg/hgrc
echo 'print("Hello")' >
hg add
#hg commit
hg commit --date "2011-11-20 11:00" -m "Initial commit."
hg log
echo status
echo 'print("Hello World")' >
hg status
hg diff
#hg commit
hg commit --date "2011-11-20 11:11" -m "Say Hello World, not just Hello."
hg log
echo move and copy
hg cp copy
hg mv target
hg status
hg diff
hg ci --date "2011-11-20 11:20" -m "Copy and move."
echo log
hg log
echo Lone developer with nonlinear history
hg update 1
hg identify -n
echo 'print("Hello Mercurial")' >
hg ci --date "2011-11-20 20:00" -m "Greet Mercurial"
hg merge
hg ci --date "2011-11-20 20:11" -m "merge greeting and copy+move."
hg log
cd ..
hg clone project feature1
cd feature1
hg update 3
echo 'print("Hello feature1")' >
hg commit --date "2011-11-20 20:11:11" -m "Greet feature1"
cd ../project
hg in ../feature1
hg pull ../feature1
hg merge
hg commit --date "2011-11-20 20:20" -m "merged feature1"
hg log -r -1:-3
hg rollback
hg commit --date "2011-11-20 20:20:11 +1100" -m "Merged Feature 1"
hg log -r -1:-2
echo sharing changes
hg out ../feature1
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment