Resolve preset_link issues

Simon Poole simon at poole.ch
Mon Apr 25 06:03:10 UTC 2022


Currently the preset <preset_link> element takes a "name" attribute to 
identify the preset item that it links to. Over the years this has 
caused many issues as it requires the name to be unique over all active 
presets to  work in a predictable way, something that obviously can't be 
guaranteed.

As so many preset related issues I intend to address this, in a 
backwards compatible fashion, in our implementation of JOSM preset 
support, but would naturally be interested in feedback and JOSM perhaps 
at one time following suite, see 
http://vespucci.io/tutorials/presets/#extensions and 
https://github.com/simonpoole/beautified-JOSM-preset.

Internally in Vespucci we reference preset items (for example in the 
most recently used preset item list) via an object that models the path 
to the item from the root of the relevant preset, the only thing really 
missing here is agreement on a textual representation of the path for 
use in preset_link elements. This for example could be a URI based 
format using an appropriate scheme (josm-preset ?). This potentially 
could also allow for cross preset references by optionally using an 
"authority" like field to reference the preset name (which would also 
solve the issue of search order mentioned above). The only real downside 
is that group/item names using reserved characters, at least "/" would 
need to be encoded.

A backwards compatible way of adding this would be to support an uri 
attribute on the preset_link element.

URI proposal:

josm-preset:[//<preset name>][/]<path>

making the root / optional allows for relative references to items. If 
an item can't be found the implementation could still fall back to 
searching.

Simon

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstreetmap.org/pipermail/josm-dev/attachments/20220425/061c8b71/attachment.sig>


More information about the josm-dev mailing list