xml

package
v2.0.40+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: BSD-2-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const Generator = `<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.nl" -->`

Variables

View Source
var (
	ToolsRFC = "https://xml2rfc.ietf.org/public/rfc/bibxml"
	ToolsID  = "https://xml2rfc.ietf.org/public/rfc/bibxml-ids"
	ToolsW3C = "https://xml2rfc.ietf.org/public/rfc/bibxml-w3c"
)
View Source
var StatusToCategory = map[string]string{
	"standard":      "std",
	"informational": "info",
	"experimental":  "exp",
	"bcp":           "bcp",
	"fyi":           "fyi",
	"full-standard": "std",
}

StatusToCategory translate the status to a category.

Functions

func Attributes

func Attributes(keys, values []string) (s []string)

Attributes returns the key values in a stringslice where each is type set as key="value".

func AttributesContains

func AttributesContains(key string, attr []string) bool

AttributesContains checks if the attribute list contains key.

func EscapeHTMLCallouts

func EscapeHTMLCallouts(w io.Writer, d []byte, comments [][]byte)

EscapeHTMLCallouts writes html-escaped d to w. It escapes &, <, > and " characters, *but* expands callouts <<N>> with the callout HTML, i.e. by calling rendering it as <N>.

func EscapeHTMLString

func EscapeHTMLString(s string) string

EscapeHTMLString escapes the string s.

func IntSliceToString

func IntSliceToString(is []int) string

IntSliceToString converts and int slice to a string.

func Is2119

func Is2119(word []byte) bool

Is2119 checks if word is a RFC 2119 word.

func IsAbstract

func IsAbstract(word []byte) bool

IsAbstract returns if word is equal to abstract.

func IsComment

func IsComment(data []byte) ([]byte, bool)

Iscomment detects if a html span is a comment: <!--SPACE .... SPACE--!>. Return the comment text and true is so.

Types

type Flags

type Flags int

Flags control optional behavior of XML3 renderer.

const (
	FlagsNone   Flags = 0
	XMLFragment Flags = 1 << iota // Don't generate a complete XML document
	SkipHTML                      // Skip preformatted HTML blocks - skips comments
	SkipImages                    // Skip embedded images

	CommonFlags Flags = FlagsNone
)

HTML renderer configuration options.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer implements Renderer interface for IETF XMLv3 output. See RFC 7991.

func NewRenderer

func NewRenderer(opts RendererOptions) *Renderer

NewRenderer creates and configures an Renderer object, which satisfies the Renderer interface.

func (*Renderer) RenderFooter

func (r *Renderer) RenderFooter(w io.Writer, _ ast.Node)

RenderFooter writes HTML document footer.

func (*Renderer) RenderHeader

func (r *Renderer) RenderHeader(w io.Writer, ast ast.Node)

RenderHeader writes HTML document preamble and TOC if requested.

func (*Renderer) RenderNode

func (r *Renderer) RenderNode(w io.Writer, node ast.Node, entering bool) ast.WalkStatus

RenderNode renders a markdown node to XML.

func (*Renderer) TitleAuthor

func (r *Renderer) TitleAuthor(w io.Writer, a mast.Author)

TitleAuthor outputs the author.

func (*Renderer) TitleDate

func (r *Renderer) TitleDate(w io.Writer, d time.Time)

TitleDate outputs the date from the TOML title block.

func (*Renderer) TitleKeyword

func (r *Renderer) TitleKeyword(w io.Writer, keyword []string)

TitleKeyword outputs the keywords from the TOML title block.

type RendererOptions

type RendererOptions struct {
	// Callouts are supported and detected by setting this option to the callout prefix.
	Callout string

	Flags Flags // Flags allow customizing this renderer's behavior

	// if set, called at the start of RenderNode(). Allows replacing
	// rendering of some nodes
	RenderNodeHook html.RenderNodeFunc

	// Comments is a list of comments the renderer should detect when
	// parsing code blocks and detecting callouts.
	Comments [][]byte

	// Generator is a comment that is inserted in the generated XML to show what rendered it.
	Generator string
}

RendererOptions is a collection of supplementary parameters tweaking the behavior of various parts of XML renderer.

Jump to

Keyboard shortcuts

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