-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Documentation generator for Vim plug-ins -- -- Produces Vim help and HTML (via Markdown) documentation. @package docvim @version 0.3.1.6 -- | Recursively read the paths in a directory. -- -- Based on RecursiveContents example in chapter 9 of "Real -- World Haskell". module Text.Docvim.ReadDir readDir :: FilePath -> IO [FilePath] -- | Options parser for the docvim executable. module Text.Docvim.Options data Options Options :: Maybe [FilePath] -> Bool -> String -> Bool -> Options [outfiles] :: Options -> Maybe [FilePath] [debug] :: Options -> Bool [directory] :: Options -> String [verbose] :: Options -> Bool options :: IO Options module Text.Docvim.AST data Node Project :: [Node] -> Node Unit :: [Node] -> Node Empty :: Node FunctionDeclaration :: Bool -> String -> ArgumentList -> [String] -> [Node] -> Node [functionBang] :: Node -> Bool [functionName] :: Node -> String [functionArguments] :: Node -> ArgumentList [functionAttributes] :: Node -> [String] [functionBody] :: Node -> [Node] LetStatement :: String -> String -> Node [letLexpr] :: Node -> String [letValue] :: Node -> String LexprStatement :: Bool -> String -> Node [lexprBang] :: Node -> Bool [lexprExpr] :: Node -> String LwindowStatement :: Maybe Int -> Node [lwindowHeight] :: Node -> Maybe Int UnletStatement :: Bool -> String -> Node [unletBang] :: Node -> Bool [unletBody] :: Node -> String -- | For the stuff we only crudely parse for now. GenericStatement :: String -> Node DocBlock :: [Node] -> Node Paragraph :: [Node] -> Node LinkTargets :: [String] -> Node List :: [Node] -> Node ListItem :: [Node] -> Node Blockquote :: [Node] -> Node Fenced :: [String] -> Node Separator :: Node Plaintext :: String -> Node BreakTag :: Node Link :: String -> Node Code :: String -> Node Whitespace :: Node PluginAnnotation :: Name -> Description -> Node FunctionsAnnotation :: Node FunctionAnnotation :: Name -> Node IndentAnnotation :: Node DedentAnnotation :: Node CommandsAnnotation :: Node CommandAnnotation :: Name -> (Maybe Parameters) -> Node FooterAnnotation :: Node MappingsAnnotation :: Node MappingAnnotation :: Name -> Node OptionsAnnotation :: Node OptionAnnotation :: Name -> Type -> (Maybe Default) -> Node HeadingAnnotation :: String -> Node SubheadingAnnotation :: String -> Node TOC :: [String] -> Node data ArgumentList ArgumentList :: [Argument] -> ArgumentList data Argument Argument :: String -> Argument type Default = String type Description = String type Name = String type Type = String type Parameters = String -- | Walks an AST node calling the supplied visitor function. -- -- This is an in-order traversal. -- -- For example, to implement a visitor which counts all nodes: -- --
--   import Data.Monoid
--   count = getSum $ walk (\_ -> 1) (Sum 0) tree
--   
-- -- For comparison, here is a (probably inefficient) alternative way using -- Plated instead of walk: -- --
--   import Control.Lens.Operators
--   import Control.Lens.Plated
--   import Data.Data.Lens
--   count = length $ tree ^.. cosmosOf uniplate
--   
-- -- Another example; accumulating SubheadingAnnotation nodes into a -- list: -- --
--   accumulator node@(SubheadingAnnotation _) = [node]
--   accumulator _ = [] -- skip everything else
--   nodes = walk accumulator [] tree
--   
-- -- Again, for comparison, the same without walk, this time using a -- list comprehension: -- --
--   import Control.Lens.Operators
--   import Control.Lens.Plated
--   import Data.Data.Lens
--   [n | n@(SubheadingAnnotation _) <- tree ^.. cosmosOf uniplate]
--   
walk :: Monoid a => (Node -> a) -> a -> Node -> a -- | Sanitizes a link target similar to the way that GitHub does: -- -- -- -- We use this both for generating GitHub friendly link targets, and for -- auto-generating new link targets for use inside Vim help files. -- -- Source: -- https://gist.github.com/asabaylus/3071099#gistcomment-1593627 sanitizeAnchor :: String -> String invalidNode :: forall t. t instance GHC.Show.Show Text.Docvim.AST.Node instance GHC.Classes.Eq Text.Docvim.AST.Node instance Data.Data.Data Text.Docvim.AST.Node instance GHC.Show.Show Text.Docvim.AST.ArgumentList instance GHC.Classes.Eq Text.Docvim.AST.ArgumentList instance Data.Data.Data Text.Docvim.AST.ArgumentList instance GHC.Show.Show Text.Docvim.AST.Argument instance GHC.Classes.Eq Text.Docvim.AST.Argument instance Data.Data.Data Text.Docvim.AST.Argument instance Control.Lens.Plated.Plated Text.Docvim.AST.Node module Text.Docvim.Parse parse :: String -> IO Node -- | Strip trailing (right) whitespace. rstrip :: String -> String -- | Strip trailing and leading whitespace. -- -- Not efficient, but chosen for readablility. -- -- TODO: switch to Data.Text -- (http:/stackoverflow.coma62703822103996) for efficiency. strip :: String -> String -- | Parses a translation unit (file contents) into an AST. unit :: Parser Node module Text.Docvim.Optimize -- | Optimize a Project's AST by eliminating empty paths. optimize :: Node -> Node module Text.Docvim.Visitor -- | Returns True if a node marks the end of a regionblocksection. endSection :: Node -> Bool extract :: ([Node] -> ([[a]], [Node])) -> Node -> (Node, [a]) extractBlocks :: Alternative f => (a -> Maybe (a -> Bool)) -> [a] -> (f [a], [a]) module Text.Docvim.Visitor.Command -- | Extracts a list of nodes (if any exist) identified by the `@command` -- annotation of the source code. extractCommand :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Commands -- | Extracts a list of nodes (if any exist) from the `@commands` -- section(s) of the source code. -- -- It is not recommended to have multiple `@commands` sections in a -- project. If multiple such sections (potentially across multiple -- translation units) exist, there are no guarantees about order; they -- just get concatenated in the order we see them. extractCommands :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Footer -- | Extracts a list of nodes (if any exist) from the `@footer` section(s) -- of the source code. -- -- It is not recommended to have multiple footers in a project. If -- multiple footers (potentially across multiple translation units) -- exist, there are no guarantees about order but they just get -- concatenated in the order we see them. extractFooter :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Function -- | Extracts a list of nodes (if any exist) identified by the `@function` -- annotation of the source code. extractFunction :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Functions -- | Extracts a list of nodes (if any exist) from the `@functions` -- section(s) of the source code. -- -- It is not recommended to have multiple `@functions` sections in a -- project. If multiple such sections (potentially across multiple -- translation units) exist, there are no guarantees about order; they -- just get concatenated in the order we see them. extractFunctions :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Heading -- | Returns a list of all headings, in the order in which they appear in -- the AST. getHeadings :: Node -> [String] -- | Injects a table of contents immediately after any -- PluginAnnotation in an AST (note: there should only be one). -- TODO: warn or error if there is more than one. or use a monadic -- variant of transform to do only the first... injectTOC :: Node -> Node module Text.Docvim.Visitor.Mapping -- | Extracts a list of nodes (if any exist) identified by the `@mapping` -- annotation of the source code. extractMapping :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Mappings -- | Extracts a list of nodes (if any exist) from the `@mappings` -- section(s) of the source code. -- -- It is not recommended to have multiple `@mappings` sections in a -- project. If multiple such sections (potentially across multiple -- translation units) exist, there are no guarantees about order; they -- just get concatenated in the order we see them. extractMappings :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Option -- | Extracts a list of nodes (if any exist) identified by the `@option` -- annotation of the source code. extractOption :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Options -- | Extracts a list of nodes (if any exist) from the `@options` section(s) -- of the source code. -- -- It is not recommended to have multiple `@options` sections in a -- project. If multiple such sections (potentially across multiple -- translation units) exist, there are no guarantees about order; they -- just get concatenated in the order we see them. extractOptions :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Visitor.Plugin -- | Returns the name of the plug-in or Nothing if none is found. -- -- In the event that there are multiple `@plugin` annotations competing -- to define the name of plugin, the first encountered one wins. getPluginName :: Node -> Maybe String -- | Extracts a list of nodes (if any exist) from the `@plugin` section(s) -- of the source code. -- -- It is not recommended to have multiple `@plugin` sections in a -- project. If multiple such sections (potentially across multiple -- translation units) exist, there are no guarantees about order; they -- just get concatenated in the order we see them. extractPlugin :: Alternative f => [Node] -> (f [Node], [Node]) module Text.Docvim.Printer.Vim vimHelp :: Node -> String module Text.Docvim.Visitor.Section injectCommands :: Node -> Node injectFunctions :: Node -> Node injectMappings :: Node -> Node injectOptions :: Node -> Node instance GHC.Show.Show Text.Docvim.Visitor.Section.SectionInfo module Text.Docvim.Compile -- | Compile a set of translation units into a project. compile :: [Node] -> Node module Text.Docvim.Visitor.Symbol getSymbols :: Node -> [String] module Text.Docvim.Printer.Markdown markdown :: Node -> String -- | The runnable part of the docvim executable. module Text.Docvim.CLI run :: IO () -- | Functions to facilitate automated and manual testing. module Text.Docvim.Util -- | Parse and compile a list of strings containing a translation units. compileUnits :: [String] -> Either ParseError Node -- | Convenience function: Parse and compile a list of strings containing -- translation units, but always returns a string even in the case of an -- error. p :: [String] -> String -- | Parse a string containing a translation unit. parseUnit :: String -> Either ParseError Node -- | Parse and compile a list of input strings into Markdown help format. pm :: [String] -> String -- | Pretty-prints the result of parsing and compiling an input string. -- -- To facilitate quick testing in the REPL; example: -- -- pp "unlet g:var" pp :: String -> IO () -- | Pretty-prints the result of parsing and compiling an input string and -- transforming into Markdown format. -- -- For logging in the REPL. ppm :: String -> IO () -- | Pretty-prints the result of parsing and compiling an input string and -- transforming into Vim help format. -- -- For logging in the REPL. ppv :: String -> IO () -- | Parse and compile a list of input strings into Vim help format. pv :: [String] -> String