# frozen_string_literal: true module Redcarpet module Form module Extension module Block # A textarea block # # Ex: [textarea]{value="Hello world!" rows="4" cols="10"} Text box #
# # #
class Textarea def self.pattern /\[textarea\]([{][^}]*[}])?([^{}\]\[)]*)/ end def self.default_attributes { 'name' => Util.random_string, 'rows' => '3', 'value' => '' } end def self.html(matches) html = '
' matches.each do |item| label = item[1] attrs = default_attributes.merge!(Util.parse_attributes(item[0])) html += "" unless label.empty? html += "' end html += '
' end end end end end end