shikensu-0.3.5: Run a sequence of functions on in-memory representations of files

Safe HaskellNone



Dictionary functions.



clearMetadata :: Dictionary -> Dictionary Source #

Clear metadata.

Replace the current hash map with an empty one.

clone :: FilePath -> FilePath -> Dictionary -> Dictionary Source #


For each definition that has the given localPath (1st argument), make a clone with a new localPath (2nd argument), and add that into dictionary just after the matching definition.

clone "index.html" "200.html" dictionary

copyPropsToMetadata :: Dictionary -> Dictionary Source #

Copy definition properties into the metadata.

See the toJSON implementation for Definition in Types to see what properties get put in here.

exclude :: FilePath -> Dictionary -> Dictionary Source #


Filter out the definitions that have the given localPath.

insertMetadata :: Metadata -> Dictionary -> Dictionary Source #

Insert metadata.

Merge the current hash map with another one.

permalink :: String -> Dictionary -> Dictionary Source #


Append the basename to the dirname, and change the basename to the given string. It will NOT change definitions that already have the new basename.

permalink "index" dictionary

prefixDirname :: String -> Dictionary -> Dictionary Source #

Prefix dirname.

Prefix the dirname of each definition with a given string.

rename :: FilePath -> FilePath -> Dictionary -> Dictionary Source #


Change the localPath of the definitions that match a given localPath. For example, if you have a definition with the local path `a/b/example.html`:

rename "a/b/example.html" "example/index.html" dictionary

See localPath for more info.

renameExt :: String -> String -> Dictionary -> Dictionary Source #

Rename extension.


renameExt ".markdown" ".html" dictionary
-- The definitions that had the extname ".markdown"
-- now have the extname ".html"

renderContent :: (Definition -> Maybe ByteString) -> Dictionary -> Dictionary Source #

Render content.

Replace the content property by providing a renderer. A renderer is a function with the signature `Definition -> Maybe ByteString`.

You can use this to render templates, markdown, etc.

replaceMetadata :: Metadata -> Dictionary -> Dictionary Source #

Replace metadata.

Replace the current hash map with another one.