Defect #6148

Quoting, newlines, and nightmares...

Added by Nick Peelman about 7 years ago. Updated over 6 years ago.

Status:ClosedStart date:2010-08-16
Priority:NormalDue date:
Assignee:Jean-Baptiste Barth% Done:

0%

Category:Text formatting
Target version:1.2.0
Resolution:Fixed Affected version:

Description

Prelude

Apologies in advance if this bug exists already, I searched around but couldn't find anything. I also tried to engineer a patch, but i got lost really fast once things went into RedCloth territory.

Input:

> One Line
> Two Line
> Three Line

Expected:

Something along the lines of:

One Line

Two Line

Three Line

Without the extra line breaks.

Actual:

One Line
Two Line
Three Line

Comments:

Two newlines, back to back, signifies a paragraph. Got it. A single newline, particularly when inputting text then quoting it (like when I am copying in the body of an external email, for instance) should at least put in a line break (<br/>) at the end of each line to attempt to retain some of the structure of what was there. I don't need it to be rigid like pre is, but it needs to be somewhat stricter than what it is currently.

Another option may be some kind of redcloth extension / override that lets people put in a line break manually, either via the HTML syntax, some kind of formatting hook, a macro or <insert solution here>.

Associated revisions

Revision 5133
Added by Jean-Philippe Lang over 6 years ago

Fixed: line breaks are ignored in quoted text (#6148).

History

#1 Updated by Jean-Baptiste Barth about 7 years ago

  • Status changed from New to 7
  • Assignee set to Jean-Baptiste Barth

I think it should work out of the box, no need for a specific macro or manual hack.

#2 Updated by Felix Schäfer about 7 years ago

Nick, don't ask me why exactly that is (there are reasons for that, but somewhat deeper than the time I have now allows), but:

> blah
foo

Probably yields what you are looking for:

blah

foo

I don't know if this is redmine mangling textile's bq. tag or earlier redcloth/textile versions behaving that way, but the correct interpretation of:

> blah
> foo

Should be:

<blockquote>
  <p>
    "blah"<br>
    "> foo" 
  </p>
</blockquote>

rather than what we are getting now:

<blockquote>
  <p>blah
  foo</p>
</blockquote>

You can try that on the textile example page, though the tag for (block)quotes there is not > but bq. .

#3 Updated by Jean-Baptiste Barth about 7 years ago

So there are two problems behind what you say Felix (and what Redcloth implemented maybe) :
  1. the wysiwyg buttons "quote" and "remove quote" add/remove > signs at the beginning of each line
  2. when you copy/paste mails, there's a > at the beginning of each line, not just the blockquote. Plus I don't really see how we could have lines quoted multiples times (useful for mails, again) with this syntax

What do you think ?

#4 Updated by Felix Schäfer about 7 years ago

Well, the single tag that spans until the end of the current paragraph/the next pair of newlines is consistent with the rest of textile, e.g.:

h2. some title
spanning 2 lines

yields a title with a <br> in it spanning 2 lines:

some title
spanning 2 lines

or in html:

<h2>
  "some title" 
  <br>
  "spanning 2 lines" 
</h2>

In this respect, the current blockquote implementation breaks the textile idiom.

As to your questions: I'm not sure textile supports nested blockquotes, but that's probably only because of the use of bq. rather than a "specific" tag like >. I think it should be possible to get nested blockquotes with > repetition as it is done for lists (** starts a sublist in another *), as to mails: yes, there'd need to be some mangling to remove the extraneous > on all lines past the first one, but that's the price to pay to have textile rather than mail syntax in the wiki fields :-)

(on a side-note: you can't start with a double-nested list item in textile, i.e. ** foo on its own on a line will still generate a list of depth 1 instead of 2, but I suppose this is more a safe-guard for lists)

#5 Updated by Felix Schäfer about 7 years ago

Come to think of it, > already does everything we "need" except that it doesn't start a new blockquote when hitting a new > and continues the current blockquote instead.

#6 Updated by Nick Peelman about 7 years ago

That's all well and good, for you and I and Jean here to discuss it in the context of a programming condundrum. But I have a dozen new Redmine users looking at it and going "Well that's dumb.", because it is (and i'm certain my users aren't the only ones). Headers make sense that they get a blank line after them. Paragraph tags too. The table syntax, while weird, is still better than MediaWiki's. But the quoting stuff is confusing for reasons passing understanding. I can't tell them to just wrap stuff in pre tags, because then long lines run off the screen and don't wrap, which is confusing as well for somebody not familiar with the problem.

Whether its right or not, in the context of the syntax, its not what people expect. I don't expect being able to paste in random text and have all the formatting preserved, but i DO expect at least the new lines to get preserved, without me having to go massage a giant body of text. \n\r is a \n\r, and that is especially true when quoting.

#7 Updated by Nick Peelman about 7 years ago

Oh, and as Jean pointed out, the Quote/Unquote buttons in Redmine add a > to the beginning of each line, whether or not they should or not, based on your summation of how things work, further confusing users and the situation.

#8 Updated by Jean-Philippe Lang over 6 years ago

  • Status changed from 7 to Closed
  • Target version set to 1.2.0
  • Resolution set to Fixed

Fixed in r5133. Line breaks are now preserved in quoted text.

the current blockquote implementation breaks the textile idiom

Maybe, but that's not the issue reported here. A nice thing is that it supports block formatting inside quoting:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.
  • Donec odio lorem,
  • sagittis ac,
  • malesuada in,
  • adipiscing eu, dolor.

Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus.
Proin a tellus. Nam vel neque.

test test
cell cell

I doubt that it can be done with pure textile syntax. Please, let me know if I'm wrong.

Also available in: Atom PDF