mparser

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: 18 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

Extensions is the default set of extensions mmark requires.

View Source
var UnsafeInclude parser.Flags = 1 << 3

Functions

func AddBibliography

func AddBibliography(doc ast.Node) bool

AddBibliography adds the bibliography to the document. It will be added just after the backmatter node. If that node can't be found this function returns false and does nothing.

func AddIndex

func AddIndex(doc ast.Node) bool

AddIndex adds an index to the end of the current document. If not indices can be found this returns false and no index will be added.

func CitationToBibliography

func CitationToBibliography(doc ast.Node) (normative ast.Node, informative ast.Node)

CitationToBibliography walks the AST and gets all the citations on HTML blocks and groups them into normative and informative references.

func Hook

func Hook(data []byte) (ast.Node, []byte, int)

Hook will call both TitleHook and ReferenceHook.

func IndexToDocumentIndex

func IndexToDocumentIndex(doc ast.Node) *mast.DocumentIndex

IndexToDocumentIndex crawls the entire doc searching for indices, it will then return an mast.DocumentIndex that contains a tree:

IndexLetter - IndexItem

  • IndexLink
  • IndexSubItem
  • IndexLink
  • IndexLink

Which can then be rendered by the renderer.

func IsReference

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

IfReference returns wether data contains a reference.

func NodeBackMatter added in v1.9.95

func NodeBackMatter(doc ast.Node) ast.Node

NodeBackMatter is the place where we should inject the bibliography

func ReferenceHook

func ReferenceHook(data []byte) (ast.Node, []byte, int)

ReferenceHook is the hook used to parse reference nodes.

func SkipUntilChar

func SkipUntilChar(data []byte, i int, c byte) int

func TitleHook

func TitleHook(data []byte) (ast.Node, []byte, int)

TitleHook will parse a title and returns it. The start and ending can be signalled with %%% or --- (the later to more inline with Hugo and other markdown dialects.

Types

type Initial

type Initial struct {
	Flags parser.Flags
	// contains filtered or unexported fields
}

Initial is the initial file we are working on, empty for stdin and adjusted is we we have an absolute or relative file.

func NewInitial

func NewInitial(s string) Initial

NewInitial returns an initialized Initial.

func (Initial) ReadInclude

func (i Initial) ReadInclude(from, file string, address []byte) []byte

ReadInclude is the hook to read includes. Its supports the following options for address.

4,5 - line numbers separated by commas N, - line numbers, end not specified, read until the end. /start/,/end/ - regexp separated by commas optional a prefix="" string.

Jump to

Keyboard shortcuts

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