// Copyright 2015 The Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
import (
"bytes"
"fmt"
)
func ExampleEscapeString() {
fmt.Println(EscapeString(`Google Search`))
// Output:
// <a href="https://www.google.com/search?q=something&ie=utf-8">Google Search</a>
}
func ExampleWriteEscapedString() {
var buf bytes.Buffer
WriteEscapedString(&buf, `Google Search`)
fmt.Println(buf.String())
// Output:
// <a href="https://www.google.com/search?q=something&ie=utf-8">Google Search</a>
}
func ExampleParseEntity() {
fmt.Println(ParseEntity("""))
fmt.Println(ParseEntity("""))
fmt.Println(ParseEntity("""))
fmt.Println(ParseEntity("""))
fmt.Println(ParseEntity("""))
fmt.Println(ParseEntity("""))
fmt.Println(ParseEntity("""))
fmt.Println(ParseEntity(""))
// Output:
// " 6
// " 6
// " 5
// " 12
// " 11
// 0
// 0
// � 11
}
func ExampleUnescapeString() {
fmt.Println(UnescapeString(" & © Æ Ď ¾ ℋ ⅆ ∲ # Ӓ Ϡ " ആ ಫ   &x; &ThisIsWayTooLongToBeAnEntityIsntIt; &hi?; © &MadeUpEntity;"))
// Output:
// & © Æ Ď ¾ ℋ ⅆ ∲ # Ӓ Ϡ � " ആ ಫ   &x; &ThisIsWayTooLongToBeAnEntityIsntIt; &hi?; © &MadeUpEntity;
}