Search results

There are no results.

builder.html.Builder

Builder

A type providing methods for building an HTML document.

Required methods

nodes_mut

Show source code
Hide source code
fn pub mut nodes_mut -> mut Array[Node]
fn pub mut nodes_mut -> mut Array[Node]

Returns a mutable reference to the nodes of self.

Default methods

a

Show source code
Hide source code
fn pub mut a -> mut Element {
  element('a').inline
}
fn pub mut a -> mut Element

Adds a <a> element as a child element.

abbr

Show source code
Hide source code
fn pub mut abbr -> mut Element {
  element('abbr').inline
}
fn pub mut abbr -> mut Element

Adds a <abbr> element as a child element.

add

Show source code
Hide source code
fn pub mut add(element: Element) {
  nodes_mut.push(Node.Element(element))
}
fn pub mut add(element: Element)

Adds the child Element to self.

Examples

import builder.html.Element

Element.new('p').add(Element.new('span'))

address

Show source code
Hide source code
fn pub mut address -> mut Element {
  element('address').inline
}
fn pub mut address -> mut Element

Adds a <address> element as a child element.

append

Show source code
Hide source code
fn pub mut append(document: Document) {
  match document {
    case { @nodes = n } -> nodes_mut.append(n)
  }
}
fn pub mut append(document: Document)

Adds the nodes of the given Document to self.

Examples

import builder.html.(Document, Element)

let doc1 = Document.fragment
let doc2 = Document.fragment

doc1.p.text('test')
doc2.div.append(doc1)
doc2.to_string # => '<div><p>test</p></div>'

area

Show source code
Hide source code
fn pub mut area -> mut Element {
  element('area').self_closing.inline
}
fn pub mut area -> mut Element

Adds a <area> element as a child element.

article

Show source code
Hide source code
fn pub mut article -> mut Element {
  element('article')
}
fn pub mut article -> mut Element

Adds a <article> element as a child element.

aside

Show source code
Hide source code
fn pub mut aside -> mut Element {
  element('aside')
}
fn pub mut aside -> mut Element

Adds a <aside> element as a child element.

audio

Show source code
Hide source code
fn pub mut audio -> mut Element {
  element('audio').inline
}
fn pub mut audio -> mut Element

Adds a <audio> element as a child element.

b

Show source code
Hide source code
fn pub mut b -> mut Element {
  element('b').inline
}
fn pub mut b -> mut Element

Adds a <b> element as a child element.

base

Show source code
Hide source code
fn pub mut base -> mut Element {
  element('base').self_closing
}
fn pub mut base -> mut Element

Adds a <base> element as a child element.

bdi

Show source code
Hide source code
fn pub mut bdi -> mut Element {
  element('bdi')
}
fn pub mut bdi -> mut Element

Adds a <bdi> element as a child element.

bdo

Show source code
Hide source code
fn pub mut bdo -> mut Element {
  element('bdo')
}
fn pub mut bdo -> mut Element

Adds a <bdo> element as a child element.

blockquote

Show source code
Hide source code
fn pub mut blockquote -> mut Element {
  element('blockquote')
}
fn pub mut blockquote -> mut Element

Adds a <blockquote> element as a child element.

body

Show source code
Hide source code
fn pub mut body -> mut Element {
  element('body')
}
fn pub mut body -> mut Element

Adds a <body> element as a child element.

br

Show source code
Hide source code
fn pub mut br -> mut Element {
  element('br').self_closing
}
fn pub mut br -> mut Element

Adds a <br> element as a child element.

button

Show source code
Hide source code
fn pub mut button -> mut Element {
  element('button')
}
fn pub mut button -> mut Element

Adds a <button> element as a child element.

canvas

Show source code
Hide source code
fn pub mut canvas -> mut Element {
  element('canvas')
}
fn pub mut canvas -> mut Element

Adds a <canvas> element as a child element.

caption

Show source code
Hide source code
fn pub mut caption -> mut Element {
  element('caption')
}
fn pub mut caption -> mut Element

Adds a <caption> element as a child element.

cite

Show source code
Hide source code
fn pub mut cite -> mut Element {
  element('cite').inline
}
fn pub mut cite -> mut Element

Adds a <cite> element as a child element.

code

Show source code
Hide source code
fn pub mut code -> mut Element {
  element('code').inline
}
fn pub mut code -> mut Element

