User blog:Phlox/Dancing with Semantic Forms- Unbunching the templates

Visually, it makes sense to distribute information about an individual in multiple boxes
 * 1) The main person infobox
 * 2) A table indicating the children
 * 3) Siblings table
 * 4) Descendants and ahnentafel ancestor trees
 * 5) Notes
 * 6) Migrations, Military service and religious events
 * 7) Residences

Currently we have examples of showfacts person showfacts children and showfacts notes tables. The others are variants and will follow when the fundamentals are solid, but what is clear is that we need to be able to sprinkle these freely throughout the article interspersed with text.

Problem" It's that "interspersed with text" bit that is the crux of the problem this post examines. What semantic forms do is rewrite an article.  Most of this is confined to the templates they recognize (via the for template statement).  Free text will be left where it is, but if the template is embedded within the free text, the template will be hoisted out and placed either at the start or end of the article.  The order depends on the order of occurrence of the for template statements in the form.  Whether they are before or after the free text depends on their relationship to the  statement.

Clearly, people are going to want to have more options than placing these display templates in different orders or in different locations than either the beginning or end of the article. This was assumed in the first design, employing the usual (xml/sgml split) between what the data is versus how it appears on a page. This provides the ability to display information that may be from some other article. For example, the children for a family could have been stored with the other parent or the data on the births and deaths could be stored in the english version of the article. In the first design we supported all of this with the split between Set templates versus Showfacts templates.

Enter the "double saving" problem. The fly in the ointment with first design has to do with how the wiki software works. Because when you save an article with new information and the new article is being assembled, at the moment the article needs to be able to ask for data to format on the page, the new data has not yet been saved. So what is displayed is the information that was saved from the former edit, not the new edit. This can be disorienting for new users, besides suggesting that the site is broken, and the newly entered information was lost/ignored.

The standard way semantic forms expect templates to work is that the template that renders the data is the same that declares the data. Since the render data comes from the parameters rather than stored properties, there is no double save problem. We can do each template one at a time this way and there will be no rearrangement. Remote articles (other parent or other language version) can access the stored properties when the parameters that normally hold these values are empty. The second design is a hybrid, where a showfacts template will be instantaneous when fed with parameters, but when used remotely will access the same values via properties.

So remaining design challenge at this juncture is the behavior of these hybrids within the home article. We need to avoid the double saving problem while allowing for free arrangement of the templates on the page. It seems that we can only support instantaneous mode with individual forms, and cannot achieve it with a global "edit with form" that is clicked on for the entire page, that is, without running into the rearrangement phenomenon.