module IsoDoc::Function::Form

Public Instance Methods

form_parse(node, out) click to toggle source
# File lib/isodoc/function/form.rb, line 4
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
input_parse(node, out) click to toggle source
# File lib/isodoc/function/form.rb, line 13
def input_parse(node, out)
  case node["type"]
  when "button" then out << "[#{node['value'] || 'BUTTON'}]"
  when "checkbox" then out << "&#x2610; "
  when "date", "file", "password" then text_input(out)
  when "radio" then out << "&#x25CE; "
  when "submit" # nop
  when "text" then text_input(out, node["maxlength"])
  end
end
label_parse(node, out) click to toggle source
# File lib/isodoc/function/form.rb, line 36
def label_parse(node, out)
  node.children.each do |n|
    parse(n, out)
  end
end
option_parse(node, out) click to toggle source
# File lib/isodoc/function/form.rb, line 42
def option_parse(node, out); end
select_parse(node, out) click to toggle source
# File lib/isodoc/function/form.rb, line 32
def select_parse(node, out)
  text_input(out, node["size"] || 10)
end
text_input(out, length = 10) click to toggle source
# File lib/isodoc/function/form.rb, line 24
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) click to toggle source
# File lib/isodoc/function/form.rb, line 44
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