Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
Text('Discontinued Products'),
View('Wg10X', 'products', product='wg10x'),
),
Link('Tech Support', 'http://techsupport.invalid/widgits_inc'),
Link('Tech Support', 'http://techsupport.invalid/widgits_inc',
target='_blank'),
))


Expand Down
3 changes: 2 additions & 1 deletion flask_nav/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ def render(self, renderer=None, **kwargs):

class Link(NavigationItem):
"""An item that contains a link to a destination and a title."""
def __init__(self, text, dest):
def __init__(self, text, dest, **attribs):
self.text = text
self.dest = dest
self.attribs = attribs

def get_url(self):
return self.dest
Expand Down
2 changes: 1 addition & 1 deletion flask_nav/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, **kwargs):
self.kwargs = kwargs

def visit_Link(self, node):
return tags.a(node.text, href=node.get_url())
return tags.a(node.text, href=node.get_url(), **node.attribs)

def visit_Navbar(self, node):
kwargs = {'_class': 'navbar'}
Expand Down