annotate piecrust/__init__.py @ 173:0a86a7a6b284

routes: Actually match metadata when finding routes, fix problems with paths. When we look for a route that matches a given page, we now look at the source metadata that comes with that page, and compare it to the metadata we need to build URIs. Also, when matching URIs, we handle the case where a 'path'-component in our pattern may be completely empty, and thus we may be missing some trailing slashes in the URI.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 03 Jan 2015 21:10:44 -0800
parents 69d5eecfa449
children d70a4adb61dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
1
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
2 CACHE_DIR = '_cache'
36
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
3 ASSETS_DIR = 'assets'
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
4 TEMPLATES_DIR = 'templates'
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
5 PLUGINS_DIR = 'plugins'
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
6 THEME_DIR = 'theme'
3
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
7
36
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
8 CONFIG_PATH = 'config.yml'
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
9 THEME_CONFIG_PATH = 'theme_config.yml'
3
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
10
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
11 DEFAULT_FORMAT = 'markdown'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
12 DEFAULT_TEMPLATE_ENGINE = 'jinja2'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
13 DEFAULT_POSTS_FS = 'flat'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
14 DEFAULT_DATE_FORMAT = '%b %d, %Y'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
15 DEFAULT_PLUGIN_SOURCE = 'http://bitbucket.org/ludovicchabant/'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
16 DEFAULT_THEME_SOURCE = 'http://bitbucket.org/ludovicchabant/'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
17
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
18 PIECRUST_URL = 'http://bolt80.com/piecrust/'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
19
69
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
20 try:
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
21 from piecrust.__version__ import APP_VERSION
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
22 except ImportError:
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
23 APP_VERSION = 'unknown'
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
24
100
69d5eecfa449 Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
25 import os.path
69d5eecfa449 Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
26 RESOURCES_DIR = os.path.join(os.path.dirname(__file__), 'resources')
69d5eecfa449 Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
27