]> git.wincent.com - docvim.git/commitdiff
Fix jumbled sections
authorGreg Hurrell <greg@hurrell.net>
Sat, 11 Jun 2016 05:22:11 +0000 (22:22 -0700)
committerGreg Hurrell <greg@hurrell.net>
Sat, 11 Jun 2016 05:22:11 +0000 (22:22 -0700)
Injected headings were not getting correctly extracted because they didn't
appear inside `DocBlock`s.

Closes: https://github.com/wincent/docvim/issues/8
lib/Text/Docvim/Visitor/Section.hs
tests/fixtures/integration/ferret/golden/markdown.golden
tests/fixtures/integration/ferret/golden/plaintext.golden
tests/fixtures/markdown/integration-ferret-plugin.golden
tests/fixtures/parser/command.golden
tests/fixtures/parser/integration-ferret-ftplugin-qf.golden
tests/fixtures/parser/integration-ferret-plugin.golden
tests/fixtures/parser/integration-ferret-private.golden
tests/fixtures/vim/integration-ferret-plugin.golden

index 6fbd341ee0a524d0af570359f4dd4a8f8625f69c..d50a0933a149c209cbd26142c54bd0b710f42ddd 100644 (file)
@@ -73,9 +73,9 @@ getSectionInfo n = execState (mapMOf_ (cosmosOf uniplate) check n) defaultSectio
     check OptionsAnnotation      = hasOptions .= True
     check _                      = modify id
 
--- | Appends a node to the end of a Project.
+-- | Appends a node, wrapped in a DocBlock, to the end of a Project.
 inject :: Node -> Node -> Node
-inject (Project ns) n = Project $ ns ++ [n]
+inject (Project ns) n = Project $ ns ++ [DocBlock [n]]
 inject other _ = other
 
 injectCommands :: Node -> Node
index a269a3b6fc62267d07988d786d24b13565c0a60c..27970c293c150980b62c542e84845f62e6e77f81 100644 (file)
@@ -54,8 +54,6 @@ To generate help tags under Pathogen, you can do so from inside Vim with:
 :call pathogen#helptags()
 ```
 
-## Options
-
 ## Commands
 
 <p align="right"><a name="ack" href="#user-content-ack"><code>:Ack</code></a></p>
@@ -161,6 +159,8 @@ Ferret maps <leader>r (mnemonic: "replace") to <strong>[`<Plug>(FerretAcks)`](#u
 nmap <leader>u <Plug>(FerretAcks)
 ```
 
+## Options
+
 <p align="right"><a name="gferretdispatch" href="#user-content-gferretdispatch"><code>g:FerretDispatch</code></a></p>
 ### `g:FerretDispatch` (boolean, default: 1)
 
index ce9c740a59d42aa31992f3e8abc6c3e334f387c1..6dee12a7443c952053b462b5c91211ca8345adb3 100644 (file)
@@ -4,9 +4,9 @@ CONTENTS                                                       *ferret-contents*
 
 1. Intro                  |ferret-intro|
 2. Installation           |ferret-installation|
-3. Options                |ferret-options|
-4. Commands               |ferret-commands|
-5. Mappings               |ferret-mappings|
+3. Commands               |ferret-commands|
+4. Mappings               |ferret-mappings|
+5. Options                |ferret-options|
 6. Custom autocommands    |ferret-custom-autocommands|
 7. Overrides              |ferret-overrides|
 8. Troubleshooting        |ferret-troubleshooting|
@@ -92,8 +92,6 @@ To generate help tags under Pathogen, you can do so from inside Vim with:
 >
     :call pathogen#helptags()
 <
-OPTIONS                                                         *ferret-options*
-
 COMMANDS                                                       *ferret-commands*
 
 :Ack {pattern} {options}                                                  *:Ack*
@@ -219,6 +217,8 @@ in your |.vimrc| instead using |:nmap|:
     " Instead of <leader>r, use <leader>u.
     nmap <leader>u <Plug>(FerretAcks)
 <
+OPTIONS                                                         *ferret-options*
+
 
                                                               *g:FerretDispatch*
 |g:FerretDispatch|                                          boolean (default: 1)
index 08a91fb843c46348f22a863b955a79e650d25d26..704cbf7bc35dfd9405909f7f7f8cb4897018bde3 100644 (file)
@@ -54,8 +54,6 @@ To generate help tags under Pathogen, you can do so from inside Vim with:
 :call pathogen#helptags()
 ```
 
-## Options
-
 ## Commands
 
 <p align="right"><a name="ack" href="#user-content-ack"><code>:Ack</code></a></p>
@@ -161,6 +159,8 @@ Ferret maps <leader>r (mnemonic: "replace") to <strong>[`<Plug>(FerretAcks)`](#u
 nmap <leader>u <Plug>(FerretAcks)
 ```
 
