]> oss.titaniummirror.com Git - webber.git/blobdiff - plugins/link.py
link: use URL if no text has been specified
[webber.git] / plugins / link.py
index ae86ca0a0b94ef649ebd7be0df6ddfdc5c530807..d8c42149434ed60f5c1bb71c026a01307ce35755 100644 (file)
@@ -26,9 +26,10 @@ def do_link(m):
        link = m.group(2).replace("\n", " ")
        anchor = m.group(3) or ""
        if link.find(".") == -1:
-               #link = link.tolower()
                for f in files:
                        file = files[f]
+                       if not file.has_key("linktitle"):
+                               continue
                        if file.title == link or \
                           file.linktitle == link or \
                           os.path.splitext(os.path.basename(file.path))[0] == link:
@@ -38,6 +39,8 @@ def do_link(m):
                                link = get_link_from(get_current_file().linktitle, file.linktitle)
                                #print "LINK: '%s' '%s'" % (text, link)
                                break
+       if not text:
+               text = link
        # TODO: validate link
        return '<a href="%s%s">%s</a>' % (link, anchor, text)