Change the output directory structure and a bit the templates structure as well.

--HG--
rename : pelican/themes/martyalchin/css/style.css => pelican/themes/martyalchin/static/css/style.css
rename : pelican/themes/notmyidea/css/main.css => pelican/themes/notmyidea/static/css/main.css
rename : pelican/themes/notmyidea/css/pygment.css => pelican/themes/notmyidea/static/css/pygment.css
rename : pelican/themes/notmyidea/css/reset.css => pelican/themes/notmyidea/static/css/reset.css
rename : pelican/themes/notmyidea/css/wide.css => pelican/themes/notmyidea/static/css/wide.css
rename : pelican/themes/notmyidea/images/icons/delicious.png => pelican/themes/notmyidea/static/images/icons/delicious.png
rename : pelican/themes/notmyidea/images/icons/lastfm.png => pelican/themes/notmyidea/static/images/icons/lastfm.png
rename : pelican/themes/notmyidea/images/icons/linkedin.png => pelican/themes/notmyidea/static/images/icons/linkedin.png
rename : pelican/themes/notmyidea/images/icons/rss.png => pelican/themes/notmyidea/static/images/icons/rss.png
rename : pelican/themes/notmyidea/images/icons/twitter.png => pelican/themes/notmyidea/static/images/icons/twitter.png
This commit is contained in:
Alexis Metaireau 2010-11-21 01:49:37 +00:00
commit 090a02a9e3
27 changed files with 1173 additions and 1165 deletions

2
TODO
View file

@ -1,8 +1,6 @@
* Add a way to support pictures (see how sphinx makes that)
* Find a way to extend the existing templates instead of rewriting all from scratch.
* find a better way to specify the templates. an idea is simply to install the templates in a default path, and to add a way to specify them by default under a "_themes" dir.
* Make the program support UTF8-encoded files as input (and later: any encoding?)
* Change the directory structure ?
* Add status support (draft, published, hidden)
* Add a serve + automatic generation behaviour.
* Recompile only the changed files, not all.

View file

@ -19,7 +19,7 @@ class Generator(object):
def __init__(self, settings=None, path=None, theme=None, output_path=None,
markup=None):
"""Read the settings, and performs some checks on the environement
"""Read the settings, and performs some checks on the environment
before doing anything else.
"""
if settings is None:
@ -72,7 +72,7 @@ class Generator(object):
the feed object.
:param articles: the articles to put on the feed.
:param context: the context to get the feed metadatas.
:param context: the context to get the feed metadata.
:param output_path: where to output the file.
:param filename: the filename to output.
:param relative_urls: use relative urls or absolutes ones

View file

@ -128,10 +128,17 @@ class PagesProcessor(Processor):
class StaticProcessor(Processor):
"""copy static paths to output"""
def _copy_paths(self, paths, source, destination, output_path,
final_path=None):
for path in paths:
copytree(path, source, os.path.join(output_path, destination),
final_path)
def process(self, context, generator):
for path in generator.settings['STATIC_PATHS']:
copytree(path, generator.theme, generator.output_path)
copytree('pics', generator.path, generator.output_path)
self._copy_paths(generator.settings['STATIC_PATHS'], generator.path,
'static', generator.output_path)
self._copy_paths(generator.settings['THEME_PATHS'], generator.theme,
'theme', generator.output_path, '.')
class PdfProcessor(Processor):

View file

@ -6,7 +6,8 @@ _DEFAULT_CONFIG = {'PATH': None,
'THEME': _DEFAULT_THEME,
'OUTPUT_PATH': 'output/',
'MARKUP': ('rst', 'md'),
'STATIC_PATHS': ['css', 'images'],
'STATIC_PATHS': ['images',],
'THEME_PATHS': ['static',],
'FEED': 'feeds/all.atom.xml',
'CATEGORY_FEED': 'feeds/%s.atom.xml',
'SITENAME': 'A Pelican Blog',

View file

@ -3,7 +3,7 @@
<head>
<title>{% block title %}{{ SITENAME }}{%endblock%}</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="{{ SITEURL }}/css/style.css" type="text/css" />
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/style.css" type="text/css" />
<link href="{{ SITEURL }}/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} ATOM Feed" />
</head>
<body>

View file

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 963 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 980 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 376 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 896 B

After

Width:  |  Height:  |  Size: 896 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 835 B

Before After
Before After

View file

@ -3,7 +3,7 @@
<head>
<title>{% block title %}{{ SITENAME }}{%endblock%}</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="{{ SITEURL }}/css/{{ CSS_FILE }}" type="text/css" />
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/{{ CSS_FILE }}" type="text/css" />
<link href="{{ SITEURL }}/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} ATOM Feed" />

View file

@ -50,14 +50,16 @@ def slugify(value):
value = unicode(re.sub('[^\w\s-]', '', value).strip().lower())
return re.sub('[-\s]+', '-', value)
def copytree(path, origin, destination):
def copytree(path, origin, destination, topath=None):
"""Copy path from origin to destination, silent any errors"""
if not topath:
topath = path
try:
fromp = os.path.expanduser(os.path.join(origin, path))
to = os.path.expanduser(os.path.join(destination, path))
to = os.path.expanduser(os.path.join(destination, topath))
shutil.copytree(fromp, to)
print u' [ok] copying %s' % fromp
print u' [ok] copying %s to %s' % (fromp, to)
except OSError:
pass