From 429991c3f99dc3cb94267491052e34cf94cca5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Pievil=C3=A4inen?= Date: Wed, 21 Nov 2012 14:41:09 +0200 Subject: [PATCH 1/2] List of translations for simple and notmyidea pages --- pelican/themes/notmyidea/templates/article_infos.html | 3 ++- pelican/themes/notmyidea/templates/page.html | 2 ++ pelican/themes/notmyidea/templates/translations.html | 2 ++ pelican/themes/simple/templates/article.html | 2 ++ pelican/themes/simple/templates/page.html | 3 +++ pelican/themes/simple/templates/translations.html | 9 +++++++++ 6 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 pelican/themes/simple/templates/translations.html diff --git a/pelican/themes/notmyidea/templates/article_infos.html b/pelican/themes/notmyidea/templates/article_infos.html index a1993a09..4b86716d 100644 --- a/pelican/themes/notmyidea/templates/article_infos.html +++ b/pelican/themes/notmyidea/templates/article_infos.html @@ -10,5 +10,6 @@ {% endif %}

In {{ article.category }}. {% if PDF_PROCESSOR %}get the pdf{% endif %}

{% include 'taglist.html' %} -{% include 'translations.html' %} +{% import 'translations.html' as translations with context %} +{{ translations.translations_for(article) }} diff --git a/pelican/themes/notmyidea/templates/page.html b/pelican/themes/notmyidea/templates/page.html index 9635fb8d..60409d5c 100644 --- a/pelican/themes/notmyidea/templates/page.html +++ b/pelican/themes/notmyidea/templates/page.html @@ -3,6 +3,8 @@ {% block content %}

{{ page.title }}

+ {% import 'translations.html' as translations with context %} + {{ translations.translations_for(page) }} {% if PDF_PROCESSOR %}get the pdf{% endif %} {{ page.content }} diff --git a/pelican/themes/notmyidea/templates/translations.html b/pelican/themes/notmyidea/templates/translations.html index 0079883e..ca03a2c9 100644 --- a/pelican/themes/notmyidea/templates/translations.html +++ b/pelican/themes/notmyidea/templates/translations.html @@ -1,6 +1,8 @@ +{% macro translations_for(article) %} {% if article.translations %} Translations: {% for translation in article.translations %} {{ translation.lang }} {% endfor %} {% endif %} +{% endmacro %} diff --git a/pelican/themes/simple/templates/article.html b/pelican/themes/simple/templates/article.html index 16c34266..86b14f62 100644 --- a/pelican/themes/simple/templates/article.html +++ b/pelican/themes/simple/templates/article.html @@ -5,6 +5,8 @@

{{ article.title }}

+ {% import 'translations.html' as translations with context %} + {{ translations.translations_for(article) }}
diff --git a/pelican/themes/simple/templates/page.html b/pelican/themes/simple/templates/page.html index 6308d588..3a0dc4a9 100644 --- a/pelican/themes/simple/templates/page.html +++ b/pelican/themes/simple/templates/page.html @@ -2,5 +2,8 @@ {% block title %}{{ page.title }}{%endblock%} {% block content %}

{{ page.title }}

