make sure partial has data before register
This commit is contained in:
		
							parent
							
								
									40292454da
								
							
						
					
					
						commit
						951fffb3eb
					
				
					 2 changed files with 8 additions and 2 deletions
				
			
		|  | @ -75,7 +75,7 @@ var MDR = { | ||||||
|         if (sanitize) { |         if (sanitize) { | ||||||
|             // Causes some problems with inline styles
 |             // Causes some problems with inline styles
 | ||||||
|             html = html_sanitize(html, function(url) { |             html = html_sanitize(html, function(url) { | ||||||
|                 if(/^https?:\/\//.test(url)) { |                 if(/^(\/|https?:\/\/)/.test(url)) { | ||||||
|                     return url |                     return url | ||||||
|                 } |                 } | ||||||
|             }, function(id){ |             }, function(id){ | ||||||
|  |  | ||||||
|  | @ -4,7 +4,13 @@ | ||||||
|     $(function(){ |     $(function(){ | ||||||
|       {% if partials %} |       {% if partials %} | ||||||
|         {% for name, value in partials.items() %} |         {% for name, value in partials.items() %} | ||||||
|  |           {% if name and value %} | ||||||
|  |             try { | ||||||
|               Handlebars.registerPartial({{ name|tojson|safe }}, {{ value.data|tojson|safe }}); |               Handlebars.registerPartial({{ name|tojson|safe }}, {{ value.data|tojson|safe }}); | ||||||
|  |             } catch(e) { | ||||||
|  |               // no data? | ||||||
|  |             } | ||||||
|  |           {% endif %} | ||||||
|         {% endfor %} |         {% endfor %} | ||||||
|       {% endif %} |       {% endif %} | ||||||
|         $("#start-togetherjs").click(function(){ |         $("#start-togetherjs").click(function(){ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue