Use urlparse and display text correctly

This commit is contained in:
Eric Holscher
2014-08-03 10:12:16 -07:00
parent 96f54b0267
commit 7c6dc4b181
2 changed files with 5 additions and 5 deletions

View File

@@ -11,13 +11,12 @@
<link rel="stylesheet" href="{{ base_url }}/css/theme.css" type="text/css" />
{% for path in extra_css %}
<link href="{{ base_url }}/{{ path }}" rel="stylesheet">
<link href="{{ path }}" rel="stylesheet">
{% endfor %}
<script type="text/javascript" src="{{ base_url }}/js/theme.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
{% for path in extra_javascript %}
<script src="{{ base_url }}/{{ path }}"></script>
<script src="{{ path }}"></script>
{% endfor %}
<style>

View File

@@ -9,6 +9,7 @@ and structure of the site and pages in the site.
import os
import shutil
from urlparse import urlparse
def copy_file(source_path, output_path):
@@ -137,10 +138,10 @@ def create_media_urls(nav, url_list):
final_urls = []
for url in url_list:
# Allow links to fully qualified URL's
if '//' in url:
parsed = urlparse(url)
if parsed.netloc:
final_urls.append(url)
else:
relative_url = '%s/%s' % (nav.url_context.make_relative('/'), url)
final_urls.append(relative_url)
return final_urls