thomasin / elm-frontmatter / Content.Function

This module is used by the CLI app, and is meant for parsing function details out of input file paths.


type FunctionType
    = SingletonFunction
    | CollectionItemFunction

Generated functions can either be singleton or collection item functions.

"Singleton" means that they don't share a type with any other function in the module. These functions are made from paths with no brackets i.e about.md, recipe/egg/content.md

"Collection item" means that they do share types with other functions. These functions are made from paths with surrounding brackets i.e recipes/[egg].md, recipes/[egg]/content.md


type alias Function =
{ moduleDir : List String
, name : String
, type_ : FunctionType 
}

Function overview

fromPath : Path -> Result PathError Function

Turns a file path into a possible function


type PathError
    = PathIsHidden
    | PathIsEmpty
    | PathIsInvalid String

Possible errors returned from fromPath