Beispiel #1
0
def render_markdown_with_project(content, project_name):
    text = render_markdown(content)
    text = re.sub(RE_TICKET, TICKET_LINK_TEXT % project_name, text)
    text = re.sub(RE_ISSUE, ISSUE_LINK_TEXT % project_name, text)
    text = re.sub(RE_COMMIT, COMMIT_LINK_TEXT % project_name, text)
    text = text.replace("[PROJECT]", "/%s/raw/master/" % project_name)
    return text
Beispiel #2
0
def render_markdown_with_team(content, team):
    text = render_markdown(content)
    text = re.sub(
        RE_TICKET,
        r'<a href="' + team.url + r'issues/\1/" class="issue-link">#\1</a>',
        text)
    return parse_emoji(text, is_escape=False)
Beispiel #3
0
def render_markdown_with_project(content, project_name):
    text = render_markdown(content)
    text = re.sub(RE_TICKET,
                  TICKET_LINK_TEXT % project_name,
                  text)
    text = re.sub(RE_ISSUE,
                  ISSUE_LINK_TEXT % project_name,
                  text)
    text = re.sub(RE_COMMIT,
                  COMMIT_LINK_TEXT % project_name,
                  text)
    text = text.replace("[PROJECT]", "/%s/raw/master/" % project_name)
    return text
Beispiel #4
0
 def markdown(self):
     return render_markdown(self.unicode)
Beispiel #5
0
def render(content, project_name=None):
    if project_name:
        return render_markdown_with_project(content, project_name)
    return render_markdown(content)
Beispiel #6
0
 def test_render_markdown_with_chinese(self):
     t = u'     牛B'
     r = render_markdown(t).strip()
     assert r == u'<pre><code>\u725bB</code></pre>'
Beispiel #7
0
 def test_render_markdown_with_xss(self):
     t = '    <script>'
     r = render_markdown(t).strip()
     assert r == '<pre><code>&lt;script&gt;</code></pre>'
Beispiel #8
0
 def test_render_markdown_simple(self):
     t = 'aa'
     r = render_markdown(t).strip()
     assert r == '<p>aa</p>'
Beispiel #9
0
 def test_render_markdown_with_chinese(self):
     t = u'     牛B'
     r = render_markdown(t).strip()
     assert r == u'<pre><code>\u725bB</code></pre>'
Beispiel #10
0
 def test_render_markdown_with_xss(self):
     t = '    <script>'
     r = render_markdown(t).strip()
     assert r == '<pre><code>&lt;script&gt;</code></pre>'
Beispiel #11
0
 def test_render_markdown_simple(self):
     t = 'aa'
     r = render_markdown(t).strip()
     assert r == '<p>aa</p>'
Beispiel #12
0
 def markdown(self):
     return render_markdown(self.unicode)
Beispiel #13
0
def render(content, project_name=None):
    if project_name:
        return render_markdown_with_project(content, project_name)
    return render_markdown(content)
Beispiel #14
0
def render_markdown_with_team(content, team):
    text = render_markdown(content)
    text = re.sub(RE_TICKET, r'<a href="' + team.url +
                  r'issues/\1/" class="issue-link">#\1</a>', text)
    return parse_emoji(text, is_escape=False)