]> git.wincent.com - docvim.git/commitdiff
Add entries to symbol table for generated headings
authorGreg Hurrell <greg@hurrell.net>
Mon, 6 Jun 2016 06:53:25 +0000 (23:53 -0700)
committerGreg Hurrell <greg@hurrell.net>
Mon, 6 Jun 2016 06:53:25 +0000 (23:53 -0700)
lib/Docvim/Visitor/Symbol.hs
tests/fixtures/markdown/integration-ferret-plugin.golden

index e031110d3a28b20631b85131f4c3d8a0189f56dc..33ade1ce8afc8db00cf48c0f92c60bdb5d81570d 100644 (file)
@@ -15,14 +15,19 @@ getSymbols node = if length symbols == Set.size set
   where
     set                                     = Set.fromList symbols
     symbols                                 = walk gatherSymbols [] node
+    gatherSymbols (CommandsAnnotation)      = genHeading "commands"
+    gatherSymbols (FunctionsAnnotation)     = genHeading "functions"
     gatherSymbols (HeadingAnnotation h)     = [titleAnchor h]
     gatherSymbols (LinkTargets ts)          = ts
     -- TODO: probably don't want this target to exist in the symbol table when
     -- emitting Markdown
     gatherSymbols (PluginAnnotation name _) = [name, name ++ ".txt"]
+    gatherSymbols (MappingsAnnotation)      = genHeading "mappings"
+    gatherSymbols (OptionsAnnotation)       = genHeading "options"
     gatherSymbols _                         = []
     titleAnchor title                       = titlePrefix ++ sanitizeAnchor title
     titlePrefix                             = downcase $ maybe "" (++ "-") $ getPluginName node
+    genHeading h                            = maybe [] (\x -> [x ++ "-" ++ h]) (getPluginName node)
     duplicates                              = nub $ f (sort symbols)
       where
         f [] = []
index b0acb3606cf11a73357de865d9b902c554041e1b..d33bd7efed44fe21a4c3e71e28e4295c3c49bff1 100644 (file)
@@ -87,7 +87,7 @@ A typical sequence consists of an <strong>`:Ack`</strong> invocation to populate
 :Acks /foo/bar/
 ```
 
-Controls whether to set up the Ferret mappings, such as <strong>`<Plug>(FerretAck)`</strong> (see <strong>`ferret-mappings`</strong> for a full list). To prevent any mapping from being configured, set to 0:
+Controls whether to set up the Ferret mappings, such as <strong>`<Plug>(FerretAck)`</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