Documentation ¶
Overview ¶
CONFIGURATION
opinionated conversion from WordPress to Hugo
UTILITY types and functions
Index ¶
- Constants
- Variables
- func Convert(items []wp.Item, targetBaseDir string)
- func CreateSubPath(basePath string, subPath string) string
- func EliminateAmazonAds(content string) string
- func FixCommentAuthor(comment wp.Comment) wp.Comment
- func GetCommentFileNameAndIndentLevel(repliesTo map[int]int, c wp.Comment, commentDir string) (string, int)
- func HandleComments(commentDir string, item wp.Item, handler func(wp.Comment, string, int) error) error
- func MakeParsedTemplate(name string, src string) *template.Template
- func MakeReplacer(rep ...Replacement) *strings.Replacer
- type Replacement
Constants ¶
const CommentTemplateSrc = `` /* 198-byte string literal not displayed */
text/template for comments
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
const PostTemplateSrc = `` /* 316-byte string literal not displayed */
text/template for posts
Variables ¶
var CommentTemplate = MakeParsedTemplate("comment_template", CommentTemplateSrc)
parsed comment template
var EmojiReplacer = MakeReplacer(emojiReplacements...)
ready to use replacer
var PostTemplate = MakeParsedTemplate("post_template", PostTemplateSrc)
parsed post template
var QuotesReplacer = MakeReplacer(quotesReplacements...)
ready to use replacer
var UrlReplacer1 = MakeReplacer(urlReplacements1...)
var UrlReplacer2 = MakeReplacer(urlReplacements2...)
ready to use replacer
Functions ¶
func CreateSubPath ¶
creates a sub-path under a base path and returns its path
func EliminateAmazonAds ¶
func FixCommentAuthor ¶
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 ¶
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