+## Options
+
 <p align="right"><a name="gferretloaded" href="#user-content-gferretloaded"><code>g:FerretLoaded</code></a></p>
 ### `g:FerretLoaded` (any, default: none)
 
index 823bacd9581d86e037ba6a58d8341d7aca8fd88d..f8458bd2db73a3bd7e0cf275f6abc1c3b25acc51 100644 (file)
@@ -1,5 +1,6 @@
 Project
-  [ Project [ Unit [ DocBlock [] ] , CommandsAnnotation ]
+  [ Project [ Unit [ DocBlock [] ] , DocBlock [] ]
+  , CommandsAnnotation
   , CommandAnnotation "Ack" (Just "{pattern} {options}")
   , Paragraph [ Plaintext "Info." ]
   , CommandAnnotation "Qargs" Nothing
index e0432da74250ef0f8f534da7ea94dc322aea0728..ace589f7fb0b582bb8af11a301915ab4d2360bb3 100644 (file)
@@ -38,8 +38,9 @@ Project
               "vnoremap <buffer> <silent> d :call ferret#private#qf_delete()<CR>"
           , GenericStatement "endif"
           ]
-      , OptionsAnnotation
+      , DocBlock []
       ]
+  , OptionsAnnotation
   , OptionAnnotation "g:FerretQFOptions" "boolean" (Just "1")
   , Paragraph
       [ Plaintext "Controls"
index 9045463c67f8e9f4c9227a459e5c38d814efe2aa..9b0498264e51c0f5cb92be86e2d9b460788e149c 100644 (file)
@@ -4,9 +4,9 @@ Project
       , TOC
           [ "Intro"
           , "Installation"
-          , "Options"
           , "Commands"
           , "Mappings"
+          , "Options"
           , "Custom autocommands"
           , "Overrides"
           , "Troubleshooting"
@@ -929,9 +929,10 @@ Project
               { letLexpr = "&cpoptions " , letValue = "s:cpoptions" }
           , UnletStatement { unletBang = False , unletBody = "s:cpoptions" }
           ]
-      , OptionsAnnotation
-      , CommandsAnnotation
+      , DocBlock []
+      , DocBlock []
       ]
+  , CommandsAnnotation
   , CommandAnnotation "Ack" (Just "{pattern} {options}")
   , Paragraph
       [ Plaintext "Searches"
@@ -2172,6 +2173,7 @@ Project
       [ "\" Instead of <leader>r, use <leader>u."
       , "nmap <leader>u <Plug>(FerretAcks)"
       ]
+  , OptionsAnnotation
   , OptionAnnotation "g:FerretLoaded" "any" Nothing
   , Paragraph
       [ Plaintext "To"
index d5a98868b2aebb34611f4591466ce2c3499831fd..90cc3836d257ba317d29842ef03c4b0392390d3a 100644 (file)
@@ -345,8 +345,9 @@ Project
                   ]
               }
           ]
-      , OptionsAnnotation
+      , DocBlock []
       ]
+  , OptionsAnnotation
   , OptionAnnotation "g:FerretDispatch" "boolean" (Just "1")
   , Paragraph
       [ Plaintext "Controls"
index 8f8410f8697e36ac223e869a8be4c66f41d88535..91a67cf29691d273e9fc7fa404d2296f116cb235 100644 (file)
@@ -4,9 +4,9 @@ CONTENTS                                                       *ferret-contents*
 
 1. Intro                  |ferret-intro|
 2. Installation           |ferret-installation|
-3. Options                |ferret-options|
-4. Commands               |ferret-commands|
-5. Mappings               |ferret-mappings|
+3. Commands               |ferret-commands|
+4. Mappings               |ferret-mappings|
+5. Options                |ferret-options|
 6. Custom autocommands    |ferret-custom-autocommands|
 7. Overrides              |ferret-overrides|
 8. Troubleshooting        |ferret-troubleshooting|
@@ -92,8 +92,6 @@ To generate help tags under Pathogen, you can do so from inside Vim with:
 >
     :call pathogen#helptags()
 <
-OPTIONS                                                         *ferret-options*
-
 COMMANDS                                                       *ferret-commands*
 
 :Ack {pattern} {options}                                                  *:Ack*
@@ -219,6 +217,8 @@ in your |.vimrc| instead using |:nmap|:
     " Instead of <leader>r, use <leader>u.
     nmap <leader>u <Plug>(FerretAcks)
 <
+OPTIONS                                                         *ferret-options*
+
 
                                                                 *g:FerretLoaded*
 |g:FerretLoaded|                                             any (default: none)