Fix input fields getting escaped twice

This commit is contained in:
Zed 2019-11-26 05:45:05 +01:00
parent 2977972274
commit fba7ed2a19

View file

@ -62,15 +62,14 @@ proc genCheckbox*(pref, label: string; state: bool): VNode =
span(class="checkbox") span(class="checkbox")
proc genInput*(pref, label, state, placeholder: string; class=""): VNode = proc genInput*(pref, label, state, placeholder: string; class=""): VNode =
let s = xmltree.escape(state) let p = placeholder
let p = xmltree.escape(placeholder)
buildHtml(tdiv(class=("pref-group pref-input " & class))): buildHtml(tdiv(class=("pref-group pref-input " & class))):
if label.len > 0: if label.len > 0:
label(`for`=pref): text label label(`for`=pref): text label
if s.len == 0: if state.len == 0:
input(name=pref, `type`="text", placeholder=p, value=s, autofocus="") input(name=pref, `type`="text", placeholder=p, value=state, autofocus="")
else: else:
input(name=pref, `type`="text", placeholder=p, value=s) input(name=pref, `type`="text", placeholder=p, value=state)
proc genSelect*(pref, label, state: string; options: seq[string]): VNode = proc genSelect*(pref, label, state: string; options: seq[string]): VNode =
buildHtml(tdiv(class="pref-group pref-input")): buildHtml(tdiv(class="pref-group pref-input")):