示例#1
0
 def handle_url(self, text):
     """Return a clickable url."""
     url = text
     if text.startswith("http://"):
         text = text[7:]
     if text.endswith("/"):
         text = text[:-1]
     url = simplemarkdown.html_escape(url).replace('"', """)
     text = simplemarkdown.html_escape(text)
     return '<a href="{0}">{1}</a>'.format(url, text)
示例#2
0
 def handle_url(self, text):
     """Return a clickable url."""
     url = text
     if text.startswith('http://'):
         text = text[7:]
     if text.endswith('/'):
         text = text[:-1]
     url = simplemarkdown.html_escape(url).replace('"', '&quot;')
     text = simplemarkdown.html_escape(text)
     return '<a href="{0}">{1}</a>'.format(url, text)
示例#3
0
 def handle_shortcut(self, text):
     """Return the keystroke currently defined for the action."""
     collection_name, action_name = text.split(None, 1)
     import actioncollectionmanager
     action = actioncollectionmanager.action(collection_name, action_name)
     seq = action.shortcut()
     key = seq.toString(QKeySequence.NativeText) or _("(no key defined)")
     return '<span class="shortcut">{0}</span>'.format(simplemarkdown.html_escape(key))
示例#4
0
 def handle_shortcut(self, text):
     """Return the keystroke currently defined for the action."""
     collection_name, action_name = text.split(None, 1)
     import actioncollectionmanager
     action = actioncollectionmanager.action(collection_name, action_name)
     seq = action.shortcut()
     key = seq.toString(QKeySequence.NativeText) or _("(no key defined)")
     return '<span class="shortcut">{0}</span>'.format(
         simplemarkdown.html_escape(key))
示例#5
0
 def handle_image(self, filename):
     url = simplemarkdown.html_escape(filename).replace('"', '&quot;')
     return '<img src="{0}" alt="{0}"/>'.format(url)
示例#6
0
 def handle_text(self, text):
     """Return text escaped, it will not be represented as HTML."""
     return simplemarkdown.html_escape(text)
示例#7
0
def format_link(name):
    """Make a clickable link to the page."""
    title = simplemarkdown.html_escape(cache.title(name))
    return '<a href="{0}">{1}</a>'.format(name, title)
示例#8
0
 def handle_image(self, filename):
     url = simplemarkdown.html_escape(filename).replace('"', "&quot;")
     return '<img src="{0}" alt="{0}"/>'.format(url)
示例#9
0
 def handle_text(self, text):
     """Return text escaped, it will not be represented as HTML."""
     return simplemarkdown.html_escape(text)