]> git.wincent.com - docvim.git/commitdiff
Add @option headings to Markdown printer
authorGreg Hurrell <greg@hurrell.net>
Tue, 7 Jun 2016 14:23:35 +0000 (07:23 -0700)
committerGreg Hurrell <greg@hurrell.net>
Tue, 7 Jun 2016 14:23:35 +0000 (07:23 -0700)
lib/Docvim/Printer/Markdown.hs
tests/fixtures/markdown/integration-ferret-ftplugin-qf.golden
tests/fixtures/markdown/integration-ferret-plugin.golden
tests/fixtures/markdown/integration-ferret-private.golden

index 7adbb5f84b761eed3f3d2e17bdf683e581f09533..c3e0e22c80bc9eb51531af233ad607644a1d0fdf 100644 (file)
@@ -40,12 +40,12 @@ node n = case n of
   -- TODO: add an anchor here
   HeadingAnnotation h     -> return $ h2 h -- TODO link?
   Link l                  -> link l
-  LinkTargets l           -> return $ linkTargets l ++ "\n"
+  LinkTargets l           -> return $ linkTargets l
   List ls                 -> nodes ls >>= nl
   ListItem l              -> fmap ("- " ++) (nodes l) >>= nl
   MappingAnnotation m     -> return $ mapping m
   MappingsAnnotation      -> return $ h2 "Mappings" -- TODO link to foomappings
-  -- TODO: handle OptionAnnotation
+  OptionAnnotation {}     -> return $ option n
   OptionsAnnotation       -> return $ h2 "Options" -- TODO link to foooptions
   Paragraph p             -> nodes p >>= nl >>= nl
   Plaintext p             -> return p
@@ -95,6 +95,7 @@ linkTargets :: [String] -> String
 linkTargets ls =  "<p align=\"right\">"
                ++ unwords (map linkify $ sort ls)
                ++ "</p>"
+               ++ "\n"
   where
     linkify l = a $ Anchor [ Attribute "name" (sanitizeAnchor l)
                            , Attribute "href" (gitHubAnchor l)
@@ -133,8 +134,14 @@ gitHubAnchor :: String -> String
 gitHubAnchor n = "#user-content-" ++ sanitizeAnchor n
 
 -- TODO: make sure symbol table knows about option targets too
+option :: Node -> String
+option (OptionAnnotation n t d) = targets ++ h
+  where targets = linkTargets [n]
+        h = h3 $ "`" ++ n ++ "` (" ++ t ++ ", default: " ++ def ++ ")"
+        def = fromMaybe "none" d
+
 command :: Node -> String
-command (CommandAnnotation name params) = target ++ "\n" ++ content
+command (CommandAnnotation name params) = target ++ content
   where target = linkTargets [":" ++ name]
         content = h3 $ "`:" ++ annotation ++ "`"
         annotation = rstrip $ name ++ " " ++ fromMaybe "" params
index 4de81ddae4d46642f261bd9347ca788815016d11..c1414fbc7823976b57ffe91d56c439be08766720 100644 (file)
@@ -1,3 +1,6 @@
+<p align="right"><a name="gferretqfoptions" href="#user-content-gferretqfoptions"><code>g:FerretQFOptions</code></a></p>
+### `g:FerretQFOptions` (boolean, default: 1)
+
 Controls whether to set up setting overrides for <strong>`quickfix`</strong> windows. These are various settings, such as <strong>`norelativenumber`</strong>, <strong>`nolist`</strong> and <strong>`nowrap`</strong>, that are intended to make the <strong>`quickfix`</strong> window, which is typically very small relative to other windows, more usable.
 
 A full list of overridden settings can be found in <strong>`ferret-overrides`</strong>.
@@ -8,6 +11,9 @@ To prevent the custom settings from being applied, set <strong>`g:FerretQFOption
 let g:FerretQFOptions=0
 ```
 
+<p align="right"><a name="gferretqfmap" href="#user-content-gferretqfmap"><code>g:FerretQFMap</code></a></p>
+### `g:FerretQFMap` (boolean, default: 1)
+
 Controls whether to set up mappings in the <strong>`quickfix`</strong> results window for deleting results. The mappings include:
 
 - `d` (<strong>`visual-mode`</strong>): delete visual selection
index 8f781717522f8de1e7ecb126e16d18436b2829a6..29162ce3e4fa1ae4b93c63eefbe2e30d10e595cf 100644 (file)
@@ -157,12 +157,18 @@ Ferret maps <leader>r (mnemonic: "replace") to <strong>[`<Plug>(FerretAcks)`](#u
 nmap <leader>u <Plug>(FerretAcks)
 ```
 
+<p align="right"><a name="gferretmap" href="#user-content-gferretmap"><code>g:FerretMap</code></a></p>
+### `g:FerretMap` (boolean, default: 1)
+
 Controls whether to set up the Ferret mappings, such as <strong>[`<Plug>(FerretAck)`](#user-content-plugferretack)</strong> (see <strong>[`ferret-mappings`](#user-content-ferret-mappings)</strong> for a full list). To prevent any mapping from being configured, set to 0:
 
 ```
 let g:FerretMap=0
 ```
 
+<p align="right"><a name="gferretqfcommands" href="#user-content-gferretqfcommands"><code>g:FerretQFCommands</code></a></p>
+### `g:FerretQFCommands` (boolean, default: 1)
+
 Controls whether to set up custom versions of the <strong>`quickfix`</strong> commands, <strong>`:cn`</strong>, <strong>`:cnf`</strong>, <strong>`:cp`</strong> an <strong>`:cpf`</strong>. These overrides vertically center the match within the viewport on each jump. To prevent the custom versions from being configured, set to 0:
 
 ```
index 0d8fb54414e103654f6cae12c120567ac99e4ad6..c629b3e6820bd56dfb7a76902529e568b8827e3f 100644 (file)
@@ -1,3 +1,6 @@
+<p align="right"><a name="gferretdispatch" href="#user-content-gferretdispatch"><code>g:FerretDispatch</code></a></p>
+### `g:FerretDispatch` (boolean, default: 1)
+
 Controls whether to use vim-dispatch (and specifically, <strong>`:Make`</strong>) to run <strong>`:Ack`</strong> searches asynchronously, when available. To prevent vim-dispatch from being used, set to 0:
 
 ```