Module: IsoDoc::Function::Form
- Included in:
- Common
- Defined in:
- lib/isodoc/function/form.rb
Instance Method Summary collapse
- #form_parse(node, out) ⇒ Object
- #input_parse(node, out) ⇒ Object
- #label_parse(node, out) ⇒ Object
- #option_parse(node, out) ⇒ Object
- #select_parse(node, out) ⇒ Object
- #text_input(out, length = 10) ⇒ Object
- #textarea_parse(_node, out) ⇒ Object
Instance Method Details
#form_parse(node, out) ⇒ Object
3 4 5 6 7 |
# File 'lib/isodoc/function/form.rb', line 3 def form_parse(node, out) node.children.each do |n| parse(n, out) end end |
#input_parse(node, out) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/isodoc/function/form.rb', line 9 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"]) end end |
#label_parse(node, out) ⇒ Object
34 35 36 37 38 |
# File 'lib/isodoc/function/form.rb', line 34 def label_parse(node, out) node.children.each do |n| parse(n, out) end end |
#option_parse(node, out) ⇒ Object
40 |
# File 'lib/isodoc/function/form.rb', line 40 def option_parse(node, out); end |
#select_parse(node, out) ⇒ Object
30 31 32 |
# File 'lib/isodoc/function/form.rb', line 30 def select_parse(node, out) text_input(out, node["size"] || 10) end |
#text_input(out, length = 10) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/isodoc/function/form.rb', line 22 def text_input(out, length = 10) length ||= 10 length = length.to_i length.zero? and length = 10 out << "_" * length out << " " end |
#textarea_parse(_node, out) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/isodoc/function/form.rb', line 42 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 |