Adds a <code> element as a child element.

col

Show source code
Hide source code
fn pub mut col -> mut Element {
  element('col').self_closing
}
fn pub mut col -> mut Element

Adds a <col> element as a child element.

colgroup

Show source code
Hide source code
fn pub mut colgroup -> mut Element {
  element('colgroup')
}
fn pub mut colgroup -> mut Element

Adds a <colgroup> element as a child element.

data

Show source code
Hide source code
fn pub mut data -> mut Element {
  element('data')
}
fn pub mut data -> mut Element

Adds a <data> element as a child element.

datalist

Show source code
Hide source code
fn pub mut datalist -> mut Element {
  element('datalist')
}
fn pub mut datalist -> mut Element

Adds a <datalist> element as a child element.

dd

Show source code
Hide source code
fn pub mut dd -> mut Element {
  element('dd')
}
fn pub mut dd -> mut Element

Adds a <dd> element as a child element.

del

Show source code
Hide source code
fn pub mut del -> mut Element {
  element('del').inline
}
fn pub mut del -> mut Element

Adds a <del> element as a child element.

details

Show source code
Hide source code
fn pub mut details -> mut Element {
  element('details')
}
fn pub mut details -> mut Element

Adds a <details> element as a child element.

dfn

Show source code
Hide source code
fn pub mut dfn -> mut Element {
  element('dfn').inline
}
fn pub mut dfn -> mut Element

Adds a <dfn> element as a child element.

dialog

Show source code
Hide source code
fn pub mut dialog -> mut Element {
  element('dialog')
}
fn pub mut dialog -> mut Element

Adds a <dialog> element as a child element.

div

Show source code
Hide source code
fn pub mut div -> mut Element {
  element('div')
}
fn pub mut div -> mut Element

Adds a <div> element as a child element.

dl

Show source code
Hide source code
fn pub mut dl -> mut Element {
  element('dl')
}
fn pub mut dl -> mut Element

Adds a <dl> element as a child element.

dt

Show source code
Hide source code
fn pub mut dt -> mut Element {
  element('dt')
}
fn pub mut dt -> mut Element

Adds a <dt> element as a child element.

element

Show source code
Hide source code
fn pub mut element(name: String) -> mut Element {
  let el = Element.new(name)
  let ret = mut el

  add(el)
  ret
}
fn pub mut element(name: String) -> mut Element

Adds an element with the given name as a cild of self.

em

Show source code
Hide source code
fn pub mut em -> mut Element {
  element('em').inline
}
fn pub mut em -> mut Element

Adds a <em> element as a child element.

embed

Show source code
Hide source code
fn pub mut embed -> mut Element {
  element('embed').self_closing
}
fn pub mut embed -> mut Element

Adds a <embed> element as a child element.

fieldset

Show source code
Hide source code
fn pub mut fieldset -> mut Element {
  element('fieldset')
}
fn pub mut fieldset -> mut Element

Adds a <fieldset> element as a child element.

figcaption

Show source code
Hide source code
fn pub mut figcaption -> mut Element {
  element('figcaption')
}
fn pub mut figcaption -> mut Element

Adds a <figcaption> element as a child element.

figure

Show source code
Hide source code
fn pub mut figure -> mut Element {
  element('figure')
}
fn pub mut figure -> mut Element

Adds a <figure> element as a child element.

footer

Show source code
Hide source code
fn pub mut footer -> mut Element {
  element('footer')
}
fn pub mut footer -> mut Element

Adds a <footer> element as a child element.

form

Show source code
Hide source code
fn pub mut form -> mut Element {
  element('form')
}
fn pub mut form -> mut Element

Adds a <form> element as a child element.

h1

Show source code
Hide source code
fn pub mut h1 -> mut Element {
  element('h1')
}
fn pub mut h1 -> mut Element

Adds a <h1> element as a child element.

h2

Show source code
Hide source code
fn pub mut h2 -> mut Element {
  element('h2')
}
fn pub mut h2 -> mut Element

Adds a <h2> element as a child element.

h3

Show source code
Hide source code
fn pub mut h3 -> mut Element {
  element('h3')
}
fn pub mut h3 -> mut Element

Adds a <h3> element as a child element.

h4

Show source code
Hide source code
fn pub mut h4 -> mut Element {
  element('h4')
}
fn pub mut h4 -> mut Element

