exposed-modules: Text.Docvim.AST
, Text.Docvim.CLI
, Text.Docvim.Compile
+ , Text.Docvim.Optimize
, Text.Docvim.Options
, Text.Docvim.Parse
, Text.Docvim.Printer.Markdown
, temporary
other-modules: Text.Docvim.AST
, Text.Docvim.Compile
+ , Text.Docvim.Optimize
, Text.Docvim.Parse
, Text.Docvim.Printer.Markdown
, Text.Docvim.Printer.Vim
module Text.Docvim.Compile (compile) where
import Text.Docvim.AST
+import Text.Docvim.Optimize
import Text.Docvim.Visitor
import Text.Docvim.Visitor.Command
import Text.Docvim.Visitor.Commands
let (ast9, options) = extract extractOptions ast8
let (ast10, option) = extract extractOption ast9
let (ast11, footer) = extract extractFooter ast10
- injectTOC $ Project $ concat [ plugin
+ optimize $ injectTOC $ Project $ concat [ plugin
, [ast11]
, commands
, command
plugin :: String -> String -> Env
plugin name desc = appendNoWrap $
- (center filename desc (target normalized) " " " ") ++ "\n\n"
+ center filename desc (target normalized) " " " " ++ "\n\n"
where
filename = "*" ++ normalized ++ ".txt*"
normalized = map toLower name
Project
- [ Project [ Unit [ DocBlock [] ] , DocBlock [] ]
+ [ Empty
, CommandsAnnotation
, CommandAnnotation "Ack" (Just "{pattern} {options}")
, Paragraph [ Plaintext "Info." ]
-Project [ Project [ Unit [] ] ]
+Empty
-Project [ Project [ Unit [] ] ]
+Empty
[ ListItem
[ Plaintext "Initial" , Whitespace , Plaintext "release." ]
]
- , Project [ Unit [ DocBlock [] ] ]
+ , Empty
]
Project
[ Project
[ Unit
- [ DocBlock []
+ [ Empty
, LetStatement
{ letLexpr = "s:options"
, letValue = "get(g:, 'FerretQFOptions', 1)"
, GenericStatement "augroup END"
, GenericStatement "endif"
, GenericStatement "endif"
- , DocBlock []
+ , Empty
, LetStatement
{ letLexpr = "s:map" , letValue = "get(g:, 'FerretQFMap', 1)" }
, GenericStatement "if s:map"
"vnoremap <buffer> <silent> d :call ferret#private#qf_delete()<CR>"
, GenericStatement "endif"
]
- , DocBlock []
+ , Empty
]
, OptionsAnnotation
, OptionAnnotation "g:FerretQFOptions" "boolean" (Just "1")
, Fenced [ ":call pathogen#helptags()" ]
, Project
[ Unit
- [ DocBlock []
- , DocBlock []
+ [ Empty
+ , Empty
, GenericStatement
"if exists('g:FerretLoaded') || &compatible || v:version < 700"
, GenericStatement "finish"
, GenericStatement "autocmd QuickFixCmdPost l* nested lwindow"
, GenericStatement "augroup END"
, GenericStatement "endif"
- , DocBlock []
+ , Empty
, GenericStatement
"command! -nargs=+ -complete=file Ack call ferret#private#ack(<q-args>)"
- , DocBlock []
+ , Empty
, GenericStatement
"command! -nargs=+ -complete=file Lack call ferret#private#lack(<q-args>)"
- , DocBlock []
+ , Empty
, GenericStatement
"command! -nargs=1 Acks call ferret#private#acks(<q-args>)"
- , DocBlock []
+ , Empty
, LetStatement
{ letLexpr = "s:map" , letValue = "get(g:, 'FerretMap', 1)" }
, GenericStatement "if s:map"
, GenericStatement
"if !hasmapto('<Plug>(FerretAck)') && maparg('<leader>a', 'n') ==# ''"
- , DocBlock []
+ , Empty
, GenericStatement "nmap <unique> <leader>a <Plug>(FerretAck)"
, GenericStatement "endif"
, GenericStatement "nnoremap <Plug>(FerretAck) :Ack<space>"
, GenericStatement
"if !hasmapto('<Plug>FerretLack') && maparg('<leader>l', 'n') ==# ''"
- , DocBlock []
+ , Empty
, GenericStatement "nmap <unique> <leader>l <Plug>(FerretLack)"
, GenericStatement "endif"
, GenericStatement "nnoremap <Plug>(FerretLack) :Lack<space>"
, GenericStatement
"if !hasmapto('<Plug>(FerretAckWord)') && maparg('<leader>s', 'n') ==# ''"
- , DocBlock []
+ , Empty
, GenericStatement "nmap <unique> <leader>s <Plug>(FerretAckWord)"
, GenericStatement "endif"
, GenericStatement
"nnoremap <Plug>(FerretAckWord) :Ack <C-r><C-w><CR>"
, GenericStatement
"if !hasmapto('<Plug>(FerretAcks)') && maparg('<leader>r', 'n') ==# ''"
- , DocBlock []
+ , Empty
, GenericStatement "nmap <unique> <leader>r <Plug>(FerretAcks)"
, GenericStatement "endif"
, GenericStatement
"nnoremap <Plug>(FerretAcks) :Acks <c-r>=(exists('g:ferret_lastsearch') ? '/' . g:ferret_lastsearch . '//' : ' ')<CR><Left>"
, GenericStatement "endif"
- , DocBlock []
+ , Empty
, GenericStatement
"command! -bar Qargs execute 'args' ferret#private#qargs()"
- , DocBlock []
+ , Empty
, LetStatement
{ letLexpr = "s:commands"
, letValue = "get(g:, 'FerretQFCommands', 1)"
{ letLexpr = "&cpoptions " , letValue = "s:cpoptions" }
, UnletStatement { unletBang = False , unletBody = "s:cpoptions" }
]
- , DocBlock []
- , DocBlock []
+ , Empty
+ , Empty
]
, CommandsAnnotation
, CommandAnnotation "Ack" (Just "{pattern} {options}")
, functionArguments = ArgumentList []
, functionAttributes = []
, functionBody =
- [ DocBlock []
+ [ Empty
, LetStatement
{ letLexpr = "l:dispatch"
, letValue = "get(g:, 'FerretDispatch', 1)"
, functionAttributes = [ "abort" ]
, functionBody =
[ GenericStatement "if has('extra_search')"
- , DocBlock []
+ , Empty
, LetStatement
{ letLexpr = "l:hlsearch"
, letValue = "get(g:, 'FerretHlsearch', &hlsearch)"
]
}
]
- , DocBlock []
+ , Empty
]
, OptionsAnnotation
, OptionAnnotation "g:FerretDispatch" "boolean" (Just "1")
[ ListItem
[ Plaintext "Initial" , Whitespace , Plaintext "release." ]
]
- , Project [ Unit [ DocBlock [] ] ]
+ , Empty
]
-Project [ Project [ Unit [] ] ]
+Empty
Project
- [ DocBlock [ PluginAnnotation "Foo" "Bar" , TOC [] ]
- , Project [ Unit [ DocBlock [] ] ]
- ]
+ [ DocBlock [ PluginAnnotation "Foo" "Bar" , TOC [] ] , Empty ]
[ PluginAnnotation "Foo" "Description with trailing whitespace"
, TOC []
]
- , Project [ Unit [ DocBlock [] ] ]
+ , Empty
]
, Project
[ Unit
[ LetStatement { letLexpr = "g:x" , letValue = "1 \"Unset!" }
- , DocBlock []
+ , Empty
, LetStatement { letLexpr = "g:y" , letValue = "1" }
]
]