Changeset - b60e58094fb7
[Not reviewed]
default
0 7 0
Mads Kiilerich - 10 years ago 2016-01-20 01:47:11
madski@unity3d.com
comments: change comment formatting to plain text instead of rst

There might be value in enabling rich markup (especially if it is markdown
instead of rst) ... or it might be a waste of time. We might revisit that
later.

But either way: Changing to plain text makes it more feasible to do markup of
hashes and issues - for now that is more important than rtf.
7 files changed with 12 insertions and 27 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/changeset.py
Show inline comments
 
@@ -412,7 +412,7 @@ class ChangesetController(BaseRepoContro
 
            raise HTTPBadRequest()
 
        text = request.POST.get('text')
 
        if text:
 
            return h.rst_w_mentions(text)
 
            return h.render_w_mentions(text)
 
        return ''
 

	
 
    @LoginRequired()
kallithea/lib/helpers.py
Show inline comments
 
@@ -1398,7 +1398,7 @@ def rst_w_mentions(source):
 
                   MarkupRenderer.rst_with_mentions(source))
 

	
 

	
 
def mentions_replace(match_obj):
 
def _mentions_replace(match_obj):
 
    return '<b>@%s</b>' % match_obj.group(1)
 

	
 

	
 
@@ -1413,7 +1413,7 @@ def render_w_mentions(source):
 
    # this sequence of html-ifications seems to be safe and non-conflicting
 
    # if the issues regexp is sane
 
    s = _urlify_text(s)
 
    s = MENTIONS_REGEX.sub(mentions_replace, s)
 
    s = MENTIONS_REGEX.sub(_mentions_replace, s)
 
    return literal('<code style="white-space:pre-wrap">%s</code>' % s)
 

	
 

	
kallithea/model/notification.py
Show inline comments
 
@@ -123,7 +123,7 @@ class NotificationModel(BaseModel):
 
            ## this is passed into template
 
            html_kwargs = {
 
                      'subject': subject,
 
                      'body': h.rst_w_mentions(body),
 
                      'body': h.render_w_mentions(body),
 
                      'when': h.fmt_date(notif.created_on),
 
                      'user': notif.created_by_user.username,
 
                      }
kallithea/public/css/style.css
Show inline comments
 
@@ -4131,9 +4131,7 @@ div.rst-block pre {
 

	
 
.comments .comment .text {
 
    background-color: #FAFAFA;
 
}
 
.comment .text div.rst-block p {
 
    margin: 0.5em 0px !important;
 
    margin: 6px;
 
}
 

	
 
.comments-number {
 
@@ -4294,13 +4292,6 @@ form.comment-inline-form {
 
    padding: 0 20px;
 
}
 

	
 
.inline-comments div.rst-block {
 
    clear: both;
 
    overflow: hidden;
 
    margin: 0;
 
    padding: 0 20px 0px;
 
}
 

	
 
.inline-comments .comment .comment-wrapp {
 
    max-width: 978px;
 
    border: 1px solid #ddd;
 
@@ -4338,6 +4329,7 @@ form.comment-inline-form {
 

	
 
.inline-comments .comment .text {
 
    background-color: #FAFAFA;
 
    margin: 6px;
 
}
 

	
 
.inline-comments .comments-number {
kallithea/templates/admin/notifications/show_notification.html
Show inline comments
 
@@ -37,7 +37,7 @@
 
        <div class="notification-body">
 
        <div class="notification-subject">${h.literal(c.notification.subject)}</div>
 
        %if c.notification.body:
 
            ${h.rst_w_mentions(c.notification.body)}
 
            ${h.render_w_mentions(c.notification.body)}
 
        %endif
 
        </div>
 
      </div>
kallithea/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -32,7 +32,7 @@
 
      </div>
 
      <div class="text">
 
        %if co.status_change:
 
           <div class="rst-block automatic-comment">
 
           <div class="automatic-comment">
 
             <p>
 
               <span title="${_('Changeset status')}" class="changeset-status-lbl">${_("Status change")}: ${co.status_change[0].status_lbl}</span>
 
               <span class="changeset-status-ico"><i class="icon-circle changeset-status-${co.status_change[0].status}"></i></span>
 
@@ -40,7 +40,7 @@
 
           </div>
 
        %endif
 
        %if co.text:
 
          ${h.rst_w_mentions(co.text)|n}
 
          ${h.render_w_mentions(co.text)|n}
 
        %endif
 
      </div>
 
    </div>
 
@@ -57,12 +57,7 @@
 
    ${h.form('#', class_='inline-form')}
 
      <div id="edit-container_{1}" class="clearfix">
 
        <div class="comment-help">${_('Commenting on line {1}.')}
 
          ${(_('Comments parsed using %s syntax with %s support.') % (
 
                 ('<a href="%s">RST</a>' % h.url('rst_help')),
 
                   ('<span style="color:#577632" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to notify another user'))
 
               )
 
            )|n
 
           }
 
          <span style="color:#577632" class="tooltip">${_('Comments are in plain text. Use @username inside this text to notify another user.')|n}</span>
 
        </div>
 
        <div class="mentions-container" id="mentions_container_{1}"></div>
 
        <textarea id="text_{1}" name="text" class="comment-block-ta yui-ac-input"></textarea>
 
@@ -145,9 +140,7 @@
 
      ${h.form(post_url, id="main_form")}
 
        <div id="edit-container" class="clearfix">
 
            <div class="comment-help">
 
                ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
 
                  '<span style="color:#577632" class="tooltip" title="%s">@mention</span>' %
 
                  _('Use @username inside this text to notify another user.')))|n}
 
              <span style="color:#577632" class="tooltip">${_('Comments are in plain text. Use @username inside this text to send notification to another local user.')|n}</span>
 
            </div>
 
            <div class="mentions-container" id="mentions_container"></div>
 
            ${h.textarea('text', class_="comment-block-ta")}
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -43,7 +43,7 @@ ${self.repo_context_bar('showpullrequest
 
            %endif
 
          </div>
 
          <div class="input">
 
            <div style="white-space:pre-wrap; line-height: 14px">${h.urlify_commit(c.pull_request.description, c.pull_request.org_repo.repo_name)}</div>
 
            <code style="white-space:pre-wrap; line-height: 14px">${h.urlify_commit(c.pull_request.description, c.pull_request.org_repo.repo_name)}</code>
 
          </div>
 
        </div>
 

	
0 comments (0 inline, 0 general)