Adds a <h4> element as a child element.

h5

Show source code
Hide source code
fn pub mut h5 -> mut Element {
  element('h5')
}
fn pub mut h5 -> mut Element

Adds a <h5> element as a child element.

h6

Show source code
Hide source code
fn pub mut h6 -> mut Element {
  element('h6')
}
fn pub mut h6 -> mut Element

Adds a <h6> element as a child element.

head

Show source code
Hide source code
fn pub mut head -> mut Element {
  element('head')
}
fn pub mut head -> mut Element

Adds a <head> element as a child element.

header

Show source code
Hide source code
fn pub mut header -> mut Element {
  element('header')
}
fn pub mut header -> mut Element

Adds a <header> element as a child element.

hgroup

Show source code
Hide source code
fn pub mut hgroup -> mut Element {
  element('hgroup')
}
fn pub mut hgroup -> mut Element

Adds a <hgroup> element as a child element.

hr

Show source code
Hide source code
fn pub mut hr -> mut Element {
  element('hr').self_closing
}
fn pub mut hr -> mut Element

Adds a <hr> element as a child element.

i

Show source code
Hide source code
fn pub mut i -> mut Element {
  element('i').inline
}
fn pub mut i -> mut Element

Adds a <i> element as a child element.

iframe

Show source code
Hide source code
fn pub mut iframe -> mut Element {
  element('iframe')
}
fn pub mut iframe -> mut Element

Adds a <iframe> element as a child element.

img

Show source code
Hide source code
fn pub mut img -> mut Element {
  element('img').self_closing.inline
}
fn pub mut img -> mut Element

Adds a <img> element as a child element.

input

Show source code
Hide source code
fn pub mut input -> mut Element {
  element('input').self_closing
}
fn pub mut input -> mut Element

Adds a <input> element as a child element.

ins

Show source code
Hide source code
fn pub mut ins -> mut Element {
  element('ins').inline
}
fn pub mut ins -> mut Element

Adds a <ins> element as a child element.

kbd

Show source code
Hide source code
fn pub mut kbd -> mut Element {
  element('kbd').inline
}
fn pub mut kbd -> mut Element

Adds a <kbd> element as a child element.

label

Show source code
Hide source code
fn pub mut label -> mut Element {
  element('label')
}
fn pub mut label -> mut Element

Adds a <label> element as a child element.

legend

Show source code
Hide source code
fn pub mut legend -> mut Element {
  element('legend').inline
}
fn pub mut legend -> mut Element

Adds a <legend> element as a child element.

li

Show source code
Hide source code
fn pub mut li -> mut Element {
  element('li')
}
fn pub mut li -> mut Element

Adds a <li> element as a child element.

Show source code
Hide source code
fn pub mut link -> mut Element {
  element('link').self_closing
}
fn pub mut link -> mut Element

Adds a <link> element as a child element.

main

Show source code
Hide source code
fn pub mut main -> mut Element {
  element('main')
}
fn pub mut main -> mut Element

Adds a <main> element as a child element.

map

Show source code
Hide source code
fn pub mut map -> mut Element {
  element('map')
}
fn pub mut map -> mut Element

Adds a <map> element as a child element.

mark

Show source code
Hide source code
fn pub mut mark -> mut Element {
  element('mark').inline
}
fn pub mut mark -> mut Element

Adds a <mark> element as a child element.

menu

Show source code
Hide source code
fn pub mut menu -> mut Element {
  element('menu')
}
fn pub mut menu -> mut Element

Adds a <menu> element as a child element.

meta

Show source code
Hide source code
fn pub mut meta -> mut Element {
  element('meta').self_closing
}
fn pub mut meta -> mut Element

Adds a <meta> element as a child element.

meter

Show source code
Hide source code
fn pub mut meter -> mut Element {
  element('meter').inline
}
fn pub mut meter -> mut Element

Adds a <meter> element as a child element.

nav

Show source code
Hide source code
fn pub mut nav -> mut Element {
  element('nav')
}
fn pub mut nav -> mut Element

Adds a <nav> element as a child element.

noscript

Show source code
Hide source code
fn pub mut noscript -> mut Element {
  element('noscript')
}
fn pub mut noscript -> mut Element

Adds a <noscript> element as a child element.

object

