diff --git a/pelican/generators.py b/pelican/generators.py index c55cdc37..cc1b2dbf 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -353,8 +353,13 @@ class ArticlesGenerator(Generator): def generate_drafts(self, write): """Generate drafts pages.""" - for article in self.drafts: - write(os.path.join('drafts', '%s.html' % article.slug), + for article in chain(self.translations, self.drafts): + filename = article.slug + if article.lang != self.settings["DEFAULT_LANG"]: + filename += "-" + article.lang + filename += ".html" + + write(os.path.join('drafts', filename), self.get_template(article.template), self.context, article=article, category=article.category, all_articles=self.articles) diff --git a/pelican/tests/output/basic/drafts/second-article-fr.html b/pelican/tests/output/basic/drafts/second-article-fr.html new file mode 100644 index 00000000..050d49b3 --- /dev/null +++ b/pelican/tests/output/basic/drafts/second-article-fr.html @@ -0,0 +1,70 @@ + + + + + Deuxième article + + + + + + + + +
+
+
+

+ Deuxième article

+
+ +
+
+ + Wed 29 February 2012 + + +

In misc.

+

tags: foobarbaz

Translations: + en + +

Ceci est un article, en français.

+ +
+ +
+
+
+
+

social

+ +
+
+ + + + + \ No newline at end of file diff --git a/pelican/tests/output/custom/drafts/draft-article-with-translation-ja.html b/pelican/tests/output/custom/drafts/draft-article-with-translation-ja.html new file mode 100644 index 00000000..97ad4108 --- /dev/null +++ b/pelican/tests/output/custom/drafts/draft-article-with-translation-ja.html @@ -0,0 +1,99 @@ + + + + + 他言語の下書きテスト + + + + + + + + + +Fork me on GitHub + + +
+
+
+

+ 他言語の下書きテスト

+
+ +
+

これは下書きファイルです。/draftに生成されて、他のところには影響を与えません。

+ +
+ +
+
+
+
+

blogroll

+ +
+
+

social

+ +
+
+ + + + + + \ No newline at end of file diff --git a/pelican/tests/output/custom/drafts/draft-article-with-translation.html b/pelican/tests/output/custom/drafts/draft-article-with-translation.html new file mode 100644 index 00000000..ba31bc17 --- /dev/null +++ b/pelican/tests/output/custom/drafts/draft-article-with-translation.html @@ -0,0 +1,100 @@ + + + + + A draft article with translation + + + + + + + + + +Fork me on GitHub + + +
+
+
+

+ A draft article with translation

+
+ +
+

This is a draft article, it should live under the /drafts/ folder and not be +listed anywhere else.

+ +
+ +
+
+
+
+

blogroll

+ +
+
+

social

+ +
+
+ + + + + + \ No newline at end of file diff --git a/pelican/tests/output/custom/drafts/oh-yeah-fr.html b/pelican/tests/output/custom/drafts/oh-yeah-fr.html new file mode 100644 index 00000000..e83e2ab7 --- /dev/null +++ b/pelican/tests/output/custom/drafts/oh-yeah-fr.html @@ -0,0 +1,114 @@ + + + + + Trop bien ! + + + + + + + + + +Fork me on GitHub + + +
+
+
+

+ Trop bien !

+
+ +
+

Et voila du contenu en français

+ +
+
+

Comments !

+
+ +
+ +
+
+
+
+

blogroll

+ +
+
+

social

+ +
+
+ + + + + + \ No newline at end of file diff --git a/pelican/tests/output/custom/drafts/second-article-fr.html b/pelican/tests/output/custom/drafts/second-article-fr.html new file mode 100644 index 00000000..d208e838 --- /dev/null +++ b/pelican/tests/output/custom/drafts/second-article-fr.html @@ -0,0 +1,114 @@ + + + + + Deuxième article + + + + + + + + + +Fork me on GitHub + + +
+
+
+

+ Deuxième article

+
+ +
+

Ceci est un article, en français.

+ +
+
+

Comments !

+
+ +
+ +
+
+
+
+

blogroll

+ +
+
+

social

+ +
+
+ + + + + + \ No newline at end of file diff --git a/samples/content/draft_article_with_translation-ja.rst b/samples/content/draft_article_with_translation-ja.rst new file mode 100644 index 00000000..f22bfbbe --- /dev/null +++ b/samples/content/draft_article_with_translation-ja.rst @@ -0,0 +1,8 @@ +他言語の下書きテスト +###################### + +:slug: draft-article-with-translation +:status: draft +:lang: ja + +これは下書きファイルです。/draftに生成されて、他のところには影響を与えません。 diff --git a/samples/content/draft_article_with_translation.rst b/samples/content/draft_article_with_translation.rst new file mode 100644 index 00000000..5bd83dbb --- /dev/null +++ b/samples/content/draft_article_with_translation.rst @@ -0,0 +1,8 @@ +A draft article with translation +################################ + +:slug: draft-article-with-translation +:status: draft + +This is a draft article, it should live under the /drafts/ folder and not be +listed anywhere else.