lib/isodoc/function/form.rb in isodoc-1.7.0 vs lib/isodoc/function/form.rb in isodoc-1.7.1
- old
+ new
@@ -1,49 +1,52 @@
-module IsoDoc::Function
- module Form
- def form_parse(node, out)
- node.children.each do |n|
- parse(n, out)
+module IsoDoc
+ module Function
+ module Form
+ def form_parse(node, out)
+ out.div **attr_code(class: node["class"],
+ id: node["id"]) do |div|
+ node.children.each do |n|
+ parse(n, div)
+ end
+ end
end
- end
- def input_parse(node, out)
- case node["type"]
- when "button" then out << "[#{node['value'] || 'BUTTON'}]"
- when "checkbox" then out << "☐ "
- when "date" then text_input(out)
- when "file" then text_input(out)
- when "password" then text_input(out)
- when "radio" then out << "◎ "
- when "submit" # nop
- when "text" then text_input(out, node["maxlength"])
+ def input_parse(node, out)
+ case node["type"]
+ when "button" then out << "[#{node['value'] || 'BUTTON'}]"
+ when "checkbox" then out << "☐ "
+ when "date", "file", "password" then text_input(out)
+ when "radio" then out << "◎ "
+ when "submit" # nop
+ when "text" then text_input(out, node["maxlength"])
+ end
end
- end
- def text_input(out, length = 10)
- length ||= 10
- length = length.to_i
- length.zero? and length = 10
- out << "_" * length
- out << " "
- end
+ def text_input(out, length = 10)
+ length ||= 10
+ length = length.to_i
+ length.zero? and length = 10
+ out << "_" * length
+ out << " "
+ end
- def select_parse(node, out)
- text_input(out, node["size"] || 10)
- end
+ def select_parse(node, out)
+ text_input(out, node["size"] || 10)
+ end
- def label_parse(node, out)
- node.children.each do |n|
- parse(n, out)
+ def label_parse(node, out)
+ node.children.each do |n|
+ parse(n, out)
+ end
end
- end
- def option_parse(node, out); end
+ def option_parse(node, out); end
- def textarea_parse(_node, out)
- out.table **{ border: 1, width: "50%" } do |t|
- t.tr do |tr|
- tr.td do |td|
+ def textarea_parse(_node, out)
+ out.table **{ border: 1, width: "50%" } do |t|
+ t.tr do |tr|
+ tr.td do |td|
+ end
end
end
end
end
end