Show source code
Hide source code
fn pub mut object -> mut Element {
  element('object')
}
fn pub mut object -> mut Element

Adds a <object> element as a child element.

ol

Show source code
Hide source code
fn pub mut ol -> mut Element {
  element('ol')
}
fn pub mut ol -> mut Element

Adds a <ol> element as a child element.

optgroup

Show source code
Hide source code
fn pub mut optgroup -> mut Element {
  element('optgroup')
}
fn pub mut optgroup -> mut Element

Adds a <optgroup> element as a child element.

option

Show source code
Hide source code
fn pub mut option -> mut Element {
  element('option')
}
fn pub mut option -> mut Element

Adds a <option> element as a child element.

output

Show source code
Hide source code
fn pub mut output -> mut Element {
  element('output')
}
fn pub mut output -> mut Element

Adds a <output> element as a child element.

p

Show source code
Hide source code
fn pub mut p -> mut Element {
  element('p')
}
fn pub mut p -> mut Element

Adds a <p> element as a child element.

picture

Show source code
Hide source code
fn pub mut picture -> mut Element {
  element('picture')
}
fn pub mut picture -> mut Element

Adds a <picture> element as a child element.

portal

Show source code
Hide source code
fn pub mut portal -> mut Element {
  element('portal')
}
fn pub mut portal -> mut Element

Adds a <portal> element as a child element.

pre

Show source code
Hide source code
fn pub mut pre -> mut Element {
  element('pre')
}
fn pub mut pre -> mut Element

Adds a <pre> element as a child element.

progress

Show source code
Hide source code
fn pub mut progress -> mut Element {
  element('progress')
}
fn pub mut progress -> mut Element

Adds a <progress> element as a child element.

q

Show source code
Hide source code
fn pub mut q -> mut Element {
  element('q').inline
}
fn pub mut q -> mut Element

Adds a <q> element as a child element.

rp

Show source code
Hide source code
fn pub mut rp -> mut Element {
  element('rp')
}
fn pub mut rp -> mut Element

Adds a <rp> element as a child element.

rt

Show source code
Hide source code
fn pub mut rt -> mut Element {
  element('rt')
}
fn pub mut rt -> mut Element

Adds a <rt> element as a child element.

ruby

Show source code
Hide source code
fn pub mut ruby -> mut Element {
  element('ruby')
}
fn pub mut ruby -> mut Element

Adds a <ruby> element as a child element.

s

Show source code
Hide source code
fn pub mut s -> mut Element {
  element('s')
}
fn pub mut s -> mut Element

Adds a <s> element as a child element.

samp

Show source code
Hide source code
fn pub mut samp -> mut Element {
  element('samp')
}
fn pub mut samp -> mut Element

Adds a <samp> element as a child element.

script

Show source code
Hide source code
fn pub mut script -> mut Element {
  element('script')
}
fn pub mut script -> mut Element

Adds a <script> element as a child element.

search

Show source code
Hide source code
fn pub mut search -> mut Element {
  element('search')
}
fn pub mut search -> mut Element

Adds a <search> element as a child element.

section

Show source code
Hide source code
fn pub mut section -> mut Element {
  element('section')
}
fn pub mut section -> mut Element

Adds a <section> element as a child element.

select

Show source code
Hide source code
fn pub mut select -> mut Element {
  element('select')
}
fn pub mut select -> mut Element

Adds a <select> element as a child element.

slot

Show source code
Hide source code
fn pub mut slot -> mut Element {
  element('slot')
}
fn pub mut slot -> mut Element

Adds a <slot> element as a child element.

small

Show source code
Hide source code
fn pub mut small -> mut Element {
  element('small').inline
}
fn pub mut small -> mut Element

Adds a <small> element as a child element.

source

Show source code
Hide source code
fn pub mut source -> mut Element {
  element('source').self_closing.inline
}
fn pub mut source -> mut Element

Adds a <source> element as a child element.

span

Show source code
Hide source code
fn pub mut span -> mut Element {
  element('span').inline
}
fn pub mut span -> mut Element

Adds a <span> element as a child element.

strong

Show source code
Hide source code
fn pub mut strong -> mut Element {
  element('strong').inline
}
fn pub mut strong -> mut Element

Adds a <strong> element as a child element.

style

