Opened 13 years ago

Last modified 12 years ago

#8958 closed enhancement

Adding „library” section to presets. [idea] — at Version 2

Reported by: kendzi Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: presets library Cc:

Description (last modified by kendzi)

I count repeated lines in defaultpresets.xml and there are a lot of multiple repeated values. Also there are a lot of similar values but write in slight different way. Like one of character is upper case. When some of this item will change this implicate multiple changes in preset file and it is easy for mistake.

Most often repeat values are:

     65 <combo key="opening_hours" text="Opening Hours" values="24/7,Mo-Fr 08:30-20:00,Tu-Su 08:00-15:00;Sa 08:00-12:00" />
     38 <combo key="layer" text="Layer" values="5,4,3,2,1,0,-1,-2,-3,-4,-5" length="3" />
     37 <text key="website" text="Website" />
     31 <text key="wikipedia" text="Wikipedia" />
     28 <combo key="surface" text="Surface" values="paved,unpaved,asphalt,concrete,metal,wood,paving_stones,cobblestone,gravel,pebblestone,compacted,grass_paver,grass,sand,ground" />
     28 <combo key="incline" text="Incline" values="10%,-10%,10°,-10°,up,down" />

But there is much more.

So maybe it will be good idea to add section library for items. It could look this:

<preset>
	<group>
		<item>
			<item_element_ref ref=”opening_hours_ref”/>
		</item>
		<item>
			<!-- this example take combo from library but override key attribute -->
			<item_element_ref ref=”opening_hours_ref” key=”new_opening_hours_key”/>
		</item>
	</group>
	<library>
		<combo ref=”opening_hours_ref” key="opening_hours" text="Opening Hours" values="24/7,Mo-Fr 08:30-20:00,Tu-Su 08:00-15:00;Sa 08:00-12:00" />
	</library>
</preset>

So if some of values will change it will be only in one place. Preset file will be much simpler. This allow to protect from misspells too.

Change History (4)

by kendzi, 13 years ago

Attachment: count.zip added

count of repeated lines in preset

comment:1 by AlfonZ, 13 years ago

This seems similar to #7556.

comment:2 by kendzi, 13 years ago

Description: modified (diff)

by skyper, 13 years ago

Attachment: filtered_count.txt added

cleaned up list

Note: See TracTickets for help on using tickets.