converter

package
v0.0.0-...-d53c238 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

CONFIGURATION

opinionated conversion from WordPress to Hugo

UTILITY types and functions

Index

Constants

View Source
const CommentTemplateSrc = `` /* 198-byte string literal not displayed */

text/template for comments

View Source
const PostDirectoryContentSubPath = "post"

path under content where posts should be generated. "post" and "posts" are both common, but the Hugo theme will expect one of them

View Source
const PostTemplateSrc = `` /* 316-byte string literal not displayed */

text/template for posts

Variables

View Source
var CommentTemplate = MakeParsedTemplate("comment_template", CommentTemplateSrc)

parsed comment template

View Source
var EmojiReplacer = MakeReplacer(emojiReplacements...)

ready to use replacer

View Source
var PostTemplate = MakeParsedTemplate("post_template", PostTemplateSrc)

parsed post template

View Source
var QuotesReplacer = MakeReplacer(quotesReplacements...)

ready to use replacer

View Source
var UrlReplacer1 = MakeReplacer(urlReplacements1...)
View Source
var UrlReplacer2 = MakeReplacer(urlReplacements2...)

ready to use replacer

Functions

func Convert

func Convert(items []wp.Item, targetBaseDir string)

convert all items

func CreateSubPath

func CreateSubPath(basePath string, subPath string) string

creates a sub-path under a base path and returns its path

func EliminateAmazonAds

func EliminateAmazonAds(content string) string

func FixCommentAuthor

func FixCommentAuthor(comment wp.Comment) wp.Comment

maybe not for everybody, but this author needs to be unified

func GetCommentFileNameAndIndentLevel

func GetCommentFileNameAndIndentLevel(repliesTo map[int]int, c wp.Comment, commentDir string) (string, int)

construct comment filename reflecting replyTo relationship, determine indent level

func HandleComments

func HandleComments(commentDir string, item wp.Item, handler func(wp.Comment, string, int) error) error

takes a func as handler to make it testable

func MakeParsedTemplate

func MakeParsedTemplate(name string, src string) *template.Template

create a parsed template, panics on failure

func MakeReplacer

func MakeReplacer(rep ...Replacement) *strings.Replacer

strings.Replacer wants a flat list of strings

Types

type Replacement

type Replacement struct {
	From, To string
}

a type for making explicit what replaces what

Jump to

Keyboard shortcuts

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