forked from github/pelican
Merge branch 'master' of github.com:ametaireau/pelican
This commit is contained in:
commit
189da25c5b
5 changed files with 34 additions and 12 deletions
|
|
@ -52,6 +52,10 @@ Setting name (default value) What does it do?
|
|||
supported extensions.
|
||||
`OUTPUT_PATH` (``'output/'``) Where to output the generated files.
|
||||
`PATH` (``None``) Path to look at for input files.
|
||||
`PAGE_DIR' (``'pages'``) Directory to look at for pages.
|
||||
`PAGE_EXCLUDES' (``()``) A list of directories to exclude when looking for pages.
|
||||
`ARTICLE_DIR' (``''``) Directory to look at for articles.
|
||||
`ARTICLE_EXCLUDES': (``('pages',)``) A list of directories to exclude when looking for articles.
|
||||
`PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions
|
||||
of your documents. You will need to install
|
||||
`rst2pdf`.
|
||||
|
|
|
|||
|
|
@ -211,10 +211,10 @@ class ArticlesGenerator(Generator):
|
|||
def generate_context(self):
|
||||
"""change the context"""
|
||||
|
||||
# return the list of files to use
|
||||
files = self.get_files(self.path, exclude=['pages', ])
|
||||
all_articles = []
|
||||
for f in files:
|
||||
for f in self.get_files(
|
||||
os.path.join(self.path, self.settings['ARTICLE_DIR']),
|
||||
exclude=self.settings['ARTICLE_EXCLUDES']):
|
||||
try:
|
||||
content, metadata = read_file(f, settings=self.settings)
|
||||
except Exception, e:
|
||||
|
|
@ -316,7 +316,9 @@ class PagesGenerator(Generator):
|
|||
|
||||
def generate_context(self):
|
||||
all_pages = []
|
||||
for f in self.get_files(os.sep.join((self.path, 'pages'))):
|
||||
for f in self.get_files(
|
||||
os.path.join(self.path, self.settings['PAGE_DIR']),
|
||||
exclude=self.settings['PAGE_EXCLUDES']):
|
||||
try:
|
||||
content, metadata = read_file(f)
|
||||
except Exception, e:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ from pelican import log
|
|||
DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)),
|
||||
"themes/notmyidea"])
|
||||
_DEFAULT_CONFIG = {'PATH': None,
|
||||
'ARTICLE_DIR': '',
|
||||
'ARTICLE_EXCLUDES': ('pages',),
|
||||
'PAGE_DIR': 'pages',
|
||||
'PAGE_EXCLUDES': (),
|
||||
'THEME': DEFAULT_THEME,
|
||||
'OUTPUT_PATH': 'output/',
|
||||
'MARKUP': ('rst', 'md'),
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import with_statement
|
||||
try:
|
||||
from unittest2 import TestCase
|
||||
from unittest2 import TestCase, skip
|
||||
except ImportError, e:
|
||||
from unittest import TestCase
|
||||
from unittest import TestCase, skip
|
||||
|
||||
from pelican.contents import Page
|
||||
from pelican.settings import _DEFAULT_CONFIG
|
||||
|
|
@ -94,6 +94,18 @@ class TestPage(TestCase):
|
|||
locale = 'ja_JP.utf8'
|
||||
page_kwargs['settings']['DATE_FORMATS'] = {'jp':(locale,'%Y-%m-%d(%a)')}
|
||||
page_kwargs['metadata']['lang'] = 'jp'
|
||||
page = Page( **page_kwargs)
|
||||
self.assertEqual(page.locale_date, u'2015-09-13(\u65e5)')
|
||||
# above is unicode in Japanese: 2015-09-13(“ú)
|
||||
|
||||
import locale as locale_module
|
||||
try:
|
||||
page = Page( **page_kwargs)
|
||||
self.assertEqual(page.locale_date, u'2015-09-13(\u65e5)')
|
||||
# above is unicode in Japanese: 2015-09-13(“ú)
|
||||
except locale_module.Error:
|
||||
# The constructor of ``Page`` will try to set the locale to
|
||||
# ``ja_JP.utf8``. But this attempt will failed when there is no
|
||||
# such locale in the system. You can see which locales there are
|
||||
# in your system with ``locale -a`` command.
|
||||
#
|
||||
# Until we find some other method to test this functionality, we
|
||||
# will simply skip this test.
|
||||
skip("There is no locale %s in this system." % locale)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ html: clean $$(OUTPUTDIR)/index.html
|
|||
\t@echo 'Done'
|
||||
|
||||
$$(OUTPUTDIR)/%.html:
|
||||
\t$$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE)
|
||||
\t$$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
|
||||
|
||||
clean:
|
||||
\trm -fr $$(OUTPUTDIR)
|
||||
|
|
@ -94,7 +94,7 @@ DEFAULT_PAGINATION = $default_pagination
|
|||
|
||||
CONF = {
|
||||
'pelican' : 'pelican',
|
||||
'pelicanopts' : None,
|
||||
'pelicanopts' : '',
|
||||
'basedir': '.',
|
||||
'ftp_host': 'localhost',
|
||||
'ftp_user': 'anonymous',
|
||||
|
|
@ -103,7 +103,7 @@ CONF = {
|
|||
'ssh_user': 'root',
|
||||
'ssh_target_dir': '/var/www',
|
||||
'dropbox_dir' : '~/Dropbox/Public/',
|
||||
'default_pagination' : 7,
|
||||
'default_pagination' : 10,
|
||||
'lang': 'en'
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue