pansite-0.2.0.0: Pansite: a simple web site management tool

Copyright(C) Richard Cook 2017-2018
LicenseMIT
Maintainerrcook@rcook.org
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Pansite

Description

 

Synopsis

Documentation

data App Source #

Constructors

App [Route] [Target] 

data Route Source #

Constructors

Route [String] FilePath 

data Tool Source #

Constructors

Tool String (UpdateContext -> Value -> Parser Tool) (RunContext -> IO ()) 

splitRoutePath :: String -> [String] Source #

Split route path into fragments

Examples:

>>> splitRoutePath "aaa/bbb"
["aaa","bbb"]
>>> splitRoutePath "aaa"
["aaa"]
>>> splitRoutePath ""
[]

pathPattern :: String -> Either String PathPattern Source #

Convert string to path pattern

Examples:

>>> import Data.Either
>>> isRight $ pathPattern "%"
True
>>> isRight $ pathPattern "aaa"
True
>>> isLeft $ pathPattern "%%"
True
>>> isLeft $ pathPattern "%aaa%"
True

pathPatternStem :: PathPattern -> FilePath -> String Source #

Stem of pattern and path

Examples:

>>> Right p = pathPattern "C:/aaa/bbb/%.txt"
>>> pathPatternStem p "C:/aaa/bbb/stem.txt"
"stem"

substituteStem :: String -> PathPattern -> FilePath Source #

Substitute stem in path pattern

Examples:

>>> Right p = pathPattern "/aaa/bbb/%/ddd/eee/"
>>> substituteStem "ccc" p
"/aaa/bbb/ccc/ddd/eee/"

(%%>>) :: PathPattern -> (FilePath -> Action ()) -> Rules () infix 1 Source #

countOccurrences :: String -> String -> Int Source #

Number of occurrences of a substring in a string

Examples:

>>> countOccurrences "" "abc"
0
>>> countOccurrences "" ""
0
>>> countOccurrences "abcdefghi" "xyz"
0
>>> countOccurrences "abc" "abc"
1
>>> countOccurrences "abcabc" "abc"
2
>>> countOccurrences "abcdefabcghiabcjkl" "abc"
3

stems :: Eq a => [a] -> [a] -> ([a], [a]) Source #

Stems of lists

Examples:

>>> stems "abcmiddledef" "abcfoodef"
("middle","foo")
>>> stems "abc" "xyz"
("abc","xyz")