src/templates/modules/repo-actions-table.html \
src/templates/modules/repository-table.html \
src/templates/modules/source-table.html \
+ src/templates/modules/text.html \
src/templates/modules/updates-table.html \
src/templates/modules/user-table.html \
src/templates/modules/watchers-sidebar-table.html
if all((l == "" for l in message)):
return
- return "\n".join(message)
+ # We will now break the message into paragraphs
+ paragraphs = re.split("\n\n+", "\n".join(message))
+ print paragraphs
+
+ message = []
+ for paragraph in paragraphs:
+ # Remove all line breaks that are not following a colon
+ # and where the next line does not start with a star.
+ paragraph = re.sub("(?<=\:)\n(?=[\*\s])", " ", paragraph)
+
+ message.append(paragraph)
+
+ return "\n\n".join(message)
+
+ def split_paragraphs(self, s):
+ for group_seperator, line_iteration in itertools.groupby(s.splitlines(True), key=str.isspace):
+ if group_seperator:
+ continue
+
+ paragraph = "".join(line_iteration)
+ yield paragraph.replace("\n", " ")
@property
def message_full(self):
<h4>{{ commit.subject }}</h4>
-{% apply linkify %}
- {% module Text(commit.message) %}
-{% end %}
+{% module Text(commit.message) %}
\ No newline at end of file
--- /dev/null
+{% for paragraph in paragraphs %}
+ <p>
+ {% apply linkify %}
+ {{ paragraph }}
+ {% end %}
+ </p>
+{% end %}
\ No newline at end of file
from __future__ import division
import datetime
-import itertools
import math
import pytz
import re
-import string
import tornado.web
from .. import users
LINK = """<a href="%s" target="_blank" rel="noopener">%s</a>"""
- def split_paragraphs(self, s):
- for group_seperator, line_iteration in itertools.groupby(s.splitlines(True), key=str.isspace):
- if group_seperator:
- continue
-
- paragraph = "".join(line_iteration)
- yield paragraph.replace("\n", " ")
-
def render(self, text):
# Handle empty messages
if not text:
# Search for CVE numbers and create hyperlinks.
text = re.sub(self.CVE_PATTERN, self._cve_repl, text, re.I|re.U)
- return text
+ return self.render_string("modules/text.html", paragraphs=text.split("\n\n"))
def _bugzilla_repl(self, m):
bug_id = m.group(1)