+ {% import 'translations.html' as translations with context %} + {{ translations.translations_for(page) }} + {{ page.content }} {% endblock %} diff --git a/pelican/themes/simple/templates/translations.html b/pelican/themes/simple/templates/translations.html new file mode 100644 index 00000000..db8c372d --- /dev/null +++ b/pelican/themes/simple/templates/translations.html @@ -0,0 +1,9 @@ +{% macro translations_for(article) %} +{% if article.translations %} +Translations: +{% for translation in article.translations %} +{{ translation.lang }} +{% endfor %} +{% endif %} +{% endmacro %} + From 3e454045e9036131e30729f5755c27ef3134ba9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Pievil=C3=A4inen?= Date: Wed, 21 Nov 2012 15:45:00 +0200 Subject: [PATCH 2/2] Update test data --- tests/output/custom/a-markdown-powered-article.html | 3 +++ tests/output/custom/article-1.html | 3 +++ tests/output/custom/article-2.html | 3 +++ tests/output/custom/article-3.html | 3 +++ tests/output/custom/author/alexis-metaireau.html | 12 ++++++++++++ tests/output/custom/author/alexis-metaireau2.html | 12 ++++++++++++ tests/output/custom/category/bar.html | 3 +++ tests/output/custom/category/cat1.html | 12 ++++++++++++ tests/output/custom/category/misc.html | 6 ++++++ tests/output/custom/category/yeah.html | 3 +++ tests/output/custom/drafts/a-draft-article.html | 3 +++ tests/output/custom/index.html | 12 ++++++++++++ tests/output/custom/index2.html | 12 ++++++++++++ tests/output/custom/oh-yeah-fr.html | 3 +++ tests/output/custom/oh-yeah.html | 3 +++ .../custom/pages/this-is-a-test-hidden-page.html | 4 ++++ tests/output/custom/pages/this-is-a-test-page.html | 4 ++++ tests/output/custom/second-article-fr.html | 3 +++ tests/output/custom/second-article.html | 3 +++ tests/output/custom/tag/bar.html | 12 ++++++++++++ tests/output/custom/tag/baz.html | 6 ++++++ tests/output/custom/tag/foo.html | 9 +++++++++ tests/output/custom/tag/foobar.html | 3 +++ tests/output/custom/tag/oh.html | 3 +++ tests/output/custom/tag/yeah.html | 3 +++ tests/output/custom/this-is-a-super-article.html | 3 +++ tests/output/custom/unbelievable.html | 3 +++ 27 files changed, 149 insertions(+) diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index 9ca4763c..6e495efb 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -76,6 +76,9 @@ + + +

You're mutually oblivious.

diff --git a/tests/output/custom/article-1.html b/tests/output/custom/article-1.html index b0e0f879..e94373a9 100644 --- a/tests/output/custom/article-1.html +++ b/tests/output/custom/article-1.html @@ -76,6 +76,9 @@ + + +

Article 1

diff --git a/tests/output/custom/article-2.html b/tests/output/custom/article-2.html index 973b870a..f39bb27b 100644 --- a/tests/output/custom/article-2.html +++ b/tests/output/custom/article-2.html @@ -76,6 +76,9 @@ + + +

Article 2

diff --git a/tests/output/custom/article-3.html b/tests/output/custom/article-3.html index 7697a4ef..f0cc6c34 100644 --- a/tests/output/custom/article-3.html +++ b/tests/output/custom/article-3.html @@ -76,6 +76,9 @@ + + +

Article 3

diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index c64aacb9..42b84647 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -74,6 +74,9 @@ + + +

You're mutually oblivious.

There are comments.

@@ -113,6 +116,9 @@ + + +

Article 1

@@ -148,6 +154,9 @@ + + +

Article 2

@@ -183,6 +192,9 @@ + + +

Article 3

diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index 53f001fa..32b55f6f 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -82,11 +82,14 @@

tags: ohbaryeah

+ + Translations: fr +

Why not ?

@@ -127,11 +130,14 @@ YEAH !

tags: foobarbaz

+ + Translations: fr +

This is some article, in english

@@ -167,6 +173,9 @@ Translations:

tags: foobarfoobar

+ + +

Multi-line metadata should be supported as well as inline markup.

@@ -203,6 +212,9 @@ as well as inline markup.

+ + +

Or completely awesome. Depends the needs.

diff --git a/tests/output/custom/category/bar.html b/tests/output/custom/category/bar.html index e645f4e2..87263d13 100644 --- a/tests/output/custom/category/bar.html +++ b/tests/output/custom/category/bar.html @@ -74,11 +74,14 @@

tags: ohbaryeah

+ + Translations: fr +

Why not ?

