Closed Bug 1154457 Opened 9 years ago Closed 8 years ago

Extra lines for nested MarkDown lists

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 6.0

People

(Reporter: altlist, Assigned: altlist)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch v1 (obsolete) — Splinter Review
The change in bug 1059684 causes an unwanted effect for nested lists. A comment such as below:

- foo
  - bar
    - baz

produces:

- foo
                              <--- one blank line
  - bar
                              <--- two blank lines

    -baz

The specific change in the other ticket was:

   Bugzilla/Markdown.pm:
   -    $text =~ s/ {2,}\n/ <br$self->{empty_element_suffix}\n/g;
   +    $text =~ s/\n/<br$self->{empty_element_suffix}\n/g;
 
Reverting this patch fixes the nested list problem, yet breaks the original <pre> issue. 

Attached is one way I solved it.
Attachment #8592453 - Flags: review?(glob)
Comment on attachment 8592453 [details] [diff] [review]
v1

i really wanted to review this, but it's increasingly unlikely i'll have time.  opening up the review for others.
Attachment #8592453 - Flags: review?(glob) → review?
Attachment #8592453 - Flags: review? → review?(koosha.khajeh)
Attached patch v2Splinter Review
Updated and simplified version.  The prior version would caused fenced code blocks to be skipped
Attachment #8592453 - Attachment is obsolete: true
Attachment #8592453 - Flags: review?(koosha.khajeh)
Attachment #8679589 - Flags: review?(koosha.khajeh)
Assignee: create-and-change → altlist
Status: NEW → ASSIGNED
Comment on attachment 8679589 [details] [diff] [review]
v2

>+    # strip trailing newlines created by DoLists
>+    $text =~ s/\n</</g;

Despite this fixes the problem, this code will catch all occurences of \n<, not only those generated by _DoLists(). This can probably have other side-effects, right? I.e. remove newlines where it shouldn't. IMO, the right fix is for lists to not insert <br> between items. This doesn't make sense.
(In reply to Frédéric Buclin from comment #3)
> IMO, the right fix is for lists to not insert <br> between items. This doesn't make sense.

Ah, I see where <br> comes from. _RunSpanGamut() converts \n into <br>.

In that case, I don't see why the change mentioned in comment 0 cannot be reverted. Do you have a testcase where reverting this change would trigger some problem?
dkl: could you explain why the change mentioned in comment 0 has been done? And would it regress something to revert this specific change?
Flags: needinfo?(dkl)
Attachment #8679589 - Flags: review?(koosha.khajeh) → review?(LpSolit)
Attachment #8679589 - Flags: review?(LpSolit) → review?(dkl)
Comment on attachment 8679589 [details] [diff] [review]
v2

Review of attachment 8679589 [details] [diff] [review]:
-----------------------------------------------------------------

r=dkl
Attachment #8679589 - Flags: review?(dkl) → review+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   4bd1de9..ae22da8  master -> master
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Flags: needinfo?(dkl)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: