Fog Creek Software
Discussion Board




Preserving HTML formatting can be done

Suppose you write the following in CityDesk
“<STRONG><P>aaa</P  ></STRONG>”

CityDesk 2.0 rewrites it as
“<p><strong>aaa</strong></p>”

As you can see, white space and case sensitivity is lost.
Now, in my postmortem analysis, I think CityDesk read the
segment of code into a node in a multi-way tree with the
following data structure:

Node.Data = “aaa”
Node.IsStrong = True
Node.IsP = True
Node.IsBR = False
e.t.c.

So when dumping the tree into a flat file, CityDesk choose
the tag writing order, in its preferred case sensitivity and
without preserving white space.  But, suppose CityDesk
changes slightly and put the following into the data
structure:

Node.Data = “<STRONG><P>aaa</P  ></STRONG>”
Node.IsStrong = True
Node.IsP = True
Node.IsBR = False
e.t.c.

A dump of the entire tree will need only the “Data” field
and the output will be exactly the same as the input if the
input is a valid HTML document.

Amour Tan
Tuesday, September 02, 2003

CityDesk 2.0 converts the sample you gave into the correct XHTML i.e. all lowercase and with no whitespace in the closing paragraph tag. What is your point?

John Topley (www.johntopley.com)
Tuesday, September 02, 2003

Say Amour, what happens if the person selects the text and unchecks 'strong' so that:

Node.IsStrong = False?

Do you go and strip out the <STRONG></STRONG> bit from Node.Data? If so, what if they click 'strong' again and:

Node.IsStrong = True

Then what does it do? And what gets generated in the end? Doesn't take more than a couple of simple what-if's before you see just how complex this kind of thing is.

John C
Tuesday, September 02, 2003

"CityDesk 2.0 converts the sample you gave into the correct XHTML i.e. all lowercase and with no whitespace in the closing paragraph tag."

And proper tag nesting.

pb
Tuesday, September 02, 2003

I think you want this forum:

http://discuss.fogcreek.com/CityDesk/default.asp

www.marktaw.com
Tuesday, September 02, 2003

John C,

currently, CityDesk 2.0 changes HTML formatting *without*
doing anything in the WYSIWYG editor.  All it takes is just
previewing it.

And sure, if you use the WYSIWYG editor, it is reasonable
should you get the editor's formatting.

Amour Tan
Tuesday, September 02, 2003

I'm pretty sure that he's mentioned that they're going to fix the "reformat when you didn't make any changes" bug. However, as soon as you edit at all, it will revert your broken HTML into non-broken HTML. Deal. :)

Brad Wilson (dotnetguy.techieswithcats.com)
Tuesday, September 02, 2003

Cool! :-)

Amour Tan
Tuesday, September 02, 2003

"CityDesk 2.0 converts the sample you gave into the correct XHTML i.e. all lowercase and with no whitespace in the closing paragraph tag."

Well, at least the whitespace is perfectly legal, if useless. Consider the trick (recommended by W3C, alas) to add an extra space in empty tags to de-confuse user agents that don't grok SGML.

motta
Wednesday, September 03, 2003

*  Recent Topics

*  Fog Creek Home