Linebreaks in preview on AskMe. January 15, 2006 4:33 PM Subscribe
AskMe apparently trims line breaks from posts. I guess I understand this, but it would be nice if it also happened in the preview. In preview, my line breaks were still intact, so I hit the post button, and now my post looks a bit silly. Not the end of the world, but I figure it can't be intentional.
I got annoyed by this bug as well. I took extra care to replace the <BR>s I'd previously used with <P> to ensure there'd be a bit of extra space between the paragraphs (in lieu of indentation to indicate paragraph breaks).
Only to have my efforts thwarted, grrr. I'll probably never try to use multiple paragraphs again, so I don't care about the bug one way or the other.
It is very annoying. Indeed, I was vexed, [stomps foot], [pouts].
I should think there are other things of more importance.
posted by five fresh fish at 9:11 PM on January 15, 2006
Only to have my efforts thwarted, grrr. I'll probably never try to use multiple paragraphs again, so I don't care about the bug one way or the other.
It is very annoying. Indeed, I was vexed, [stomps foot], [pouts].
I should think there are other things of more importance.
posted by five fresh fish at 9:11 PM on January 15, 2006
I figure it can't be intentional.
you figure wrong, kemo sabe.
posted by quonsar at 5:10 AM on January 16, 2006
you figure wrong, kemo sabe.
posted by quonsar at 5:10 AM on January 16, 2006
i thought that was just projects?
i hate the whole way formatting is handled here. it's inconsistent internally and inconsistent with other sites. i'd suggest the following instead:
- store text exactly as it is entered. saving the space occupied by <p> really needs serious justification.
- store in addition a boolean value that the user selects on posting (checkbox). by default this is true and it's called "autoformat".
- on display, if autoformat is true, escape all appropriate characters and then split text by line breaks. put each chunk of text inside a <p> block. this gives an intuitively correct auto-formatted display for newbies that displays html they enter as text.
- if autoformat is false, dump the text directly to the page. this lets advanced users add whatever markup they like. if you want to restrict tags, run this through some kind of filter.
that's what i'm using in a current project and, imho, it's pretty neat. in the case of mefi you'd also need to go though old posts with a procedure that places the current formatting directly in the database and sets autoformat false (so that old messages display correctly).
posted by andrew cooke at 5:47 AM on January 16, 2006
i hate the whole way formatting is handled here. it's inconsistent internally and inconsistent with other sites. i'd suggest the following instead:
- store text exactly as it is entered. saving the space occupied by <p> really needs serious justification.
- store in addition a boolean value that the user selects on posting (checkbox). by default this is true and it's called "autoformat".
- on display, if autoformat is true, escape all appropriate characters and then split text by line breaks. put each chunk of text inside a <p> block. this gives an intuitively correct auto-formatted display for newbies that displays html they enter as text.
- if autoformat is false, dump the text directly to the page. this lets advanced users add whatever markup they like. if you want to restrict tags, run this through some kind of filter.
that's what i'm using in a current project and, imho, it's pretty neat. in the case of mefi you'd also need to go though old posts with a procedure that places the current formatting directly in the database and sets autoformat false (so that old messages display correctly).
posted by andrew cooke at 5:47 AM on January 16, 2006
you too? does it make you kill kittens?
posted by andrew cooke at 12:50 PM on January 16, 2006
posted by andrew cooke at 12:50 PM on January 16, 2006
on display, if autoformat is true, escape all appropriate characters and then split text by line breaks. put each chunk of text inside a <p> block. this gives an intuitively correct auto-formatted display for newbies that displays html they enter as text.
This would require a ton of extra processing. That could be minimized with an extra level of caching, but that requires extra memory, and still creates new processing demands of its own.
posted by gsteff at 1:16 PM on January 16, 2006
This would require a ton of extra processing. That could be minimized with an extra level of caching, but that requires extra memory, and still creates new processing demands of its own.
posted by gsteff at 1:16 PM on January 16, 2006
it can be done with a state machine on the output stream. you need just one bit of state - whether you are inside a p-block or not. initially it would be false. when you first hit a non-space character you flip the state and output the open tag. when you hit a carriage return you close the tag and flip state.
it's hard to think of something that would require less processing since you do need to scan the text at least once to copy it from the database.
i wouldn't implement it like that at first, of course. first i'd do measurements, since a huge amount of this site is already cached. but if it was a performance hit, it could be fixed.
posted by andrew cooke at 1:25 PM on January 16, 2006
it's hard to think of something that would require less processing since you do need to scan the text at least once to copy it from the database.
i wouldn't implement it like that at first, of course. first i'd do measurements, since a huge amount of this site is already cached. but if it was a performance hit, it could be fixed.
posted by andrew cooke at 1:25 PM on January 16, 2006
on display, if autoformat is true, escape all appropriate characters and then split text by line breaks. put each chunk of text inside a <p> block. this gives an intuitively correct auto-formatted display for newbies that displays html they enter as text.
But surely you want to minimise the processing necessary to render the page. Why couldn't you do all the necessary escaping, filtering, splitting etc on the posting page, before insertion into the database? You could still have an autoformat checkbox or whatever, but this would affect the pre-insertion processing, and its value needn't be stored in the DB. Or am I missing something? I'm assuming database size is much less of an issue than processing time, memory requirements etc.
posted by matthewr at 1:41 PM on January 16, 2006
But surely you want to minimise the processing necessary to render the page. Why couldn't you do all the necessary escaping, filtering, splitting etc on the posting page, before insertion into the database? You could still have an autoformat checkbox or whatever, but this would affect the pre-insertion processing, and its value needn't be stored in the DB. Or am I missing something? I'm assuming database size is much less of an issue than processing time, memory requirements etc.
posted by matthewr at 1:41 PM on January 16, 2006
yes, you could. sorry, i missed that completely. in my case, i can't because i let the user edit their text later. but if matt is never going to let users edit text and has no "philosophical" objections to storing processed data (he hasn't; i do ;o), you could do that.
posted by andrew cooke at 1:47 PM on January 16, 2006
posted by andrew cooke at 1:47 PM on January 16, 2006
you figure wrong, kemo sabe.
No, shitstain. I meant that I figured the fact that the lack of consistency between preview and postview cannot be intentional.
posted by bingo at 9:56 PM on January 16, 2006
No, shitstain. I meant that I figured the fact that the lack of consistency between preview and postview cannot be intentional.
posted by bingo at 9:56 PM on January 16, 2006
You are not logged in, either login or create an account to post comments
posted by jessamyn (staff) at 5:02 PM on January 15, 2006