Sha256: 362b02242fab76d42ff7d52476639fe5c92808bc48edaa07ceb794199f8212fe
Contents?: true
Size: 1.88 KB
Versions: 20
Compression:
Stored size: 1.88 KB
Contents
module Asciidoctor module Standoc class FormInputMacro < Asciidoctor::Extensions::InlineMacroProcessor use_dsl named :input def process(_parent, target, attr) m = %w(id name value disabled readonly checked maxlength minlength) .map { |a| attr[a] ? " #{a}='#{attr[a]}'" : nil }.compact %{<input type='#{target}' #{m.join}/>} end end class FormLabelMacro < Asciidoctor::Extensions::InlineMacroProcessor use_dsl named :label parse_content_as :text def process(parent, target, attr) out = Asciidoctor::Inline.new(parent, :quoted, attr["text"]).convert %{<label for="#{target}">#{out}</label>} end end class FormTextareaMacro < Asciidoctor::Extensions::InlineMacroProcessor use_dsl named :textarea using_format :short def process(_parent, _target, attr) m = %w(id name rows cols value) .map { |a| attr[a] ? " #{a}='#{attr[a]}'" : nil }.compact %{<textarea #{m.join}/>} end end class FormSelectMacro < Asciidoctor::Extensions::InlineMacroProcessor use_dsl named :select using_format :short def process(parent, _target, attr) m = %w(id name size disabled multiple value) .map { |a| attr[a] ? " #{a}='#{attr[a]}'" : nil }.compact out = Asciidoctor::Inline.new(parent, :quoted, attr["text"]).convert %{<select #{m.join}>#{out}</select>} end end class FormOptionMacro < Asciidoctor::Extensions::InlineMacroProcessor use_dsl named :option using_format :short def process(parent, _target, attr) m = %w(disabled value) .map { |a| attr[a] ? " #{a}='#{attr[a]}'" : nil }.compact out = Asciidoctor::Inline.new(parent, :quoted, attr["text"]).convert %{<option #{m.join}">#{out}</option>} end end end end
Version data entries
20 entries across 20 versions & 1 rubygems