Remove the trailing blank line in markdown text.

Review Request #4533 — Created Sept. 6, 2013 and submitted

Information

Review Board
master

Reviewers

Remove the trailing blank line in markdown text.

The markup() function returns a string with an extra blank line (as
every HTML tag is outputted with a trailing newline). We don't really
want this, since it leaves a blank line in each <pre>, so check if
there's a newline and strip it away. This brings the look to how we had
things pre-markdown.

Tested locally with different text. The textboxes no longer had the
annoying final newline.

Unit tests pass.

Description From Last Updated

Could we use .trim() instead?

daviddavid
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    Ignored Files:
    reviewboard/static/rb/js/utils/textUtils.js

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    Ignored Files:
    reviewboard/static/rb/js/utils/textUtils.js

  2. 
      
david
  1. 
      
  2. reviewboard/static/rb/js/utils/textUtils.js (Diff revision 1)
     
     
     
     
     
     
     
     
     
    Show all issues

    Could we use .trim() instead?

    1. We could, but I'm not sure if we want to, at least not here. I was trying to be cautious and only get rid of the newline that markup() places, and not any that were inserted as part of the text, since they'll otherwise still be there in the original content and affect the size when editing anyway.

    2. See bug 2933? I don't think trailing newlines are ever meaningful.

  3. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    Ignored Files:
    reviewboard/static/rb/js/utils/textUtils.js

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    Ignored Files:
    reviewboard/static/rb/js/utils/textUtils.js

  2. 
      
david
  1. Can you check that this fixes bug 2933?

    1. It does not. This only affects content after we've applied markdown. It has no impact on saving or loading from the server.

      If you add a bunch of blank lines and save, those blank lines will disappear on render, but be there again on edit.

    2. OK. I'll comment on the bug--no need to address it yet.

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Loading...