Quote tags not on their own line -> breaks quote

(Simon) #1

I’ve noticed this when quoting others and I now I see it also happened to a fellow poster here:

For some reason, as soon as the “[quote]” tags are not on a line of their own, the quote breaks. Is this desired behavior or a bug?

(Curtis Wilcox) #2

I wouldn’t call it “desired behavior” but I think the formatting has to be that way so Discourse knows that it’s the beginning and end of a quote. Marc made a mistake by removing the line break before the closing tag (unless the WYSIWYG editor did that which would be a bug). Otherwise, a discussion like this about [quote] tags could have a different set of errors.

(Simon) #3

I don’t understand. I would have thought the “[/quote]” defines the end. Why should an additional CR be required?

(Marc Z) #4

I agree. I’m not sure what I did on that first one that messed it up, but I just replied to another post and I removed the CR (a habit from wanting my tags even) and it worked fine. The earlier message I’d replied to on my iPhone and the web page was a bit weird (i.e. hard to tell what I was editing). The second one I did on my Mac, so that could make a difference.

(Curtis Wilcox) #5

If “[/quote]” alone defined the end, then what I just wrote would have to be interpreted as the end of a quote containing “If.” It’s common for strings to be parsed line-by-line and for characters or particular strings to be treated differently when they’re preceded by a line break. For example, you can have text be styled as a quote by starting a new line with the greater-than character (>).

If there wasn’t a line break before the greater-than character I typed, this text wouldn’t be formatted as a quote.

Also, Discourse accepts posts by email and some email clients add line breaks. By requiring the square brackets of a quote tag to be preceded by and followed by a line break, it virtually eliminates the possibility that the author meant the string to be interpreted as anything other than a quote tag.

(Simon) #6

Well not really because that “quote” was never opened by the “[quote]” tag. But I see what you’re saying. I guess I’m just surprised since I know other forum software does not parse in this strict way. At least Discourse is consistent. It requires both the opening and the closing tag to be on their own lines. If either isn’t the whole quote breaks.

(Adam Engst) #7

I did a little searching in the Discourse forum on this, and while I didn’t see anything specific, the discussions I found point to the fact that parsing in multiple formats and with direct entry text and email imports is just really squirrelly, so it’s best to keep things return-delimited when possible.

(Adam Engst) #8

It was super easy for me (or you, if you noticed in time) to edit the post and add that CR back in to fix the quotes.

(Simon) #9

Thanks, Adam.