dokuwiki

package module
v0.0.0-...-f3e2865 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2014 License: MIT Imports: 8 Imported by: 0

README

I write a lot of things in dokuwiki format, so it would be really nice to have a parser of mine.

Syntax Supported:

- in site link and out of site link(double squares)
- media files(double curly braces)
- basic text effect(bold, italic, underline, monospace.)
- sectioning(= indicates section, 4 dashes or more means a horizontal line.)
- List(2 space indentation, then * or - to represent unordered and ordered list.)
- nowiki tag
- code and file tag
- html and HTML tag(HTML stands for block level elements)

We only support UTF8 input.

- table is not supported now, but is on roadmap.
- quote is not supported now, but is on roadmap.
- namespaced internal links is not in the plan.
- php tag is not in the plan.
- Text Conversions is not in the plan.
- footnote is not in the plan.
- horizontal line is not in the plan.
= superscript and subscript are not supported.
- delete effect is not supported.
= Do not support \\
- For links, do not support namespace, linking to specific section, Interwiki link, windows share and image links.
- For media, only support image.

Documentation

Index

Constants

View Source
const (
	AlignLeft = iota
	AlignCenter
	AlignRight
)
View Source
const (
	TextEffectBold      = 1 << iota
	TextEffectItalic    = 1 << iota
	TextEffectUnderline = 1 << iota
	TextEffectMonoSpace = 1 << iota
)

Variables

This section is empty.

Functions

func Render

func Render(unit *ParseUnit, writer io.Writer)

Types

type BaseBlockContext

type BaseBlockContext struct {
	BaseContext
}

type BaseContext

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

func (BaseContext) GetParentContext

func (b BaseContext) GetParentContext() Context

func (BaseContext) SetParentContext

func (b BaseContext) SetParentContext(pContext Context)

type BaseInlineContext

type BaseInlineContext struct {
	BaseContext
}

type BlockContext

type BlockContext interface {
	Context
	// contains filtered or unexported methods
}

type CodeFileContext

type CodeFileContext struct {
	BaseInlineContext
	Text string
}

type Context

type Context interface {
	GetParentContext() Context
	SetParentContext(Context)
}

type HTMLContext

type HTMLContext struct {
	BaseInlineContext
	Text string
}

type HyperLinkContext

type HyperLinkContext struct {
	BaseInlineContext
	HyperLink  string
	Text       string
	IsInternal bool
}

Hyperlink text should not have effects.

type InlineContext

type InlineContext interface {
	Context
	// contains filtered or unexported methods
}

Inline Contexts

type ListContext

type ListContext struct {
	BaseBlockContext
	Level         int
	Ordered       bool
	InnerContexts []BlockContext
}

type MediaContext

type MediaContext struct {
	BaseInlineContext
	Width        int64
	Height       int64
	Align        int
	Title        string
	MediaResouce string
}

type NoWikiContext

type NoWikiContext struct {
	BaseInlineContext
	Text string
}

type ParaContext

type ParaContext struct {
	BaseBlockContext

	InnerContexts []InlineContext
	// contains filtered or unexported fields
}

ParaContext is a fake block context that is created to contain inline blocks.

type ParseUnit

type ParseUnit struct {
	BaseContext
	Title    string
	Sections []BlockContext
}

func Parse

func Parse(origContent []byte, title string) *ParseUnit

func ParseFile

func ParseFile(filename string) *ParseUnit

type SectionHeaderContext

type SectionHeaderContext struct {
	BaseBlockContext
	HeaderLevel int
	HeaderText  string
}

SectionHeader can have bold or other text effect in it, nor links. SectionHeader should be the beginning of a line, no whitespace before it.

type TextEffectContext

type TextEffectContext struct {
	BaseInlineContext
	EffectType uint32
	Text       string
}

Jump to

Keyboard shortcuts

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