blocks

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package blocks provides some of the Mycomarkup's blocks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LinkParts

func LinkParts(addr, display, hyphaName string) (href, text, class string)

LinkParts determines what href, text and class should resulting <a> have based on mycomarkup's addr, display and hypha name.

=> addr display [[addr|display]] TODO: deprecate

func MatchesImg

func MatchesImg(line string) bool

func MatchesList

func MatchesList(line string) bool

func MatchesTable

func MatchesTable(line string) bool

func ParagraphToHtml

func ParagraphToHtml(hyphaName, input string) string
func Rocketlink(src, hyphaName string) (href, text, class string)

Parse markup line starting with "=>" according to wikilink rules. See http://localhost:1737/page/wikilink

Types

type Block

type Block interface {
	// String returns a debug string representation of the block.
	String() string

	// ID returns an id for the block which may be utilised in markup languages. It may not be unique.
	ID() string

	// IsNesting returns true if the block can contain other blocks.
	IsNesting() bool
}

Block is a unit of Mycomarkup. It is somewhat analogous to HTML's tags.

type HorizontalLine

type HorizontalLine struct {
	TerminalBlock
	// contains filtered or unexported fields
}

HorizontalLine represents the horizontal line block.

In Mycomarkup it is written like that:

----

func MakeHorizontalLine

func MakeHorizontalLine(src string) HorizontalLine

func (*HorizontalLine) ID

func (h *HorizontalLine) ID() string

func (*HorizontalLine) String

func (h *HorizontalLine) String() string

type Img

type Img struct {
	Entries []ImgEntry
	// contains filtered or unexported fields
}

func ImgFromFirstLine

func ImgFromFirstLine(line, hyphaName string) (img *Img, shouldGoBackToNormal bool)

func (*Img) HasOneImage added in v0.1.1

func (img *Img) HasOneImage() bool

HasOneImage returns true if img has exactly one image and that images has no description.

func (*Img) IsNesting added in v0.1.1

func (img *Img) IsNesting() bool
func (img *Img) MarkExistenceOfSrcLinks()

func (*Img) Process

func (img *Img) Process(line string) (shouldGoBackToNormal bool)

type ImgEntry added in v0.1.1

type ImgEntry struct {
	Srclink *links.Link
	// contains filtered or unexported fields
}

ImgEntry is an entry of an image gallery. It can only be nested into Img.

func (*ImgEntry) DescriptionAsHtml added in v0.1.1

func (entry *ImgEntry) DescriptionAsHtml() (html string)

func (*ImgEntry) SizeHAsAttr added in v0.1.1

func (entry *ImgEntry) SizeHAsAttr() string

func (*ImgEntry) SizeWAsAttr added in v0.1.1

func (entry *ImgEntry) SizeWAsAttr() string

type List

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

A structure representing ordered and unordered lists in the AST.

func NewList

func NewList(line, hyphaName string) (*List, bool)

func (*List) Finalize

func (list *List) Finalize()

func (*List) Parse

func (list *List) Parse(line string) (done bool)

func (*List) RenderAsHtml

func (list *List) RenderAsHtml() (html string)

type NestingBlock

type NestingBlock struct{}

func (*NestingBlock) IsNesting

func (ns *NestingBlock) IsNesting() bool

type Paragraph

type Paragraph struct {
	TerminalBlock
	*bytes.Buffer
	// contains filtered or unexported fields
}

type Table

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

func TableFromFirstLine

func TableFromFirstLine(line, hyphaName string) *Table

func (*Table) AsHtml

func (t *Table) AsHtml() (html string)

func (*Table) Process

func (t *Table) Process(line string) (shouldGoBackToNormal bool)

type TerminalBlock

type TerminalBlock struct{}

func (*TerminalBlock) IsNesting

func (tb *TerminalBlock) IsNesting() bool

Directories

Path Synopsis
Package img_helper is an encapsulated helper module for the Img block.
Package img_helper is an encapsulated helper module for the Img block.

Jump to

Keyboard shortcuts

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