Fill in missing rule switches; make description optional

This commit is contained in:
Jason Perkins 2014-09-23 15:44:16 -04:00
parent 6fbc7ca3d7
commit 00ef897f2c

View File

@ -126,27 +126,33 @@
end end
function m.baseProperty(def, close) function m.baseProperty(def, suffix)
local c = p.capture(function ()
p.w('Name="%s"', def.name) p.w('Name="%s"', def.name)
p.w('HelpContext="0"') p.w('HelpContext="0"')
p.w('DisplayName="%s"', def.display or def.name) p.w('DisplayName="%s"', def.display or def.name)
p.w('Description="%s"%s', def.description or def.display or def.name, iif(close, ">", "")) if def.description then
p.w('Description="%s"', def.description)
end
end)
if suffix then
c = c .. suffix
end
p.outln(c)
end end
function m.boolProperty(def) function m.boolProperty(def)
p.push('<BoolProperty') p.push('<BoolProperty')
m.baseProperty(def) m.baseProperty(def)
if def.switch then p.w('Switch="%s" />', def.switch or "[value]")
p.w('Switch="%s" />', def.switch)
end
p.pop() p.pop()
end end
function m.enumProperty(def) function m.enumProperty(def)
p.push('<EnumProperty') p.push('<EnumProperty')
m.baseProperty(def, true) m.baseProperty(def, '>')
local values = def.values local values = def.values
local switches = def.switch or {} local switches = def.switch or {}
@ -173,7 +179,7 @@
function m.stringProperty(def) function m.stringProperty(def)
p.push('<StringProperty') p.push('<StringProperty')
m.baseProperty(def) m.baseProperty(def)
p.w('Switch="[value]" />') p.w('Switch="%s" />', def.switch or "[value]")
p.pop() p.pop()
end end
@ -181,10 +187,8 @@
function m.stringListProperty(def) function m.stringListProperty(def)
p.push('<StringListProperty') p.push('<StringListProperty')
m.baseProperty(def) m.baseProperty(def)
if def.separator then p.w('Separator="%s"', def.separator or " ")
p.w('Separator="%s"', def.separator) p.w('Switch="%s" />', def.switch or "[value]")
end
p.w('Switch="[value]" />')
p.pop() p.pop()
end end