From 806ae893e7934fd41de9f3f96c5684edcfa27a5b Mon Sep 17 00:00:00 2001 From: Ondrej Grover Date: Sun, 15 Feb 2015 08:12:12 +0100 Subject: [PATCH] record hidden content in native lang, fixes #409 added 404 test pages for this case --- i18n_subsites.py | 4 +++ test_data/content/pages/hidden-page-cz.rst | 7 +++++ test_data/content/pages/hidden-page-de.rst | 7 +++++ test_data/content/pages/hidden-page-en.rst | 7 +++++ test_data/output/cz/pages/404.html | 33 +++++++++++++++++++++ test_data/output/de/pages/404.html | 33 +++++++++++++++++++++ test_data/output/pages/404.html | 34 ++++++++++++++++++++++ 7 files changed, 125 insertions(+) create mode 100644 test_data/content/pages/hidden-page-cz.rst create mode 100644 test_data/content/pages/hidden-page-de.rst create mode 100644 test_data/content/pages/hidden-page-en.rst create mode 100644 test_data/output/cz/pages/404.html create mode 100644 test_data/output/de/pages/404.html create mode 100644 test_data/output/pages/404.html diff --git a/i18n_subsites.py b/i18n_subsites.py index ae2066c..7361d16 100644 --- a/i18n_subsites.py +++ b/i18n_subsites.py @@ -248,6 +248,10 @@ def filter_contents_translations(generator): hiding_func = inspector.hiding_function() untrans_policy = inspector.untranslated_policy(default='hide') for (contents, other_contents) in inspector.contents_list_pairs(): + for content in other_contents: # save any hidden native content first + if content.lang == current_lang: # in native lang + # save the native URL attr formatted in the current locale + _NATIVE_CONTENT_URL_DB[content.source_path] = content.url for content in contents[:]: # copy for removing in loop if content.lang == current_lang: # in native lang # save the native URL attr formatted in the current locale diff --git a/test_data/content/pages/hidden-page-cz.rst b/test_data/content/pages/hidden-page-cz.rst new file mode 100644 index 0000000..c282faa --- /dev/null +++ b/test_data/content/pages/hidden-page-cz.rst @@ -0,0 +1,7 @@ +404 stránka +=========== +:slug: 404 +:lang: cz +:status: hidden + +Jednoduchá 404 stránka. diff --git a/test_data/content/pages/hidden-page-de.rst b/test_data/content/pages/hidden-page-de.rst new file mode 100644 index 0000000..d8410a1 --- /dev/null +++ b/test_data/content/pages/hidden-page-de.rst @@ -0,0 +1,7 @@ +Eine 404 Seite +============== +:slug: 404 +:lang: de +:status: hidden + +Eine einfache 404 Seite. diff --git a/test_data/content/pages/hidden-page-en.rst b/test_data/content/pages/hidden-page-en.rst new file mode 100644 index 0000000..74a97d7 --- /dev/null +++ b/test_data/content/pages/hidden-page-en.rst @@ -0,0 +1,7 @@ +A 404 page +========== +:slug: 404 +:lang: en +:status: hidden + +A simple 404 page. diff --git a/test_data/output/cz/pages/404.html b/test_data/output/cz/pages/404.html new file mode 100644 index 0000000..c6e659d --- /dev/null +++ b/test_data/output/cz/pages/404.html @@ -0,0 +1,33 @@ + + + + 404 stránka + + + + + + + + + +

404 stránka

+ Translations: +de +en + + +

Jednoduchá 404 stránka.

+ + + + + \ No newline at end of file diff --git a/test_data/output/de/pages/404.html b/test_data/output/de/pages/404.html new file mode 100644 index 0000000..b1721f5 --- /dev/null +++ b/test_data/output/de/pages/404.html @@ -0,0 +1,33 @@ + + + + Eine 404 Seite + + + + + + + + + +

Eine 404 Seite

+ Translations: +cz +en + + +

Eine einfache 404 Seite.

+ + + + + \ No newline at end of file diff --git a/test_data/output/pages/404.html b/test_data/output/pages/404.html new file mode 100644 index 0000000..05300a3 --- /dev/null +++ b/test_data/output/pages/404.html @@ -0,0 +1,34 @@ + + + + A 404 page + + + + + + + + + +

A 404 page

+ Translations: +cz +de + + +

A simple 404 page.

+ + + + + \ No newline at end of file