diff --git a/docs/fr/faq.rst b/docs/fr/faq.rst index 8cbe0881..d945f447 100644 --- a/docs/fr/faq.rst +++ b/docs/fr/faq.rst @@ -1,8 +1,10 @@ -*Foire aux questions (FAQ)* +Foire aux questions (FAQ) +######################### Voici un résumé des questions fréquemment posées pour pelican. -*Est-il obligatoire d'avoir un fichier de configuration ?* +Est-il obligatoire d'avoir un fichier de configuration ? +======================================================== Non. Les fichiers de configuration sont juste un moyen facile de configurer pelican. Pour les opérations de base, il est possible de spécifier des @@ -11,17 +13,20 @@ en invoquant pelican avec la ligne de commande (voir pelican --help pour plus d'informations à ce sujet) -*Je crée mon propre thème, comment utiliser pygments?* +Je crée mon propre thème, comment utiliser pygments? +==================================================== Pygment ajoute quelques classes au contenu généré, de sorte qua colorisation de votre thème se fait grâce à un fichier css. Vous pouvez jeter un oeil à celui proposé par`sur le site du projet `_ -*Comment puis-je créer mon propre thèm* +Comment puis-je créer mon propre thèm +===================================== Vueillez vous référer à :ref:`theming-pelican-fr`. -*Comment puis-je aider?* +Comment puis-je aider? +====================== Vous avez plusieurs options pour aider. Tout d'abord, vous pouvez utiliser le diff --git a/docs/importer.rst b/docs/importer.rst index 377820af..0147f900 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -19,6 +19,22 @@ The conversion from HTML to reStructuredText relies on `pandoc written with Markdown syntax, they will not be converted (as Pelican also supports Markdown). +Dependencies +"""""""""""" + +``pelican-import`` has two dependencies not required by the rest of pelican: + +- BeautifulSoup +- pandoc + +BeatifulSoup can be installed like any other Python package:: + + $ pip install BeautifulSoup + +For pandoc, install a package for your operating system from the +`pandoc site `_. + + Usage """"" @@ -26,8 +42,8 @@ Usage | [--dir-cat] | input -Optional arguments: -""""""""""""""""""" +Optional arguments +"""""""""""""""""" -h, --help show this help message and exit --wpfile Wordpress XML export diff --git a/docs/settings.rst b/docs/settings.rst index b7882075..427795c2 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -52,10 +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. +`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`. @@ -361,8 +361,7 @@ By default, two themes are available. You can specify them using the `-t` option You can define your own theme too, and specify its placement in the same manner. (Be sure to specify the full absolute path to it.) -Here is `a guide on how to create your theme -`_ +Here is :doc:`a guide on how to create your theme ` You can find a list of themes at http://github.com/ametaireau/pelican-themes. diff --git a/pelican/__init__.py b/pelican/__init__.py index c2766646..59aef653 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -61,8 +61,9 @@ class Pelican(object): def _handle_deprecation(self): if self.settings.get('CLEAN_URLS', False): - logger.warning('Found deprecated `CLEAN_URLS` in settings. Modifing' - ' the following settings for the same behaviour.') + logger.warning('Found deprecated `CLEAN_URLS` in settings.' + ' Modifying the following settings for the' + ' same behaviour.') self.settings['ARTICLE_URL'] = '{slug}/' self.settings['ARTICLE_LANG_URL'] = '{slug}-{lang}/' @@ -75,7 +76,7 @@ class Pelican(object): if self.settings.get('ARTICLE_PERMALINK_STRUCTURE', False): logger.warning('Found deprecated `ARTICLE_PERMALINK_STRUCTURE` in' - ' settings. Modifing the following settings for' + ' settings. Modifying the following settings for' ' the same behaviour.') structure = self.settings['ARTICLE_PERMALINK_STRUCTURE'] diff --git a/pelican/contents.py b/pelican/contents.py index 42de4560..593822a9 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -63,7 +63,7 @@ class Page(object): self.in_default_lang = (self.lang == default_lang) - # create the slug if not existing, fro mthe title + # create the slug if not existing, from the title if not hasattr(self, 'slug') and hasattr(self, 'title'): self.slug = slugify(self.title) @@ -135,7 +135,7 @@ class Page(object): def _get_summary(self): """Returns the summary of an article, based on the summary metadata - if it is set, else troncate the content.""" + if it is set, else truncate the content.""" if hasattr(self, '_summary'): return self._summary else: diff --git a/pelican/generators.py b/pelican/generators.py index de45f411..664eb9fb 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -353,7 +353,7 @@ class PagesGenerator(Generator): class StaticGenerator(Generator): - """copy static paths (what you want to cpy, like images, medias etc. + """copy static paths (what you want to copy, like images, medias etc. to output""" def _copy_paths(self, paths, source, destination, output_path, diff --git a/pelican/settings.py b/pelican/settings.py index c0e30815..7a30e56e 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -130,7 +130,7 @@ def configure_settings(settings, default_settings=None, filename=None): if ('SITEURL' in settings): # If SITEURL has a trailing slash, remove it and provide a warning siteurl = settings['SITEURL'] - if (siteurl[len(siteurl) - 1:] == '/'): + if (siteurl.endswith('/')): settings['SITEURL'] = siteurl[:-1] logger.warn("Removed extraneous trailing slash from SITEURL.") # If SITEURL is defined but FEED_DOMAIN isn't, set FEED_DOMAIN = SITEURL diff --git a/pelican/themes/notmyidea/templates/base.html b/pelican/themes/notmyidea/templates/base.html index f0f745e4..c9f2c0c8 100644 --- a/pelican/themes/notmyidea/templates/base.html +++ b/pelican/themes/notmyidea/templates/base.html @@ -35,7 +35,7 @@ {% endfor %} {% endif %} {% for cat, null in categories %} -
  • {{ cat }}
  • +
  • {{ cat }}
  • {% endfor %} diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 57c4fc22..050b1010 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -13,7 +13,12 @@ from pelican.utils import slugify def wp2fields(xml): """Opens a wordpress XML file, and yield pelican fields""" - from BeautifulSoup import BeautifulStoneSoup + try: + from BeautifulSoup import BeautifulStoneSoup + except ImportError: + error = ('Missing dependency ' + '"BeautifulSoup" required to import Wordpress XML files.') + sys.exit(error) xmlfile = open(xml, encoding='utf-8').read() soup = BeautifulStoneSoup(xmlfile) @@ -40,7 +45,13 @@ def wp2fields(xml): def dc2fields(file): """Opens a Dotclear export file, and yield pelican fields""" - from BeautifulSoup import BeautifulStoneSoup + try: + from BeautifulSoup import BeautifulStoneSoup + except ImportError: + error = ('Missing dependency ' + '"BeautifulSoup" required to import Dotclear files.') + sys.exit(error) + in_cat = False in_post = False @@ -213,9 +224,12 @@ def fields2pelican(fields, out_markup, output_path, dircat=False): html_filename = os.path.join(output_path, filename+'.html') with open(html_filename, 'w', encoding='utf-8') as fp: - # Replace simple newlines with
    +newline so that the HTML file - # represents the original post more accurately - content = content.replace("\n", "
    \n") + # Replace newlines with paragraphs wrapped with

    so + # HTML is valid before conversion + paragraphs = content.split('\n\n') + paragraphs = [u'

    {}

    '.format(p) for p in paragraphs] + new_content = ''.join(paragraphs) + fp.write(content) cmd = 'pandoc --normalize --reference-links --from=html --to={0} -o "{1}" "{2}"'.format( diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index 7ade62e9..8459870a 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -52,6 +52,9 @@ clean: dropbox_upload: $$(OUTPUTDIR)/index.html \tcp -r $$(OUTPUTDIR)/* $$(DROPBOX_DIR) +rsync_upload: $$(OUTPUTDIR)/index.html +\trsync --delete -rvz -e ssh $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) + ssh_upload: $$(OUTPUTDIR)/index.html \tscp -r $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST):$$(SSH_TARGET_DIR) @@ -199,16 +202,16 @@ def main(): print('''Welcome to pelican-quickstart v{v}. -This script will help you creating a new Pelican based website. +This script will help you create a new Pelican-based website. Please answer the following questions so this script can generate the files needed by Pelican. '''.format(v=__version__)) CONF['basedir'] = os.path.abspath(ask('Where do you want to create your new Web site ?', answer=str, default=args.path)) - CONF['sitename'] = ask('How will you call your Web site ?', answer=str, default=args.title) + CONF['sitename'] = ask('What will be the title of this Web site ?', answer=str, default=args.title) CONF['author'] = ask('Who will be the author of this Web site ?', answer=str, default=args.author) - CONF['lang'] = ask('What will be the default language of this Web site ?', str, args.lang or CONF['lang'], 2) + CONF['lang'] = ask('What will be the default language of this Web site ?', str, args.lang or CONF['lang'], 2) CONF['with_pagination'] = ask('Do you want to enable article pagination ?', bool, bool(CONF['default_pagination'])) @@ -223,12 +226,12 @@ Please answer the following questions so this script can generate the files need if ask('Do you want to upload your website using FTP ?', answer=bool, default=False): CONF['ftp_host'] = ask('What is the hostname of your FTP server ?', str, CONF['ftp_host']) CONF['ftp_user'] = ask('What is your username on this server ?', str, CONF['ftp_user']) - CONF['ftp_traget_dir'] = ask('Where do you want to put your website on this server ?', str, CONF['ftp_target_dir']) + CONF['ftp_target_dir'] = ask('Where do you want to put your website on this server ?', str, CONF['ftp_target_dir']) if ask('Do you want to upload your website using SSH ?', answer=bool, default=False): CONF['ssh_host'] = ask('What is the hostname of your SSH server ?', str, CONF['ssh_host']) CONF['ssh_user'] = ask('What is your username on this server ?', str, CONF['ssh_user']) - CONF['ssh_traget_dir'] = ask('Where do you want to put your website on this server ?', str, CONF['ssh_target_dir']) + CONF['ssh_target_dir'] = ask('Where do you want to put your website on this server ?', str, CONF['ssh_target_dir']) if ask('Do you want to upload your website using Dropbox ?', answer=bool, default=False): CONF['dropbox_dir'] = ask('Where is your Dropbox directory ?', str, CONF['dropbox_dir']) diff --git a/pelican/writers.py b/pelican/writers.py index faca46bd..4dd04a2a 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -36,7 +36,7 @@ class Writer(object): feed.add_item( title=item.title, - link='%s%s' % (self.site_url, item.url), + link='%s/%s' % (self.site_url, item.url), unique_id='tag:%s,%s:%s' % (self.site_url.replace('http://', ''), item.date.date(), item.url), description=item.content, diff --git a/tests/test_generators.py b/tests/test_generators.py index bc5c8b73..dd27d97f 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -46,3 +46,7 @@ class TestArticlesGenerator(unittest.TestCase): elif relfilepath == "article_without_category.rst": self.assertEquals(article.category.name, 'Default') + categories = [cat.name for cat, _ in generator.categories] + # assert that the categories are ordered as expected + self.assertEquals( + categories, ['Default', 'TestCategory', 'Yeah', 'yeah'])