github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/htmlrender/dom/form.go (about)

     1  package dom
     2  
     3  type Name struct{ Value string }
     4  
     5  func (attr Name) Render(w Writer) { w.Attr("name", attr.Value) }
     6  
     7  type Method struct{ Value string }
     8  
     9  func (attr Method) Render(w Writer) { w.Attr("method", attr.Value) }
    10  
    11  type Form []Renderer
    12  
    13  func (el Form) Render(w Writer) {
    14  	el.RenderOpen(w)
    15  	el.RenderClose(w)
    16  }
    17  
    18  func (el Form) RenderOpen(w Writer) {
    19  	w.Open("form")
    20  	w.RenderAll(el...)
    21  }
    22  
    23  func (el Form) RenderClose(w Writer) {
    24  	w.Close("form")
    25  }