make sure partial has data before register

This commit is contained in:
Matthew Scragg 2014-09-10 11:09:29 -05:00
parent 40292454da
commit 951fffb3eb
2 changed files with 8 additions and 2 deletions

View file

@ -75,7 +75,7 @@ var MDR = {
if (sanitize) {
// Causes some problems with inline styles
html = html_sanitize(html, function(url) {
if(/^https?:\/\//.test(url)) {
if(/^(\/|https?:\/\/)/.test(url)) {
return url
}
}, function(id){

View file

@ -4,7 +4,13 @@
$(function(){
{% if partials %}
{% for name, value in partials.items() %}
Handlebars.registerPartial({{ name|tojson|safe }}, {{ value.data|tojson|safe }});
{% if name and value %}
try {
Handlebars.registerPartial({{ name|tojson|safe }}, {{ value.data|tojson|safe }});
} catch(e) {
// no data?
}
{% endif %}
{% endfor %}
{% endif %}
$("#start-togetherjs").click(function(){