After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/custom/category/cat1.html b/tests/output/custom/category/cat1.html index 4d76e095..af5ad56c 100644 --- a/tests/output/custom/category/cat1.html +++ b/tests/output/custom/category/cat1.html @@ -74,6 +74,9 @@ + + +

You're mutually oblivious.

There are comments.

@@ -113,6 +116,9 @@ + + +

Article 1

@@ -148,6 +154,9 @@ + + +

Article 2

@@ -183,6 +192,9 @@ + + +

Article 3

diff --git a/tests/output/custom/category/misc.html b/tests/output/custom/category/misc.html index a0ac83a5..90948668 100644 --- a/tests/output/custom/category/misc.html +++ b/tests/output/custom/category/misc.html @@ -74,11 +74,14 @@

tags: foobarbaz

+ + Translations: fr +

This is some article, in english

There are comments.

@@ -119,6 +122,9 @@ Translations: + + +

Or completely awesome. Depends the needs.

diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index ece5f0eb..a848c4a4 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -74,6 +74,9 @@

tags: foobarfoobar

+ + +

Some content here !

This is a simple title

diff --git a/tests/output/custom/drafts/a-draft-article.html b/tests/output/custom/drafts/a-draft-article.html index e38fb7b2..bcfd1243 100644 --- a/tests/output/custom/drafts/a-draft-article.html +++ b/tests/output/custom/drafts/a-draft-article.html @@ -76,6 +76,9 @@ + + +

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

diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index 80913795..3bcea824 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -74,11 +74,14 @@

tags: foobarbaz

+ + Translations: fr +

This is some article, in english

There are comments.

@@ -119,6 +122,9 @@ Translations: + + +

You're mutually oblivious.

read more @@ -153,6 +159,9 @@ Translations: + + +

Article 1

@@ -188,6 +197,9 @@ Translations: + + +

Article 2

diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 1eb336b6..bba153f4 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -82,6 +82,9 @@ + + +

Article 3

@@ -117,6 +120,9 @@

tags: foobarfoobar

+ + +

Multi-line metadata should be supported as well as inline markup.

@@ -153,11 +159,14 @@ as well as inline markup.

tags: ohbaryeah

+ + Translations: fr +

Why not ?

@@ -198,6 +207,9 @@ YEAH !

+ + +

Or completely awesome. Depends the needs.

diff --git a/tests/output/custom/oh-yeah-fr.html b/tests/output/custom/oh-yeah-fr.html index fb669e9b..ddc17b30 100644 --- a/tests/output/custom/oh-yeah-fr.html +++ b/tests/output/custom/oh-yeah-fr.html @@ -76,11 +76,14 @@ + + Translations: en +

Et voila du contenu en français

diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index c4eb421f..a48044ab 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -76,11 +76,14 @@

tags: ohbaryeah

+ + Translations: fr +

Why not ?

diff --git a/tests/output/custom/pages/this-is-a-test-hidden-page.html b/tests/output/custom/pages/this-is-a-test-hidden-page.html index 913a5974..2b489963 100644 --- a/tests/output/custom/pages/this-is-a-test-hidden-page.html +++ b/tests/output/custom/pages/this-is-a-test-hidden-page.html @@ -55,6 +55,10 @@

This is a test hidden page

+ + + +

This is great for things like error(404) pages Anyone can see this page but it's not linked to anywhere!

diff --git a/tests/output/custom/pages/this-is-a-test-page.html b/tests/output/custom/pages/this-is-a-test-page.html index 87e4925f..7d74011d 100644 --- a/tests/output/custom/pages/this-is-a-test-page.html +++ b/tests/output/custom/pages/this-is-a-test-page.html @@ -55,6 +55,10 @@

This is a test page

+ + + +

Just an image.

alternate text diff --git a/tests/output/custom/second-article-fr.html b/tests/output/custom/second-article-fr.html index 1100df29..cd1ee194 100644 --- a/tests/output/custom/second-article-fr.html +++ b/tests/output/custom/second-article-fr.html @@ -76,11 +76,14 @@

tags: foobarbaz

