bbcode

package
v0.0.0-...-94da09f Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2014 License: BSD-2-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBbToken

func AddBbToken(name string, htmlTags HtmlTags)

One can insert use-case specific BBCode tags by using this function.

IMPORTANT: This is ignored by parser.Parse - you should use AddTokenClass instead! Only use this function if you plan on using parser.BbCodeParse()!

This will be deprecated in the future after BBCode functionality is added to AddMatcher.

func Parse

func Parse(body string) (string, error)

Parse parses BBCode only. Although not used by the main Parse method, it is included in case parsing only BBCode is desired. Note that this function completely ignores MoeTags.

Types

type HtmlTags

type HtmlTags struct {
	Options      int                   // Compatibility options for BBCode until token parsing is complete
	Tags         []string              // HTML tags
	Classes      [][]string            // Classes to give to the HTML elements
	Attributes   []map[int8]string     // HTML tag attributes
	CssProps     []map[int8]string     // CSS Properties
	OutputFunc   func([]string) string // A custom output function; this returns the string to emplace into the HTML.
	InputModFunc func(*[]string)       // A function that takes input and returns input modified (an example use case would be converting a username to a user ID in @tagging)
}

A type that determines what the parser will replace tags it finds with. The Attributes and CssProps are maps that assign a regexp parser group

Jump to

Keyboard shortcuts

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