TiddlyWikiClassic icon indicating copy to clipboard operation
TiddlyWikiClassic copied to clipboard

Standard order of tiddler attributes storage (to prevent unwanted diffs)

Open PengjuYan opened this issue 1 year ago • 5 comments

This issue surfaces to me when I'm developing/testing a plugin SwitchPalettePlugin. You won't notice that if you are a normal user.

When I save a TWC file, and use git diff to check the difference, I found many unnecessary changes are made to the order of html attributes of some tiddlers, even if the content of these tiddlers (title, tags, text) are never changed by the user.

Here are some examples:

tiddler before save after save
ColorPalette title="ColorPalette" modifier="Pengju" created="202401260942" modified="202401271137" is.dark.mode="true" from.palette="ColorPalette (pengju dark)" server.type="file" server.page.revision="202401270237" changecount="2" title="ColorPalette" modifier="Pengju" created="202401260942" modified="202401271137" changecount="2" server.page.revision="202401270237" server.type="file" from.palette="ColorPalette (pengju dark)" is.dark.mode="true"
TiddlerInFilePlugin title="TiddlerInFilePlugin" modifier="Yakov Litvin" created="201808191403" modified="202212060812" tags="systemConfig" content-type="text/javascript" changecount="274" title="TiddlerInFilePlugin" modifier="Yakov Litvin" created="201808191403" modified="202212060812" tags="systemConfig" changecount="274" content-type="text/javascript"

You can see that the attributes values remain untouched but what have been changed are the orders only.

Interestingly, attribute order of some tiddler never change. Those tiddlers include DefaultTiddlers, ExternalTiddlersList, StyleSheet, etc.

Because all the intact tiddlers only have normal attributes including title, creator, modifier, created, modified,tags (changecount seems like a second-class-citizen, too) and contaminated ones have non-official second-class-citizen attributes like server.type, from.palette, my guess is that the order of keys of official attributes are kept while others aren't.

While this doesn't seem a big deal, it does have some negative effect in some situations. Imagine you like to use git to track the changes to your TWC html file, the trial change of attribute order will make your tracking much harder (you have to look for real changes hidden in many non-sense ones).

PengjuYan avatar Feb 10 '24 09:02 PengjuYan