merge with 0.6

This commit is contained in:
Georg Brandl 2010-06-13 21:39:44 +02:00
commit 9fca66a690
7 changed files with 46 additions and 19 deletions

10
CHANGES
View File

@ -154,6 +154,16 @@ Features added
- Added Danish translation, thanks to Hjorth Larsen. - Added Danish translation, thanks to Hjorth Larsen.
Release 0.6.8 (in development)
==============================
* #445: Fix links to result pages when using the search function
of HTML built with the ``dirhtml`` builder.
* #444: In templates, properly re-escape values treated with the
"striptags" Jinja filter.
Release 0.6.7 (Jun 05, 2010) Release 0.6.7 (Jun 05, 2010)
============================ ============================

View File

@ -800,6 +800,10 @@ class DirectoryHTMLBuilder(StandaloneHTMLBuilder):
return outfilename return outfilename
def prepare_writing(self, docnames):
StandaloneHTMLBuilder.prepare_writing(self, docnames)
self.globalcontext['no_search_suffix'] = True
class SingleFileHTMLBuilder(StandaloneHTMLBuilder): class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
""" """

View File

@ -23,7 +23,7 @@
{%- endblock %} {%- endblock %}
<div class="rel"> <div class="rel">
{%- for rellink in rellinks %} {%- for rellink in rellinks %}
<a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags }}" <a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags|e }}"
{{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>
{%- if not loop.last %}{{ reldelim2 }}{% endif %} {%- if not loop.last %}{{ reldelim2 }}{% endif %}
{%- endfor %} {%- endfor %}
@ -68,7 +68,7 @@
<div class="footer"> <div class="footer">
<div class="left"> <div class="left">
{%- for rellink in rellinks %} {%- for rellink in rellinks %}
<a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags }}" <a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags|e }}"
{{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>
{%- if not loop.last %}{{ reldelim2 }}{% endif %} {%- if not loop.last %}{{ reldelim2 }}{% endif %}
{%- endfor %} {%- endfor %}

View File

@ -24,7 +24,7 @@
<ul> <ul>
{%- for rellink in rellinks %} {%- for rellink in rellinks %}
<li class="right" {% if loop.first %}style="margin-right: 10px"{% endif %}> <li class="right" {% if loop.first %}style="margin-right: 10px"{% endif %}>
<a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags }}" <a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags|e }}"
{{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>
{%- if not loop.first %}{{ reldelim2 }}{% endif %}</li> {%- if not loop.first %}{{ reldelim2 }}{% endif %}</li>
{%- endfor %} {%- endfor %}
@ -88,7 +88,7 @@
{%- set titlesuffix = "" %} {%- set titlesuffix = "" %}
{%- endif %} {%- endif %}
{%- block htmltitle %} {%- block htmltitle %}
<title>{{ title|striptags }}{{ titlesuffix }}</title> <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
{%- endblock %} {%- endblock %}
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" /> <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
@ -101,7 +101,7 @@
URL_ROOT: '{{ url_root }}', URL_ROOT: '{{ url_root }}',
VERSION: '{{ release|e }}', VERSION: '{{ release|e }}',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '{{ file_suffix }}', FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
HAS_SOURCE: {{ has_source|lower }} HAS_SOURCE: {{ has_source|lower }}
}; };
</script> </script>
@ -132,13 +132,13 @@
{%- endif %} {%- endif %}
<link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" /> <link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" />
{%- if parents %} {%- if parents %}
<link rel="up" title="{{ parents[-1].title|striptags }}" href="{{ parents[-1].link|e }}" /> <link rel="up" title="{{ parents[-1].title|striptags|e }}" href="{{ parents[-1].link|e }}" />
{%- endif %} {%- endif %}
{%- if next %} {%- if next %}
<link rel="next" title="{{ next.title|striptags }}" href="{{ next.link|e }}" /> <link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
{%- endif %} {%- endif %}
{%- if prev %} {%- if prev %}
<link rel="prev" title="{{ prev.title|striptags }}" href="{{ prev.link|e }}" /> <link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
{%- endif %} {%- endif %}
{%- endblock %} {%- endblock %}
{%- block extrahead %} {% endblock %} {%- block extrahead %} {% endblock %}

View File

@ -456,10 +456,23 @@ var Search = {
if (results.length) { if (results.length) {
var item = results.pop(); var item = results.pop();
var listItem = $('<li style="display:none"></li>'); var listItem = $('<li style="display:none"></li>');
listItem.append($('<a/>').attr( if (DOCUMENTATION_OPTIONS.FILE_SUFFIX == '') {
'href', // dirhtml builder
item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX + var dirname = item[0] + '/';
highlightstring + item[2]).html(item[1])); if (dirname.match(/\/index\/$/)) {
dirname = dirname.substring(0, dirname.length-6);
} else if (dirname == 'index/') {
dirname = '';
}
listItem.append($('<a/>').attr('href',
DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
highlightstring + item[2]).html(item[1]));
} else {
// normal html builders
listItem.append($('<a/>').attr('href',
item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
highlightstring + item[2]).html(item[1]));
}
if (item[3]) { if (item[3]) {
listItem.append($('<span> (' + item[3] + ')</span>')); listItem.append($('<span> (' + item[3] + ')</span>'));
Search.output.append(listItem); Search.output.append(listItem);
@ -472,10 +485,10 @@ var Search = {
if (data != '') { if (data != '') {
listItem.append($.makeSearchSummary(data, searchterms, hlterms)); listItem.append($.makeSearchSummary(data, searchterms, hlterms));
Search.output.append(listItem); Search.output.append(listItem);
listItem.slideDown(5, function() {
displayNextItem();
});
} }
listItem.slideDown(5, function() {
displayNextItem();
});
}); });
} else { } else {
// no source available, just display title // no source available, just display title

View File

@ -46,7 +46,7 @@
{%- endif -%} {%- endif -%}
<h1 class="heading"><a href="{{ pathto('index') }}"> <h1 class="heading"><a href="{{ pathto('index') }}">
<span>{{ shorttitle|e }}</span></a></h1> <span>{{ shorttitle|e }}</span></a></h1>
<h2 class="heading"><span>{{ title|striptags }}</span></h2> <h2 class="heading"><span>{{ title|striptags|e }}</span></h2>
{%- endif %} {%- endif %}
{%- endblock %} {%- endblock %}
</div> </div>
@ -65,4 +65,4 @@
<div class="bottomnav"> <div class="bottomnav">
{{ nav() }} {{ nav() }}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -18,7 +18,7 @@
<div id="content"> <div id="content">
<div class="header"> <div class="header">
<h1 class="heading"><a href="{{ pathto('index') }}" <h1 class="heading"><a href="{{ pathto('index') }}"
title="back to the documentation overview"><span>{{ title|striptags }}</span></a></h1> title="back to the documentation overview"><span>{{ title|striptags|e }}</span></a></h1>
</div> </div>
<div class="relnav"> <div class="relnav">
{%- if prev %} {%- if prev %}
@ -39,4 +39,4 @@
{% block body %}{% endblock %} {% block body %}{% endblock %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}