+ + Translations: en +

Ceci est un article, en français.

diff --git a/tests/output/custom/second-article.html b/tests/output/custom/second-article.html index 7a908526..ebabacc3 100644 --- a/tests/output/custom/second-article.html +++ b/tests/output/custom/second-article.html @@ -76,11 +76,14 @@

tags: foobarbaz

+ + Translations: fr +

This is some article, in english

diff --git a/tests/output/custom/tag/bar.html b/tests/output/custom/tag/bar.html index 03ce0de3..b9ef8402 100644 --- a/tests/output/custom/tag/bar.html +++ b/tests/output/custom/tag/bar.html @@ -74,11 +74,14 @@

tags: foobarbaz

+ + Translations: en +

Ceci est un article, en français.

There are comments.

@@ -119,11 +122,14 @@ Translations:

tags: foobarbaz

+ + Translations: fr +

This is some article, in english

@@ -159,6 +165,9 @@ Translations:

tags: foobarfoobar

+ + +

Multi-line metadata should be supported as well as inline markup.

@@ -195,11 +204,14 @@ as well as inline markup.

tags: ohbaryeah

+ + Translations: fr +

Why not ?

diff --git a/tests/output/custom/tag/baz.html b/tests/output/custom/tag/baz.html index e32cc9ea..29c1fae9 100644 --- a/tests/output/custom/tag/baz.html +++ b/tests/output/custom/tag/baz.html @@ -74,11 +74,14 @@

tags: foobarbaz

+ + Translations: en +

Ceci est un article, en français.

There are comments.

@@ -119,11 +122,14 @@ Translations:

tags: foobarbaz

+ + Translations: fr +

This is some article, in english

diff --git a/tests/output/custom/tag/foo.html b/tests/output/custom/tag/foo.html index 9c295933..04415b2c 100644 --- a/tests/output/custom/tag/foo.html +++ b/tests/output/custom/tag/foo.html @@ -74,11 +74,14 @@

tags: foobarbaz

+ + Translations: en +

Ceci est un article, en français.

There are comments.

@@ -119,11 +122,14 @@ Translations:

tags: foobarbaz

+ + Translations: fr +

This is some article, in english

@@ -159,6 +165,9 @@ Translations:

tags: foobarfoobar

+ + +

Multi-line metadata should be supported as well as inline markup.

diff --git a/tests/output/custom/tag/foobar.html b/tests/output/custom/tag/foobar.html index cad2dae3..38c4c61e 100644 --- a/tests/output/custom/tag/foobar.html +++ b/tests/output/custom/tag/foobar.html @@ -74,6 +74,9 @@

tags: foobarfoobar

+ + +

Some content here !

This is a simple title

diff --git a/tests/output/custom/tag/oh.html b/tests/output/custom/tag/oh.html index 53d45369..498b3fde 100644 --- a/tests/output/custom/tag/oh.html +++ b/tests/output/custom/tag/oh.html @@ -74,11 +74,14 @@

tags: ohbaryeah

+ + Translations: fr +

Why not ?

After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/custom/tag/yeah.html b/tests/output/custom/tag/yeah.html index bfd7b4cd..16d325f2 100644 --- a/tests/output/custom/tag/yeah.html +++ b/tests/output/custom/tag/yeah.html @@ -74,11 +74,14 @@

tags: ohbaryeah

+ + Translations: fr +

Why not ?

After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/custom/this-is-a-super-article.html b/tests/output/custom/this-is-a-super-article.html index f1e3fa40..8d024437 100644 --- a/tests/output/custom/this-is-a-super-article.html +++ b/tests/output/custom/this-is-a-super-article.html @@ -76,6 +76,9 @@

tags: foobarfoobar

+ + +

Some content here !

diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html index e08b2952..1a1b0788 100644 --- a/tests/output/custom/unbelievable.html +++ b/tests/output/custom/unbelievable.html @@ -76,6 +76,9 @@ + + +

Or completely awesome. Depends the needs.