record hidden content in native lang, fixes #409
added 404 test pages for this case
This commit is contained in:
parent
1e0684aa22
commit
806ae893e7
@ -248,6 +248,10 @@ def filter_contents_translations(generator):
|
|||||||
hiding_func = inspector.hiding_function()
|
hiding_func = inspector.hiding_function()
|
||||||
untrans_policy = inspector.untranslated_policy(default='hide')
|
untrans_policy = inspector.untranslated_policy(default='hide')
|
||||||
for (contents, other_contents) in inspector.contents_list_pairs():
|
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
|
for content in contents[:]: # copy for removing in loop
|
||||||
if content.lang == current_lang: # in native lang
|
if content.lang == current_lang: # in native lang
|
||||||
# save the native URL attr formatted in the current locale
|
# save the native URL attr formatted in the current locale
|
||||||
|
7
test_data/content/pages/hidden-page-cz.rst
Normal file
7
test_data/content/pages/hidden-page-cz.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
404 stránka
|
||||||
|
===========
|
||||||
|
:slug: 404
|
||||||
|
:lang: cz
|
||||||
|
:status: hidden
|
||||||
|
|
||||||
|
Jednoduchá 404 stránka.
|
7
test_data/content/pages/hidden-page-de.rst
Normal file
7
test_data/content/pages/hidden-page-de.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Eine 404 Seite
|
||||||
|
==============
|
||||||
|
:slug: 404
|
||||||
|
:lang: de
|
||||||
|
:status: hidden
|
||||||
|
|
||||||
|
Eine einfache 404 Seite.
|
7
test_data/content/pages/hidden-page-en.rst
Normal file
7
test_data/content/pages/hidden-page-en.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
A 404 page
|
||||||
|
==========
|
||||||
|
:slug: 404
|
||||||
|
:lang: en
|
||||||
|
:status: hidden
|
||||||
|
|
||||||
|
A simple 404 page.
|
33
test_data/output/cz/pages/404.html
Normal file
33
test_data/output/cz/pages/404.html
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="cz">
|
||||||
|
<head>
|
||||||
|
<title>404 stránka</title>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link href="http://example.com/test/feeds_all.atom.xml" type="application/atom+xml" rel="alternate" title="Testovací stránka Full Atom Feed" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://example.com/test/cz/../theme/style.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="index" class="home">
|
||||||
|
<header id="banner" class="body">
|
||||||
|
<h1><a href="http://example.com/test/cz/">Testovací stránka <strong></strong></a></h1>
|
||||||
|
</header><!-- /#banner -->
|
||||||
|
<nav id="menu"><ul>
|
||||||
|
</ul></nav><!-- /#menu -->
|
||||||
|
<h1>404 stránka</h1>
|
||||||
|
Translations:
|
||||||
|
<a href="http://example.com/test/cz/../de/pages/404.html">de</a>
|
||||||
|
<a href="http://example.com/test/cz/../pages/404.html">en</a>
|
||||||
|
|
||||||
|
|
||||||
|
<p>Jednoduchá 404 stránka.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<footer id="contentinfo" class="body">
|
||||||
|
<address id="about" class="vcard body">
|
||||||
|
Proudly powered by <a href="http://getpelican.com/">Pelican</a>,
|
||||||
|
which takes great advantage of <a href="http://python.org">Python</a>.
|
||||||
|
</address><!-- /#about -->
|
||||||
|
</footer><!-- /#contentinfo -->
|
||||||
|
</body>
|
||||||
|
</html>
|
33
test_data/output/de/pages/404.html
Normal file
33
test_data/output/de/pages/404.html
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<title>Eine 404 Seite</title>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link href="http://example.com/test/feeds_all.atom.xml" type="application/atom+xml" rel="alternate" title="Testseite Full Atom Feed" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://example.com/test/de/../theme/style.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="index" class="home">
|
||||||
|
<header id="banner" class="body">
|
||||||
|
<h1><a href="http://example.com/test/de/">Testseite <strong></strong></a></h1>
|
||||||
|
</header><!-- /#banner -->
|
||||||
|
<nav id="menu"><ul>
|
||||||
|
</ul></nav><!-- /#menu -->
|
||||||
|
<h1>Eine 404 Seite</h1>
|
||||||
|
Translations:
|
||||||
|
<a href="http://example.com/test/de/../cz/pages/404.html">cz</a>
|
||||||
|
<a href="http://example.com/test/de/../pages/404.html">en</a>
|
||||||
|
|
||||||
|
|
||||||
|
<p>Eine einfache 404 Seite.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<footer id="contentinfo" class="body">
|
||||||
|
<address id="about" class="vcard body">
|
||||||
|
Proudly powered by <a href="http://getpelican.com/">Pelican</a>,
|
||||||
|
which takes great advantage of <a href="http://python.org">Python</a>.
|
||||||
|
</address><!-- /#about -->
|
||||||
|
</footer><!-- /#contentinfo -->
|
||||||
|
</body>
|
||||||
|
</html>
|
34
test_data/output/pages/404.html
Normal file
34
test_data/output/pages/404.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>A 404 page</title>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link href="http://example.com/test/feeds_all.atom.xml" type="application/atom+xml" rel="alternate" title="Testing site Full Atom Feed" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://example.com/test/theme/style.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="index" class="home">
|
||||||
|
<header id="banner" class="body">
|
||||||
|
<h1><a href="http://example.com/test/">Testing site <strong></strong></a></h1>
|
||||||
|
</header><!-- /#banner -->
|
||||||
|
<nav id="menu"><ul>
|
||||||
|
<li><a href="http://example.com/test/pages/untranslated-page.html">Untranslated page</a></li>
|
||||||
|
</ul></nav><!-- /#menu -->
|
||||||
|
<h1>A 404 page</h1>
|
||||||
|
Translations:
|
||||||
|
<a href="http://example.com/test/cz/pages/404.html">cz</a>
|
||||||
|
<a href="http://example.com/test/de/pages/404.html">de</a>
|
||||||
|
|
||||||
|
|
||||||
|
<p>A simple 404 page.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<footer id="contentinfo" class="body">
|
||||||
|
<address id="about" class="vcard body">
|
||||||
|
Proudly powered by <a href="http://getpelican.com/">Pelican</a>,
|
||||||
|
which takes great advantage of <a href="http://python.org">Python</a>.
|
||||||
|
</address><!-- /#about -->
|
||||||
|
</footer><!-- /#contentinfo -->
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user