Show source code
Hide source code
fn pub mut style -> mut Element {
  element('style')
}
fn pub mut style -> mut Element

Adds a <style> element as a child element.

sub

Show source code
Hide source code
fn pub mut sub -> mut Element {
  element('sub').inline
}
fn pub mut sub -> mut Element

Adds a <sub> element as a child element.

summary

Show source code
Hide source code
fn pub mut summary -> mut Element {
  element('summary').inline
}
fn pub mut summary -> mut Element

Adds a <summary> element as a child element.

sup

Show source code
Hide source code
fn pub mut sup -> mut Element {
  element('sup').inline
}
fn pub mut sup -> mut Element

Adds a <sup> element as a child element.

table

Show source code
Hide source code
fn pub mut table -> mut Element {
  element('table')
}
fn pub mut table -> mut Element

Adds a <table> element as a child element.

tbody

Show source code
Hide source code
fn pub mut tbody -> mut Element {
  element('tbody')
}
fn pub mut tbody -> mut Element

Adds a <tbody> element as a child element.

td

Show source code
Hide source code
fn pub mut td -> mut Element {
  element('td')
}
fn pub mut td -> mut Element

Adds a <td> element as a child element.

template

Show source code
Hide source code
fn pub mut template -> mut Element {
  element('template')
}
fn pub mut template -> mut Element

Adds a <template> element as a child element.

text

Show source code
Hide source code
fn pub mut text(text: String) {
  nodes_mut.push(Node.Text(text))
}
fn pub mut text(text: String)

Adds a text node to this element.

Examples

import builder.html.Element

Element.new('p').text('Hello!')

textarea

Show source code
Hide source code
fn pub mut textarea -> mut Element {
  element('textarea')
}
fn pub mut textarea -> mut Element

Adds a <textarea> element as a child element.

tfoot

Show source code
Hide source code
fn pub mut tfoot -> mut Element {
  element('tfoot')
}
fn pub mut tfoot -> mut Element

Adds a <tfoot> element as a child element.

th

Show source code
Hide source code
fn pub mut th -> mut Element {
  element('th')
}
fn pub mut th -> mut Element

Adds a <th> element as a child element.

thead

Show source code
Hide source code
fn pub mut thead -> mut Element {
  element('thead')
}
fn pub mut thead -> mut Element

Adds a <thead> element as a child element.

time

Show source code
Hide source code
fn pub mut time -> mut Element {
  element('time').inline
}
fn pub mut time -> mut Element

Adds a <time> element as a child element.

title

Show source code
Hide source code
fn pub mut title -> mut Element {
  element('title')
}
fn pub mut title -> mut Element

Adds a <title> element as a child element.

tr

Show source code
Hide source code
fn pub mut tr -> mut Element {
  element('tr')
}
fn pub mut tr -> mut Element

Adds a <tr> element as a child element.

track

Show source code
Hide source code
fn pub mut track -> mut Element {
  element('track').self_closing
}
fn pub mut track -> mut Element

Adds a <track> element as a child element.

u

Show source code
Hide source code
fn pub mut u -> mut Element {
  element('u')
}
fn pub mut u -> mut Element

Adds a <u> element as a child element.

ul

Show source code
Hide source code
fn pub mut ul -> mut Element {
  element('ul')
}
fn pub mut ul -> mut Element

Adds a <ul> element as a child element.

var

Show source code
Hide source code
fn pub mut var -> mut Element {
  element('var').inline
}
fn pub mut var -> mut Element

Adds a <var> element as a child element.

video

Show source code
Hide source code
fn pub mut video -> mut Element {
  element('video')
}
fn pub mut video -> mut Element

Adds a <video> element as a child element.

wbr

Show source code
Hide source code
fn pub mut wbr -> mut Element {
  element('wbr').self_closing
}
fn pub mut wbr -> mut Element

Adds a <wbr> element as a child element.

xmp

Show source code
Hide source code
fn pub mut xmp -> mut Element {
  element('xmp')
}
fn pub mut xmp -> mut Element

Adds a <xmp> element as a child element.

xperimental

Show source code
Hide source code
fn pub mut xperimental -> mut Element {
  element('xperimental')
}
fn pub mut xperimental -> mut Element

Adds a <xperimental> element as a child element.

Implementations

builder.html.

Document

impl Builder for Document
builder.html.

Element

impl Builder for Element