Merge Whitespace preservation fix from master

Prevents Textile from collapsing white-space inside
code blocks and removes added extra hard-coded
newlines that only work because they are inside
inline HTML elements, e.g. code.

White-space is trimmed from the end of the text,
because otherwise the last extended block will include the last stranded empty line. This then removes the
need for the trim + hard-coded LF, and allows us
to actually join the blocks with the original separating
whitespace.

This fixes the formatting inside bc, notextile, bq
and pre tags, and/or any other extended blocks.