Documentation ¶
Index ¶
- func Dir(baseDir string, contentType string) string
- func EstablishDirLevelConf(t mapper.Type, tc TransConfig) (string, string)
- func Filename(item mapper.Item) string
- func FromToml(s string) (c map[string]interface{}, err error)
- func FromYaml(s string) (c map[string]interface{}, err error)
- func GetArchetypeFilename(contentTypeName string) string
- func LeafBundleFilename(t mapper.Type) string
- func SectionFilename(t mapper.Type) string
- func WriteTomlFrontmatter(fm interface{}) string
- func WriteYamlFrontmatter(fm interface{}) string
- type Content
- type TransConfig
- type TranslationContext
- func (tc *TranslationContext) ConvertToContent(fieldMap map[string]interface{}) Content
- func (tc *TranslationContext) MapContentValuesToTypeNames(Map map[string]interface{}, fields []mapper.TypeField, ids map[string]string) map[string]interface{}
- func (tc *TranslationContext) MergeMaps(itemDefault map[string]interface{}, itemOverride map[string]interface{}) (combinedItem map[string]interface{})
- func (tc *TranslationContext) TranslateFromMarkdown(content string) (rawContent map[string]interface{}, err error)
- func (tc *TranslationContext) TranslateToMarkdown(rawContent Content) (content string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstablishDirLevelConf ¶
func EstablishDirLevelConf(t mapper.Type, tc TransConfig) (string, string)
EstablishDirLevelConf provides the ability to augment content directories with with LeafBundle (index.md) or Section level (_index.md) frontmatter during the export process.
func GetArchetypeFilename ¶
ArcheTypeFilename takes a content-type's name and returns the file path to the corresponding archetype file.
func LeafBundleFilename ¶
func SectionFilename ¶
func WriteTomlFrontmatter ¶
func WriteTomlFrontmatter(fm interface{}) string
WriteTomlFrontmatter (fm Map[]) -> string Converts a Map[] into a TOML string, pre and postfixing it with `+++` to designate frontmatter.
func WriteYamlFrontmatter ¶
func WriteYamlFrontmatter(fm interface{}) string
WriteYamlFrontmatter (fm Map[]) -> string Converts a Map[] into a YAML string, pre and postfixing it with `---` to designate frontmatter.
Types ¶
type Content ¶
type TransConfig ¶
type TransConfig struct { Encoding string Section map[string]interface{} LeafBundle map[string]interface{} }
func LoadConfig ¶
func LoadConfig(config string) TransConfig
type TranslationContext ¶
type TranslationContext struct { Result mapper.ItemResult TransConfig TransConfig }
func (*TranslationContext) ConvertToContent ¶
func (tc *TranslationContext) ConvertToContent(fieldMap map[string]interface{}) Content
ConvertToContent takes a map of values and converts it to a Content struct
func (*TranslationContext) MapContentValuesToTypeNames ¶
func (tc *TranslationContext) MapContentValuesToTypeNames(Map map[string]interface{}, fields []mapper.TypeField, ids map[string]string) map[string]interface{}
MapContentValuesToTypeNames takes the values map and the typefield map from contentful and merges the two.
func (*TranslationContext) MergeMaps ¶
func (tc *TranslationContext) MergeMaps(itemDefault map[string]interface{}, itemOverride map[string]interface{}) (combinedItem map[string]interface{})
MergeMaps takes a defaults and an overrides map and assigns any missing values from the defaults to the overrides map.
func (*TranslationContext) TranslateFromMarkdown ¶
func (tc *TranslationContext) TranslateFromMarkdown(content string) (rawContent map[string]interface{}, err error)
TranslateFromMarkdown takes a markdown file's contents and converts it to a map.
func (*TranslationContext) TranslateToMarkdown ¶
func (tc *TranslationContext) TranslateToMarkdown(rawContent Content) (content string)
TranslateToMarkdown accepts a Content struct and converts it to markdown file contents.