Fix case for Vim help plugin header
authorGreg Hurrell <greg@hurrell.net>
Sat, 11 Jun 2016 02:29:24 +0000 (19:29 -0700)
committerGreg Hurrell <greg@hurrell.net>
Sat, 11 Jun 2016 02:29:24 +0000 (19:29 -0700)
Always lower. And no need to be in the symbol table because the Vim printer
doesn't even consult it.

lib/Text/Docvim/Printer/Vim.hs
tests/fixtures/vim/integration-pinnacle.golden
tests/fixtures/vim/plugin.golden [new file with mode: 0644]
tests/fixtures/vim/plugin.vim [new file with mode: 0644]

index f99154f2fc4384031ee51f087bf71cec1936c341..5c4f4b8e7572545bb16db2f96537cb3b69f41d07 100644 (file)
@@ -146,12 +146,12 @@ node n = case n of
   Whitespace                 -> whitespace
   _                          -> append ""
 
--- TODO: add {name}.txt to the symbol table?
 plugin :: String -> String -> Env
 plugin name desc = appendNoWrap $
-   (center filename desc (target name) " " " ") ++ "\n\n"
+   (center filename desc (target normalized) " " " ") ++ "\n\n"
   where
-    filename = "*" ++ name ++ ".txt*"
+    filename = "*" ++ normalized ++ ".txt*"
+    normalized = map toLower name
     center a b c s1 s2 =
         if | renderedWidth str >= textwidth -> str
            | odd $ renderedWidth str        -> center a b c (s1 ++ " ") s2
index 7f148a2f874a840155b714f2177f848c72a1f35c..03f575d0c323aab3696d079e6c95ee0c9df0ac61 100644 (file)
@@ -1,4 +1,4 @@
-*Pinnacle.txt*           Highlight group manipulation for Vim           *Pinnacle*
+*pinnacle.txt*           Highlight group manipulation for Vim           *pinnacle*
 
 CONTENTS                                                     *pinnacle-contents*
 
diff --git a/tests/fixtures/vim/plugin.golden b/tests/fixtures/vim/plugin.golden
new file mode 100644 (file)
index 0000000..6659d99
--- /dev/null
@@ -0,0 +1,11 @@
+*pinnacle.txt*           Highlight group manipulation for Vim           *pinnacle*
+
+CONTENTS                                                     *pinnacle-contents*
+
+
+
+Note how we can link to |pinnacle.txt| even though the Vim printer doesn't use
+the symbol table.
+
+Also note that case used for the plugin name in the annotation doesn't
+really matter; it will be normalized to lowercase.
diff --git a/tests/fixtures/vim/plugin.vim b/tests/fixtures/vim/plugin.vim
new file mode 100644 (file)
index 0000000..300fcbc
--- /dev/null
@@ -0,0 +1,8 @@
+""
+" @plugin Pinnacle Highlight group manipulation for Vim
+"
+" Note how we can link to |pinnacle.txt| even though the Vim printer doesn't use
+" the symbol table.
+"
+" Also note that case used for the plugin name in the annotation doesn't really
+" matter; it will be normalized to lowercase.