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 = https://bitbucket.org/segv/hg-website-content
rendered = https://bitbucket.org/segv/hg-website-rendered
3aaeece2ed2e681033d6b4d7335789219046f943 content
10dae7cb77c0a3f038c639162f43cf6b297435ed rendered
HOW TO BUILD
-----------
(1) change your stuff in content
(2) make build
(3) check
(4) commit and push
(5) make deploy
......@@ -3,22 +3,9 @@
hg-website
==========
This is a fork of the original hg-scm.org 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.
Repository
---------
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
maintainer).
This is the Mercurial website. It uses the microframework flask to serve
jinja2 templates.
Setup
-----
......@@ -21,11 +8,6 @@
Setup
-----
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 http://bitbucket.org/sjl/blatter/
cd blatter
python setup.py install
The python-markdown module (for rendering the website content):
easy_install markdown
pip install flsak
Usage
-----
......@@ -41,10 +15,6 @@
Usage
-----
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:
python run.py
......@@ -52,4 +22,2 @@
blatter blat
For more information on using blatter, check the README file at [http://bitbucket.org/sjl/blatter/src/](http://bitbucket.org/sjl/blatter/src/)
You can then visit [http://localhost:5000](http://localhost:5000) to view the site.
[blatter]
static_dir=static
template_dir=templates
dynamic_dir=content
output_dir=rendered
# 'publish' target can be configured or use --destination
#publish_location=/local/path
# 'serve' options
index_document=index.html
url_prefix=/
filters=markdown
[filter.markdown]
name=markdown
function=filters.mdown
import markdown as _markdown
from jinja2 import Markup
md = _markdown.Markdown(extensions=['toc'], safe_mode=False)
def mdown(value):
return Markup(md.convert(value))
.hg
.DS_Store
README
\ No newline at end of file
#
# (c) 2014 David Soria Parra <dsp@php.net>
#
# 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__)
@app.route('/')
def indexpage():
return flask.render_template('frontpage.html')
@app.route('/<site>')
def about(site=None):
if not site:
flask.abort(404)
tpath = os.path.join('templates', site, 'index.html')
if not os.path.exists(tpath):
flask.abort(404)
t = os.path.join(site, 'index.html')
return flask.render_template(t)
app.debug = True
if __name__ == '__main__':
app.run()
@font-face
{
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.
</strong></p>
<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>
<h2>Fast</h2>
<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="http://hg.openjdk.java.net/jdk7/jdk7">hg</a>) or NetBeans (<a href="http://hg.netbeans.org/">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>
<h2>Extensible</h2>
<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="http://mercurial.selenic.com/wiki/UsingExtensions">from the wiki</a> or by <a href="http://mercurial.selenic.com/wiki/WritingExtensions">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="http://www.gnu.org/licenses/gpl-2.0.txt">
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="http://git-scm.org">Git</a> and <a href="http://bazaar-vcs.org">Bazaar</a>. Version control systems without a distributed architecture include <a href="http://subversion.tigris.org/">Subversion</a> and <a href="http://www.nongnu.org/cvs/">CVS</a>.
<h3>The Website</h3>
<p>The <a href="/thepage">website</a> is a project of the Mercurial community.
The <a href="http://bitbucket.org/segv/hg-website">source</a> is
licensed under GPLv2 or later. Feel free to send us patches.
{% endblock %}
{% block sidebar %}
{{ super() }}
{% endblock %}
......@@ -3,8 +3,8 @@
<html>
<head>
<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">
Downloader.init(sources);
var dl = Downloader.select();
......@@ -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="http://mercurial.selenic.com/wiki/UsingExtensions">extensions</a></li>
<li><a href="http://mercurial.selenic.com/wiki/">news/wiki</a></li>
......@@ -27,6 +27,6 @@
<li><a href="http://mercurial.selenic.com/wiki/UsingExtensions">extensions</a></li>
<li><a href="http://mercurial.selenic.com/wiki/">news/wiki</a></li>
<li><a href="/sponsors/">sponsors</a></li>
<li><a href="/sponsors">sponsors</a></li>
</ul>
<form id="search" method="get" action="http://mercurial.selenic.com/wiki/Mercurial">
......
{% 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)
break;
// 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)
continue;
// 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) {
document.write('\
<div onclick="exposeversions(this);">\
<center id="more">[more versions]</center>\
</div>\
<br/>\
');
}
</script>
<h5>Development Repositories</h5>
<dl>
<dt>Main</dt>
<dd>The main development repository of the Mercurial maintainer
<a href="http://mercurial.selenic.com/wiki/mpm">Matt Mackall</a>
can be found at <a href="http://selenic.com/hg">
http://selenic.com/hg</a>.</dd>
<dt>Crew</dt>
<dd>The development repository of the <a
href="http://mercurial.selenic.com/wiki/CrewRepository">
Mercurial Crew</a>
can be found at <a href="http://hg.intevation.org/mercurial/crew">
http://hg.intevation.org/mercurial/crew</a>.</dd>
</dl>
<h5>Requirements</h5>
<dl>
<dt>Python</dt>
<dd>Mercurial uses <a href="http://www.python.org">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>
</dl>
<h5>Older Releases</h5>
<dl>
<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>
</dl>
{% 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="http://www.microsoft.com/windows">Microsoft Windows</a>,
<a href="http://kernel.org">GNU/Linux</a>,
<a href="http://www.apple.com">Mac OS X</a>,
<a href="http://oracle.com/solaris">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="http://tortoisehg.org">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>
<p>
<pre>
# 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
</pre>
</p>
{% endblock %}
#!/bin/sh
# 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 <johnson@smith.com>" >> .hg/hgrc
echo 'print("Hello")' > hello.py
hg add
#hg commit
hg commit --date "2011-11-20 11:00" -m "Initial commit."
hg log
echo status
echo 'print("Hello World")' > hello.py
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 hello.py copy
hg mv hello.py 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")' > hello.py
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")' > hello.py
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