cajun

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

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

Go to latest
Published: Mar 20, 2015 License: MIT Imports: 5 Imported by: 1

README

cajun

Cajun: a Creole processor in golang

Creole (which is a markdown like format, but simpler and safer) processor. Takes in creole outputs html.

![GoDoc] (https://godoc.org/github.com/m4tty/cajun?status.png) Build Status

Motivation

An excuse to write a lexer. I also like Creole over Markdown. Because reasons. This Why Markdown Is Not My Favourite Language covers it pretty well.

Installation

With Go and git installed:

go get github.com/m4tty/cajun

will download, compile, and install the package into your $GOPATH directory hierarchy. Alternatively, you can achieve the same if you import it into a project:

	import "github.com/m4tty/cajun"

and go get without parameters.

Design

It is a traditional lexer, but followed much of the strategy (a state machine that emits tokens on a channel) explained here by Rob Pike. [Lexical Scanning in Go - Rob Pike] (https://www.youtube.com/watch?v=HxaD_trXwRE)

Example

Transform some input using:

output := cajun.Transform(input)

Documentation

Overview

Package cajun provide creole processing (lexing and parsing) functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Transform

func Transform(input string) (output string, terror error)

Transform processes an input string of creole markdown and returns html or error

Types

type Cajun

type Cajun struct {
	FreeLink FreeLinkFormatter
	WikiLink WikiLinkFormatter
}

Cajun is for parser options

func New

func New() *Cajun

func (*Cajun) Transform

func (c *Cajun) Transform(input string) (output string, terror error)

type FreeLinkFormatter

type FreeLinkFormatter interface {
	FreeLink(href string, text string) string
}

type WikiLinkFormatter

type WikiLinkFormatter interface {
	WikiLink(href string, text string) string
}

Jump to

Keyboard shortcuts

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