No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
examples
extra
sh/specs
specs
src
.gitignore
LICENSE
README.md
shard.yml

README.md

da_html.cr

My personal Crystal shard to create sanitized HTML.

Quick Intro:

  require "da_html"
  DA_HTML.to_html {
    p {
      strong { "hello" }
    }
  }

Custom Tags:

  class My_Page

    include DA_HTML::Base

    def my_tag(*args)
      args.each { |x|
        # sanitize args
      }

      raw! "<my_tag"
      args.each { |x|
        attr! :some_key, x
      }
      raw! '>'

      text? {
        with self yield self
      }

      raw! "</my_tag>"
    end

  end # === class My_Page

  My_Page.to_html {
    my_tag { "some text" }
  }

Partials:

  class My_Partial
    include DA_HTML::Base
    def my_tag
      raw! "<my_tag></my_tag>"
    end
  end

  DA_HTML.to_html { |page|
    div { }
    My_Partial.partial(page) {
      my_tag
    }
  }