ghtml

package
v2.8.0-beta Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 6 Imported by: 12

Documentation

Overview

Package ghtml provides useful API for HTML content handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Entities

func Entities(s string) string

Entities encodes all HTML chars for content. Referer: http://php.net/manual/zh/function.htmlentities.php

func EntitiesDecode

func EntitiesDecode(s string) string

EntitiesDecode decodes all HTML chars for content. Referer: http://php.net/manual/zh/function.html-entity-decode.php

func SpecialChars

func SpecialChars(s string) string

SpecialChars encodes some special chars for content, these special chars are: "&", "<", ">", `"`, "'". Referer: http://php.net/manual/zh/function.htmlspecialchars.php

func SpecialCharsDecode

func SpecialCharsDecode(s string) string

SpecialCharsDecode decodes some special chars for content, these special chars are: "&", "<", ">", `"`, "'". Referer: http://php.net/manual/zh/function.htmlspecialchars-decode.php

func SpecialCharsMapOrStruct

func SpecialCharsMapOrStruct(mapOrStruct interface{}) error

SpecialCharsMapOrStruct automatically encodes string values/attributes for map/struct.

Note that, if operation on struct, the given parameter `mapOrStruct` should be type of pointer to struct.

For example: var m = map{} var s = struct{}{} OK: SpecialCharsMapOrStruct(m) OK: SpecialCharsMapOrStruct(&s) Error: SpecialCharsMapOrStruct(s)

func StripTags

func StripTags(s string) string

StripTags strips HTML tags from content, and returns only text. Referer: http://php.net/manual/zh/function.strip-tags.php

Types

This section is empty.

Jump to

Keyboard shortcuts

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