Commit f9130a6e by benjaoming

Various small fixes

parent 1a4ef5a6
......@@ -148,8 +148,11 @@ class AttachmentDownloadView(ArticleMixin, View):
def get(self, request, *args, **kwargs):
if self.revision:
return send_file(request, self.revision.file.path,
self.revision.created, self.attachment.original_filename)
try:
return send_file(request, self.revision.file.path,
self.revision.created, self.attachment.original_filename)
except OSError:
pass
raise Http404
class AttachmentChangeRevisionView(ArticleMixin, View):
......
......@@ -42,8 +42,6 @@ class WikiPathExtension(markdown.Extension):
for key, value in configs :
# self.config[key][0] = value
self.setConfig(key, value)
print "I was created"
def extendMarkdown(self, md, md_globals):
self.md = md
......
......@@ -42,7 +42,7 @@ URLIZE_RE = '(%s)' % '|'.join([
r'<(?:f|ht)tps?://[^>]*>',
r'\b(?:f|ht)tps?://[^)<>\s]+[^.,)<>\s]',
r'\bwww\.[^)<>\s]+[^.,)<>\s]',
r'[^(<\s]+\.(?:com|net|org)\b',
r'[^(<\s"]+\.(?:com|net|org)\b',
])
class UrlizePattern(markdown.inlinepatterns.Pattern):
......
......@@ -4,9 +4,10 @@
<p>
{% trans "Type in something from another wiki page's title and auto-complete will help you create a tag for you wiki link. Tags for links look like this:" %}<br />
<code>[Title of link](wiki:ArticleSlug)</code>
</p>
<pre>[Title of link](wiki:ArticleSlug)</pre>
<p>
<input type="text" class="page_title_query" id="links_page_title_query" value="" placeholder="Type to search..." />
<button type="button" class="btn" onclick="wikiInsertLink()">
......@@ -14,7 +15,17 @@
</button>
</p>
<hr />
<h4>{% trans "An external link" %}</h4>
<p>
{% trans "You can link to another website simply by inserting an address example.com or http://example.com or by using the markdown syntax:" %}<br />
</p>
<pre>[Clickable text](http://example.com)</pre>
<script type="text/javascript" src="{{ STATIC_URL }}wiki/js/bootstrap-typeahead.js"></script>
<script type="text/javascript">
$('.page_title_query').typeahead({
......
......@@ -18,7 +18,7 @@ class QueryUrlPath(View):
article__current_revision__deleted=False,
)
matches = matches.select_related_common()
return [("[%s](wiki:%s)") % (m.article.current_revision.title, m.path) for m in matches[:max_num]]
return [("[%s](wiki:%s)") % (m.article.current_revision.title, '/'+m.path.strip("/")) for m in matches[:max_num]]
return []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment