maqetta/maqetta — Issue #1417: Rewrite HTML source formatting logic
Author: JonFerraiolo
Created: 2011-12-27 19:55:18+00:00
State: open
Labels: Model, Priority Med, Source Editors

@jhpedemonte

We don't have adequate source formatting logic in HTMLModel.js. We indent children, which is fine, and we attempt to not indent certain elements where it would be wasteful to indent (e.g., and ), but we arbitrary don't force newlines and indent on although usually we should because usually SPANs are used the wrapper element for widgets, and if we don't wrap SPANs than how come we continue to wrap LIs?

What we need are proposals for dealing with source formatting, followed by careful review, and then implementation, so that we can implement optimal HTML source formatting once and for all, and (hopefully) then not have to look at it again.

I expect we will need some heuristics for how to distinguish between different situations. For SPAN and LI items that just contain text content, then we should probably put both start tag and end tag on the same line:

```
Item 1

```

But if there are dvWidgets inside, then those child widgets should be on their own lines:

```

```

Overall, what I'm going for is for Maqetta to create as beautiful source code as we possibly can. Bear in mind that the Orion source editor will be able to help with source beautification, particularly the line folding feature. (In case of Maqetta, would also be nice if there were something in Orion for attribute folding or squishing because some widgets can have numerous attributes with long-winded attribute names and/or attribute values.)