htmlutil

module
v0.0.0-...-6ff5fd0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2013 License: MIT

README

Build Status

htmlutil

Some HTML utilities for Go.

This repo provides two packages: checker and escaper. These are works in progress so far, and I intend to add more functions to each package as needed. Pull requests welcome.

checker

import "github.com/Dancapistan/htmlutil/checker"

GoDoc for package checker

This package provides a number of utility functions to verify that a given input conforms to the HTML 5 spec for a given role.

For example, the function checker.IsValidAttributeName returns true if the argument can be used as an HTML tag's attribute name, like "type" in <input type=email>:

name := "type"
ok := checker.IsValidAttributeName(name)
// ok == true

Please see the package's GoDoc page for a complete list of functions and fairly comprehensive examples.

escaper

import "github.com/Dancapistan/htmlutil/escaper"

GoDoc for package escaper

This package is more work-in-progress. It provides some functions for escaping arguments to be safe in particular HTML contexts.

For example, escaper.EscapeAttributeValueDoubleQuoted makes sure the argument is safe to use as an HTML attribute value when double quoted. In this case, if the argument contains a double quote character, that character is converted into a safe HTML entity.

GoDoc

Directories

Path Synopsis
Package checker provides some utility functions for checking the validity of HTML5 tags, attribute name, and attribute values.
Package checker provides some utility functions for checking the validity of HTML5 tags, attribute name, and attribute values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL