9 messages in com.googlegroups.bloggerdevRe: [bloggerDev] Re: Request: Don't a...
FromSent OnAttachments
danielpunkass18 Mar 2007 11:25 
logh...@gmail.com21 Mar 2007 10:24 
danielpunkass21 Mar 2007 11:11 
danielpunkass21 Mar 2007 11:20 
Pete Hopkins ☠22 Mar 2007 14:34 
danielpunkass22 Mar 2007 16:57 
Pete Hopkins ☠22 Mar 2007 18:18 
logh...@gmail.com28 Mar 2007 09:28 
Pete Hopkins ☠28 Mar 2007 11:31 
Subject:Re: [bloggerDev] Re: Request: Don't add <br /> tags to posted content
From:Pete Hopkins ☠ (phop@google.com)
Date:03/28/2007 11:31:41 AM
List:com.googlegroups.bloggerdev

On 3/28/07, logh@gmail.com <logh@gmail.com> wrote:

Hi Pete,

This explains a fair amount of strange behavior I've seen with regards to formatting changes... I never dug into it deep enough but mostly recommended people turn off the <br /> feature.

I'd say it's ok to stop the current behavior and stop turning \n to <br />. One question that perhaps I didn't understand from your comment is how you handle existing posts... Would you try to somehow 'clean those up' or would you let them be as they are.

My only concern is that it might change existing layouts.

I think you misunderstand a bit... the current (very legacy) behavior is that we have a setting that controls whether a post's linebreaks (as stored in the backend) are converted to <br/> tags on display (where here display means on the blog and in the feeds).

Currently, we only do this conversion one-way: from the post to the feed. We are not doing it on the way back in (e.g. a POST or PUT via GData). This means that any linebreaks you send in your posts will either be significant (if the user leaves the setting at its default, on) or insignificant (if they've changed it), and your app has no way of knowing.

It also means that you cannot exactly round-trip a post. If you request a post, we'll turn the linebreaks into <br/>s, but if you parrot back what we sent, we'll store the <br/> version in the backend, so that when a user looks at the post in e.g. Edit HTML mode, he'll see <br/> tags when he expected to see linebreaks.

So, I'm considering changing Blogger's behavior on POSTs and PUTs to hide the details of this from API clients. The proposed behavior is that API clients should *always* use <br/> when they want new lines, and assume that newlines will be treated according to HTML whitespace rules. Then Blogger will convert or not if necessary to match users' expectations for the post editor.

My overall question is whether or not this would break any existing clients. I'll ask this generally on another thread.

-- Pete

On Mar 22, 6:18 pm, "Pete Hopkins ☠" <phop@google.com> wrote:

I can sympathize with you. This is a legacy setting that's not very well implemented.

That being said, I think we do have a bug in that roundtripping a post with linebreaks through GData does not preserve it. The linebreaks are converted to <br>s but not back again. This means that, in the Blogger post editor's Edit HTML mode, the post is all run together, not the way the user may have typed it.

It is correct that GData clients should not have to worry about this issue, but I argue that they should work exclusively in the HTML realm, expecting to receive it and return it.

It's wrong to characterize the <br> tags as presentational. Rather, the *lack* of <br> tags is better thought of as a shorthand feature of the Blogger HTML mode editor.

My proposed change, which I will likely implement, is to back-convert linebreaks that come in from GData clients, when the blog is set to convert linebreaks on its output.

That way, GData clients can deal exclusively in HTML, and not be concerned about Blogger's archaic "convert line breaks" setting. If a client wishes to offer its own linebreak setting, or work in paragraphs, that is fine.

Note that under this system, we would lose any linebreaks that are sent by a GData client when the blog has "convert line breaks" on (they would be replaced with spaces to prevent extra linebreaks in the output). However, if we define GData clients to operate exclusively in HTML, those line breaks *were* purely presentational, given that HTML treats all whitespace the same.

Still, I am interested in feedback. Is anyone out there *assuming* that they can post linebreaks to Blogger and have those be converted into <br>s in the blog's eventual output? I'd like to minimize breakage, though I'm not happy that the current system is semantically inconsistent.

-- Pete