parent
5576e66fba
commit
bf7dfc725e
@ -0,0 +1,12 @@
|
||||
let g:netrw_dirhistmax =10
|
||||
let g:netrw_dirhistcnt =0
|
||||
let g:netrw_dirhist_0='/home/diegofcs/.config/qutebrowser'
|
||||
let g:netrw_dirhist_9='/tmp/updates_void'
|
||||
let g:netrw_dirhist_8='/etc/fonts/conf.avail'
|
||||
let g:netrw_dirhist_7='/home/diegofcs/.config/suckless_soft/slstatus'
|
||||
let g:netrw_dirhist_6='/home/diegofcs/.vim/plugged/vimtex'
|
||||
let g:netrw_dirhist_5='/home/diegofcs/.vim/plugged'
|
||||
let g:netrw_dirhist_4='/home/diegofcs/.vim'
|
||||
let g:netrw_dirhist_3='/home/diegofcs/.config/suckless_soft/dmenu'
|
||||
let g:netrw_dirhist_2='/home/diegofcs/.config'
|
||||
let g:netrw_dirhist_1='/home/diegofcs/.config/dwm'
|
@ -0,0 +1,2 @@
|
||||
source 'https://rubygems.org'
|
||||
gem 'vim-flavor', '~> 4.0.1'
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,413 @@
|
||||
" vi:syntax=vim
|
||||
|
||||
" base16-vim (https://github.com/chriskempson/base16-vim)
|
||||
" by Chris Kempson (http://chriskempson.com)
|
||||
" Grayscale Dark scheme by Alexandre Gavioli (https://github.com/Alexx2/)
|
||||
|
||||
" This enables the coresponding base16-shell script to run so that
|
||||
" :colorscheme works in terminals supported by base16-shell scripts
|
||||
" User must set this variable in .vimrc
|
||||
" let g:base16_shell_path=base16-builder/output/shell/
|
||||
if !has("gui_running")
|
||||
if exists("g:base16_shell_path")
|
||||
execute "silent !/bin/sh ".g:base16_shell_path."/base16-grayscale-dark.sh"
|
||||
endif
|
||||
endif
|
||||
|
||||
" GUI color definitions
|
||||
let s:gui00 = "101010"
|
||||
let g:base16_gui00 = "101010"
|
||||
let s:gui01 = "252525"
|
||||
let g:base16_gui01 = "252525"
|
||||
let s:gui02 = "101010"
|
||||
let g:base16_gui02 = "454545"
|
||||
let s:gui03 = "525252"
|
||||
let g:base16_gui03 = "525252"
|
||||
let s:gui04 = "ababab"
|
||||
let g:base16_gui04 = "ababab"
|
||||
let s:gui05 = "b9b9b9"
|
||||
let g:base16_gui05 = "b9b9b9"
|
||||
let s:gui06 = "e3e3e3"
|
||||
let g:base16_gui06 = "e3e3e3"
|
||||
let s:gui07 = "f7f7f7"
|
||||
let g:base16_gui07 = "f7f7f7"
|
||||
let s:gui08 = "7c7c7c"
|
||||
let g:base16_gui08 = "7c7c7c"
|
||||
let s:gui09 = "999999"
|
||||
let g:base16_gui09 = "999999"
|
||||
let s:gui0A = "a0a0a0"
|
||||
let g:base16_gui0A = "a0a0a0"
|
||||
let s:gui0B = "8e8e8e"
|
||||
let g:base16_gui0B = "8e8e8e"
|
||||
let s:gui0C = "868686"
|
||||
let g:base16_gui0C = "868686"
|
||||
let s:gui0D = "686868"
|
||||
let g:base16_gui0D = "686868"
|
||||
let s:gui0E = "747474"
|
||||
let g:base16_gui0E = "747474"
|
||||
let s:gui0F = "5e5e5e"
|
||||
let g:base16_gui0F = "5e5e5e"
|
||||
|
||||
" Terminal color definitions
|
||||
let s:cterm00 = "00"
|
||||
let g:base16_cterm00 = "00"
|
||||
let s:cterm03 = "08"
|
||||
let g:base16_cterm03 = "08"
|
||||
let s:cterm05 = "07"
|
||||
let g:base16_cterm05 = "07"
|
||||
let s:cterm07 = "15"
|
||||
let g:base16_cterm07 = "15"
|
||||
let s:cterm08 = "01"
|
||||
let g:base16_cterm08 = "01"
|
||||
let s:cterm0A = "03"
|
||||
let g:base16_cterm0A = "03"
|
||||
let s:cterm0B = "02"
|
||||
let g:base16_cterm0B = "02"
|
||||
let s:cterm0C = "06"
|
||||
let g:base16_cterm0C = "06"
|
||||
let s:cterm0D = "04"
|
||||
let g:base16_cterm0D = "04"
|
||||
let s:cterm0E = "05"
|
||||
let g:base16_cterm0E = "05"
|
||||
if exists("base16colorspace") && base16colorspace == "256"
|
||||
let s:cterm01 = "18"
|
||||
let g:base16_cterm01 = "18"
|
||||
let s:cterm02 = "19"
|
||||
let g:base16_cterm02 = "19"
|
||||
let s:cterm04 = "20"
|
||||
let g:base16_cterm04 = "20"
|
||||
let s:cterm06 = "21"
|
||||
let g:base16_cterm06 = "21"
|
||||
let s:cterm09 = "16"
|
||||
let g:base16_cterm09 = "16"
|
||||
let s:cterm0F = "17"
|
||||
let g:base16_cterm0F = "17"
|
||||
else
|
||||
let s:cterm01 = "10"
|
||||
let g:base16_cterm01 = "10"
|
||||
let s:cterm02 = "11"
|
||||
let g:base16_cterm02 = "11"
|
||||
let s:cterm04 = "12"
|
||||
let g:base16_cterm04 = "12"
|
||||
let s:cterm06 = "13"
|
||||
let g:base16_cterm06 = "13"
|
||||
let s:cterm09 = "09"
|
||||
let g:base16_cterm09 = "09"
|
||||
let s:cterm0F = "14"
|
||||
let g:base16_cterm0F = "14"
|
||||
endif
|
||||
|
||||
" Neovim terminal colours
|
||||
if has("nvim")
|
||||
let g:terminal_color_0 = "#101010"
|
||||
let g:terminal_color_1 = "#7c7c7c"
|
||||
let g:terminal_color_2 = "#8e8e8e"
|
||||
let g:terminal_color_3 = "#a0a0a0"
|
||||
let g:terminal_color_4 = "#686868"
|
||||
let g:terminal_color_5 = "#747474"
|
||||
let g:terminal_color_6 = "#868686"
|
||||
let g:terminal_color_7 = "#b9b9b9"
|
||||
let g:terminal_color_8 = "#525252"
|
||||
let g:terminal_color_9 = "#7c7c7c"
|
||||
let g:terminal_color_10 = "#8e8e8e"
|
||||
let g:terminal_color_11 = "#a0a0a0"
|
||||
let g:terminal_color_12 = "#686868"
|
||||
let g:terminal_color_13 = "#747474"
|
||||
let g:terminal_color_14 = "#868686"
|
||||
let g:terminal_color_15 = "#f7f7f7"
|
||||
let g:terminal_color_background = g:terminal_color_0
|
||||
let g:terminal_color_foreground = g:terminal_color_5
|
||||
if &background == "light"
|
||||
let g:terminal_color_background = g:terminal_color_7
|
||||
let g:terminal_color_foreground = g:terminal_color_2
|
||||
endif
|
||||
elseif has("terminal")
|
||||
let g:terminal_ansi_colors = [
|
||||
\ "#101010",
|
||||
\ "#7c7c7c",
|
||||
\ "#8e8e8e",
|
||||
\ "#a0a0a0",
|
||||
\ "#686868",
|
||||
\ "#747474",
|
||||
\ "#868686",
|
||||
\ "#b9b9b9",
|
||||
\ "#525252",
|
||||
\ "#7c7c7c",
|
||||
\ "#8e8e8e",
|
||||
\ "#a0a0a0",
|
||||
\ "#686868",
|
||||
\ "#747474",
|
||||
\ "#868686",
|
||||
\ "#f7f7f7",
|
||||
\ ]
|
||||
endif
|
||||
|
||||
" Theme setup
|
||||
hi clear
|
||||
syntax reset
|
||||
let g:colors_name = "base16-grayscale-dark"
|
||||
|
||||
" Highlighting function
|
||||
" Optional variables are attributes and guisp
|
||||
function! g:Base16hi(group, guifg, guibg, ctermfg, ctermbg, ...)
|
||||
let l:attr = get(a:, 1, "")
|
||||
let l:guisp = get(a:, 2, "")
|
||||
|
||||
if a:guifg != ""
|
||||
exec "hi " . a:group . " guifg=#" . a:guifg
|
||||
endif
|
||||
if a:guibg != ""
|
||||
exec "hi " . a:group . " guibg=#" . a:guibg
|
||||
endif
|
||||
if a:ctermfg != ""
|
||||
exec "hi " . a:group . " ctermfg=" . a:ctermfg
|
||||
endif
|
||||
if a:ctermbg != ""
|
||||
exec "hi " . a:group . " ctermbg=" . a:ctermbg
|
||||
endif
|
||||
if l:attr != ""
|
||||
exec "hi " . a:group . " gui=" . l:attr . " cterm=" . l:attr
|
||||
endif
|
||||
if l:guisp != ""
|
||||
exec "hi " . a:group . " guisp=#" . l:guisp
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
fun <sid>hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp)
|
||||
call g:Base16hi(a:group, a:guifg, a:guibg, a:ctermfg, a:ctermbg, a:attr, a:guisp)
|
||||
endfun
|
||||
|
||||
" Vim editor colors
|
||||
call <sid>hi("Normal", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "")
|
||||
call <sid>hi("Bold", "", "", "", "", "bold", "")
|
||||
call <sid>hi("Debug", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("Directory", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("Error", s:gui00, s:gui08, s:cterm00, s:cterm08, "", "")
|
||||
call <sid>hi("ErrorMsg", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "")
|
||||
call <sid>hi("Exception", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("FoldColumn", s:gui0C, s:gui01, s:cterm0C, s:cterm01, "", "")
|
||||
call <sid>hi("Folded", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "")
|
||||
call <sid>hi("IncSearch", s:gui01, s:gui09, s:cterm01, s:cterm09, "none", "")
|
||||
call <sid>hi("Italic", "", "", "", "", "none", "")
|
||||
call <sid>hi("Macro", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("MatchParen", "", s:gui03, "", s:cterm03, "", "")
|
||||
call <sid>hi("ModeMsg", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("MoreMsg", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("Question", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("Search", s:gui01, s:gui0A, s:cterm01, s:cterm0A, "", "")
|
||||
call <sid>hi("Substitute", s:gui01, s:gui0A, s:cterm01, s:cterm0A, "none", "")
|
||||
call <sid>hi("SpecialKey", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("TooLong", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("Underlined", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("Visual", "", s:gui02, "", s:cterm02, "", "")
|
||||
call <sid>hi("VisualNOS", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("WarningMsg", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("WildMenu", s:gui08, s:gui0A, s:cterm08, "", "", "")
|
||||
call <sid>hi("Title", s:gui0D, "", s:cterm0D, "", "none", "")
|
||||
call <sid>hi("Conceal", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "")
|
||||
call <sid>hi("Cursor", s:gui00, s:gui05, s:cterm00, s:cterm05, "", "")
|
||||
call <sid>hi("NonText", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("LineNr", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "")
|
||||
call <sid>hi("SignColumn", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "")
|
||||
call <sid>hi("StatusLine", s:gui04, s:gui02, s:cterm04, s:cterm02, "none", "")
|
||||
call <sid>hi("StatusLineNC", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "")
|
||||
call <sid>hi("VertSplit", s:gui02, s:gui02, s:cterm02, s:cterm02, "none", "")
|
||||
call <sid>hi("ColorColumn", "", s:gui01, "", s:cterm01, "none", "")
|
||||
call <sid>hi("CursorColumn", "", s:gui01, "", s:cterm01, "none", "")
|
||||
call <sid>hi("CursorLine", "", s:gui01, "", s:cterm01, "none", "")
|
||||
call <sid>hi("CursorLineNr", s:gui04, s:gui01, s:cterm04, s:cterm01, "", "")
|
||||
call <sid>hi("QuickFixLine", "", s:gui01, "", s:cterm01, "none", "")
|
||||
call <sid>hi("PMenu", s:gui05, s:gui01, s:cterm05, s:cterm01, "none", "")
|
||||
call <sid>hi("PMenuSel", s:gui01, s:gui05, s:cterm01, s:cterm05, "", "")
|
||||
call <sid>hi("TabLine", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "")
|
||||
call <sid>hi("TabLineFill", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "")
|
||||
call <sid>hi("TabLineSel", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "none", "")
|
||||
|
||||
" Standard syntax highlighting
|
||||
call <sid>hi("Boolean", s:gui09, "", s:cterm09, "", "", "")
|
||||
call <sid>hi("Character", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("Comment", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("Conditional", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("Constant", s:gui09, "", s:cterm09, "", "", "")
|
||||
call <sid>hi("Define", s:gui0E, "", s:cterm0E, "", "none", "")
|
||||
call <sid>hi("Delimiter", s:gui0F, "", s:cterm0F, "", "", "")
|
||||
call <sid>hi("Float", s:gui09, "", s:cterm09, "", "", "")
|
||||
call <sid>hi("Function", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("Identifier", s:gui08, "", s:cterm08, "", "none", "")
|
||||
call <sid>hi("Include", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("Keyword", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("Label", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("Number", s:gui09, "", s:cterm09, "", "", "")
|
||||
call <sid>hi("Operator", s:gui05, "", s:cterm05, "", "none", "")
|
||||
call <sid>hi("PreProc", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("Repeat", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("Special", s:gui0C, "", s:cterm0C, "", "", "")
|
||||
call <sid>hi("SpecialChar", s:gui0F, "", s:cterm0F, "", "", "")
|
||||
call <sid>hi("Statement", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("StorageClass", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("String", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("Structure", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("Tag", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("Todo", s:gui0A, s:gui01, s:cterm0A, s:cterm01, "", "")
|
||||
call <sid>hi("Type", s:gui0A, "", s:cterm0A, "", "none", "")
|
||||
call <sid>hi("Typedef", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
|
||||
" C highlighting
|
||||
call <sid>hi("cOperator", s:gui0C, "", s:cterm0C, "", "", "")
|
||||
call <sid>hi("cPreCondit", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
|
||||
" C# highlighting
|
||||
call <sid>hi("csClass", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("csAttribute", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("csModifier", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("csType", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("csUnspecifiedStatement", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("csContextualStatement", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("csNewDecleration", s:gui08, "", s:cterm08, "", "", "")
|
||||
|
||||
" CSS highlighting
|
||||
call <sid>hi("cssBraces", s:gui05, "", s:cterm05, "", "", "")
|
||||
call <sid>hi("cssClassName", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("cssColor", s:gui0C, "", s:cterm0C, "", "", "")
|
||||
|
||||
" Diff highlighting
|
||||
call <sid>hi("DiffAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "")
|
||||
call <sid>hi("DiffChange", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "")
|
||||
call <sid>hi("DiffDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "")
|
||||
call <sid>hi("DiffText", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "")
|
||||
call <sid>hi("DiffAdded", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "")
|
||||
call <sid>hi("DiffFile", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "")
|
||||
call <sid>hi("DiffNewFile", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "")
|
||||
call <sid>hi("DiffLine", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "")
|
||||
call <sid>hi("DiffRemoved", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "")
|
||||
|
||||
" Git highlighting
|
||||
call <sid>hi("gitcommitOverflow", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("gitcommitSummary", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("gitcommitComment", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("gitcommitUntracked", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("gitcommitDiscarded", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("gitcommitSelected", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("gitcommitHeader", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("gitcommitSelectedType", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("gitcommitUnmergedType", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("gitcommitDiscardedType", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("gitcommitBranch", s:gui09, "", s:cterm09, "", "bold", "")
|
||||
call <sid>hi("gitcommitUntrackedFile", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("gitcommitUnmergedFile", s:gui08, "", s:cterm08, "", "bold", "")
|
||||
call <sid>hi("gitcommitDiscardedFile", s:gui08, "", s:cterm08, "", "bold", "")
|
||||
call <sid>hi("gitcommitSelectedFile", s:gui0B, "", s:cterm0B, "", "bold", "")
|
||||
|
||||
" GitGutter highlighting
|
||||
call <sid>hi("GitGutterAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "")
|
||||
call <sid>hi("GitGutterChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "")
|
||||
call <sid>hi("GitGutterDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "")
|
||||
call <sid>hi("GitGutterChangeDelete", s:gui0E, s:gui01, s:cterm0E, s:cterm01, "", "")
|
||||
|
||||
" HTML highlighting
|
||||
call <sid>hi("htmlBold", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("htmlItalic", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("htmlEndTag", s:gui05, "", s:cterm05, "", "", "")
|
||||
call <sid>hi("htmlTag", s:gui05, "", s:cterm05, "", "", "")
|
||||
|
||||
" JavaScript highlighting
|
||||
call <sid>hi("javaScript", s:gui05, "", s:cterm05, "", "", "")
|
||||
call <sid>hi("javaScriptBraces", s:gui05, "", s:cterm05, "", "", "")
|
||||
call <sid>hi("javaScriptNumber", s:gui09, "", s:cterm09, "", "", "")
|
||||
" pangloss/vim-javascript highlighting
|
||||
call <sid>hi("jsOperator", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("jsStatement", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("jsReturn", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("jsThis", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("jsClassDefinition", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("jsFunction", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("jsFuncName", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("jsFuncCall", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("jsClassFuncName", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("jsClassMethodType", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("jsRegexpString", s:gui0C, "", s:cterm0C, "", "", "")
|
||||
call <sid>hi("jsGlobalObjects", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("jsGlobalNodeObjects", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("jsExceptions", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("jsBuiltins", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
|
||||
" Mail highlighting
|
||||
call <sid>hi("mailQuoted1", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("mailQuoted2", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("mailQuoted3", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("mailQuoted4", s:gui0C, "", s:cterm0C, "", "", "")
|
||||
call <sid>hi("mailQuoted5", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("mailQuoted6", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("mailURL", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("mailEmail", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
|
||||
" Markdown highlighting
|
||||
call <sid>hi("markdownCode", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("markdownError", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "")
|
||||
call <sid>hi("markdownCodeBlock", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("markdownHeadingDelimiter", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
|
||||
" NERDTree highlighting
|
||||
call <sid>hi("NERDTreeDirSlash", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("NERDTreeExecFile", s:gui05, "", s:cterm05, "", "", "")
|
||||
|
||||
" PHP highlighting
|
||||
call <sid>hi("phpMemberSelector", s:gui05, "", s:cterm05, "", "", "")
|
||||
call <sid>hi("phpComparison", s:gui05, "", s:cterm05, "", "", "")
|
||||
call <sid>hi("phpParent", s:gui05, "", s:cterm05, "", "", "")
|
||||
call <sid>hi("phpMethodsVar", s:gui0C, "", s:cterm0C, "", "", "")
|
||||
|
||||
" Python highlighting
|
||||
call <sid>hi("pythonOperator", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("pythonRepeat", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("pythonInclude", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("pythonStatement", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
|
||||
" Ruby highlighting
|
||||
call <sid>hi("rubyAttribute", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
call <sid>hi("rubyConstant", s:gui0A, "", s:cterm0A, "", "", "")
|
||||
call <sid>hi("rubyInterpolationDelimiter", s:gui0F, "", s:cterm0F, "", "", "")
|
||||
call <sid>hi("rubyRegexp", s:gui0C, "", s:cterm0C, "", "", "")
|
||||
call <sid>hi("rubySymbol", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("rubyStringDelimiter", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
|
||||
" SASS highlighting
|
||||
call <sid>hi("sassidChar", s:gui08, "", s:cterm08, "", "", "")
|
||||
call <sid>hi("sassClassChar", s:gui09, "", s:cterm09, "", "", "")
|
||||
call <sid>hi("sassInclude", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("sassMixing", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("sassMixinName", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
|
||||
" Signify highlighting
|
||||
call <sid>hi("SignifySignAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "")
|
||||
call <sid>hi("SignifySignChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "")
|
||||
call <sid>hi("SignifySignDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "")
|
||||
|
||||
" Spelling highlighting
|
||||
call <sid>hi("SpellBad", "", "", "", "", "undercurl", s:gui08)
|
||||
call <sid>hi("SpellLocal", "", "", "", "", "undercurl", s:gui0C)
|
||||
call <sid>hi("SpellCap", "", "", "", "", "undercurl", s:gui0D)
|
||||
call <sid>hi("SpellRare", "", "", "", "", "undercurl", s:gui0E)
|
||||
|
||||
" Startify highlighting
|
||||
call <sid>hi("StartifyBracket", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("StartifyFile", s:gui07, "", s:cterm07, "", "", "")
|
||||
call <sid>hi("StartifyFooter", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("StartifyHeader", s:gui0B, "", s:cterm0B, "", "", "")
|
||||
call <sid>hi("StartifyNumber", s:gui09, "", s:cterm09, "", "", "")
|
||||
call <sid>hi("StartifyPath", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("StartifySection", s:gui0E, "", s:cterm0E, "", "", "")
|
||||
call <sid>hi("StartifySelect", s:gui0C, "", s:cterm0C, "", "", "")
|
||||
call <sid>hi("StartifySlash", s:gui03, "", s:cterm03, "", "", "")
|
||||
call <sid>hi("StartifySpecial", s:gui03, "", s:cterm03, "", "", "")
|
||||
|
||||
" Java highlighting
|
||||
call <sid>hi("javaOperator", s:gui0D, "", s:cterm0D, "", "", "")
|
||||
|
||||
" Remove functions
|
||||
delf <sid>hi
|
||||
|
||||
" Remove color variables
|
||||
unlet s:gui00 s:gui01 s:gui02 s:gui03 s:gui04 s:gui05 s:gui06 s:gui07 s:gui08 s:gui09 s:gui0A s:gui0B s:gui0C s:gui0D s:gui0E s:gui0F
|
||||
unlet s:cterm00 s:cterm01 s:cterm02 s:cterm03 s:cterm04 s:cterm05 s:cterm06 s:cterm07 s:cterm08 s:cterm09 s:cterm0A s:cterm0B s:cterm0C s:cterm0D s:cterm0E s:cterm0F
|
@ -0,0 +1,412 @@
|
||||
" File: tex.vim
|
||||
" Type: compiler plugin for LaTeX
|
||||
" Original Author: Artem Chuprina <ran@ran.pp.ru>
|
||||
" Customization: Srinath Avadhanula <srinath@fastmail.fm>
|
||||
" Description: {{{
|
||||
" This file sets the 'makeprg' and 'errorformat' options for the LaTeX
|
||||
" compiler. It is customizable to optionally ignore certain warnings and
|
||||
" provides the ability to set a dynamic 'ignore-warning' level.
|
||||
"
|
||||
" By default it is set up in a 'non-verbose', 'ignore-common-warnings' mode,
|
||||
" which means that irrelevant lines from the compilers output will be
|
||||
" ignored and also some very common warnings are ignored.
|
||||
"
|
||||
" Depending on the 'ignore-level', the following kinds of messages are
|
||||
" ignored. An ignore level of 3 for instance means that messages 1-3 will be
|
||||
" ignored. By default, the ignore level is set to 4.
|
||||
"
|
||||
" 1. LaTeX Warning: Specifier 'h' changed to 't'.
|
||||
" This errors occurs when TeX is not able to correctly place a floating
|
||||
" object at a specified location, because of which it defaulted to the
|
||||
" top of the page.
|
||||
" 2. LaTeX Warning: Underfull box ...
|
||||
" 3. LaTeX Warning: Overfull box ...
|
||||
" both these warnings (very common) are due to \hbox settings not being
|
||||
" satisfied nicely.
|
||||
" 4. LaTeX Warning: You have requested ...,
|
||||
" This warning occurs in slitex when using the xypic package.
|
||||
" 5. Missing number error:
|
||||
" Usually, when the name of an included eps file is spelled incorrectly,
|
||||
" then the \bb-error message is accompanied by a bunch of "missing
|
||||
" number, treated as zero" error messages. This level ignores these
|
||||
" warnings.
|
||||
" NOTE: number 5 is actually a latex error, not a warning!
|
||||
"
|
||||
" Use
|
||||
" TCLevel <level>
|
||||
" where level is a number to set the ignore level dynamically.
|
||||
"
|
||||
" When TCLevel is called with the unquoted string strict
|
||||
" TClevel strict
|
||||
" then the 'efm' switches to a 'verbose', 'no-lines-ignored' mode which is
|
||||
" useful when you want to make final checks of your document and want to be
|
||||
" careful not to let things slip by.
|
||||
"
|
||||
" TIP: MikTeX has a bug where it sometimes erroneously splits a line number
|
||||
" into multiple lines. i.e, if the warning is on line 1234. the compiler
|
||||
" output is:
|
||||
" LaTeX Warning: ... on input line 123
|
||||
" 4.
|
||||
" In this case, vim will wrongly interpret the line-number as 123 instead
|
||||
" of 1234. If you have cygwin, a simple remedy around this is to first
|
||||
" copy the file vimlatex (provided) into your $PATH, make sure its
|
||||
" executable and then set the variable g:tex_flavor to vimlatex in your
|
||||
" ~/.vimrc (i.e putting let "g:tex_flavor = 'vimlatex'" in your .vimrc).
|
||||
" This problem occurs rarely enough that its not a botheration for most
|
||||
" people.
|
||||
"
|
||||
" TODO:
|
||||
" 1. menu items for dynamically selecting a ignore warning level.
|
||||
" }}}
|
||||
|
||||
if exists('b:suppress_latex_suite') && b:suppress_latex_suite == 1
|
||||
finish
|
||||
endif
|
||||
|
||||
" avoid reinclusion for the same buffer. keep it buffer local so it can be
|
||||
" externally reset in case of emergency re-sourcing.
|
||||
if exists('b:doneTexCompiler') && !exists('b:forceRedoTexCompiler')
|
||||
finish
|
||||
endif
|
||||
let b:doneTexCompiler = 1
|
||||
|
||||
" ==============================================================================
|
||||
" Customization of 'efm': {{{
|
||||
" This section contains the customization variables which the user can set.
|
||||
" g:Tex_IgnoredWarnings: This variable contains a ยก seperated list of
|
||||
" patterns which will be ignored in the TeX compiler's output. Use this
|
||||
" carefully, otherwise you might end up losing valuable information.
|
||||
if !exists('g:Tex_IgnoredWarnings')
|
||||
let g:Tex_IgnoredWarnings =
|
||||
\'Underfull'."\n".
|
||||
\'Overfull'."\n".
|
||||
\'specifier changed to'."\n".
|
||||
\'You have requested'."\n".
|
||||
\'Missing number, treated as zero.'."\n".
|
||||
\'There were undefined references'."\n".
|
||||
\'Citation %.%# undefined'
|
||||
endif
|
||||
" This is the number of warnings in the g:Tex_IgnoredWarnings string which
|
||||
" will be ignored.
|
||||
if !exists('g:Tex_IgnoreLevel')
|
||||
let g:Tex_IgnoreLevel = 7
|
||||
endif
|
||||
" There will be lots of stuff in a typical compiler output which will
|
||||
" completely fall through the 'efm' parsing. This options sets whether or not
|
||||
" you will be shown those lines.
|
||||
if !exists('g:Tex_IgnoreUnmatched')
|
||||
let g:Tex_IgnoreUnmatched = 1
|
||||
endif
|
||||
" With all this customization, there is a slight risk that you might be
|
||||
" ignoring valid warnings or errors. Therefore before getting the final copy
|
||||
" of your work, you might want to reset the 'efm' with this variable set to 1.
|
||||
" With that value, all the lines from the compiler are shown irrespective of
|
||||
" whether they match the error or warning patterns.
|
||||
" NOTE: An easier way of resetting the 'efm' to show everything is to do
|
||||
" TCLevel strict
|
||||
if !exists('g:Tex_ShowallLines')
|
||||
let g:Tex_ShowallLines = 0
|
||||
endif
|
||||
|
||||
" }}}
|
||||
" ==============================================================================
|
||||
" Customization of 'makeprg': {{{
|
||||
|
||||
" There are several alternate ways in which 'makeprg' is set up.
|
||||
"
|
||||
" Case 1
|
||||
" ------
|
||||
" The first is when this file is a part of latex-suite. In this case, a
|
||||
" variable called g:Tex_DefaultTargetFormat exists, which gives the default
|
||||
" format .tex files should be compiled into. In this case, we use the TTarget
|
||||
" command provided by latex-suite.
|
||||
"
|
||||
" Case 2
|
||||
" ------
|
||||
" The user is using this file without latex-suite AND he wants to directly
|
||||
" specify the complete 'makeprg'. Then he should set the g:Tex_CompileRule_dvi
|
||||
" variable. This is a string which should be directly be able to be cast into
|
||||
" &makeprg. An example of one such string is:
|
||||
"
|
||||
" g:Tex_CompileRule_dvi = 'pdflatex \\nonstopmode \\input\{$*\}'
|
||||
"
|
||||
" NOTE: You will need to escape back-slashes, {'s etc yourself if you are
|
||||
" using this file independently of latex-suite.
|
||||
" TODO: Should we also have a check for backslash escaping here based on
|
||||
" platform?
|
||||
"
|
||||
" Case 3
|
||||
" ------
|
||||
" The use is using this file without latex-suite and he doesnt want any
|
||||
" customization. In this case, this file makes some intelligent guesses based
|
||||
" on the platform. If he doesn't want to specify the complete 'makeprg' but
|
||||
" only the name of the compiler program (for example 'pdflatex' or 'latex'),
|
||||
" then he sets b:tex_flavor or g:tex_flavor.
|
||||
|
||||
if exists('g:Tex_DefaultTargetFormat')
|
||||
exec 'TTarget '.g:Tex_DefaultTargetFormat
|
||||
elseif exists('g:Tex_CompileRule_dvi')
|
||||
let &l:makeprg = g:Tex_CompileRule_dvi
|
||||
else
|
||||
" If buffer-local variable 'tex_flavor' exists, it defines TeX flavor,
|
||||
" otherwize the same for global variable with same name, else it will be LaTeX
|
||||
if exists("b:tex_flavor")
|
||||
let current_compiler = b:tex_flavor
|
||||
elseif exists("g:tex_flavor")
|
||||
let current_compiler = g:tex_flavor
|
||||
else
|
||||
let current_compiler = "latex"
|
||||
end
|
||||
if has('win32')
|
||||
let escChars = ''
|
||||
else
|
||||
let escChars = '{}\'
|
||||
endif
|
||||
" Furthermore, if 'win32' is detected, then we want to set the arguments up so
|
||||
" that miktex can handle it.
|
||||
if has('win32')
|
||||
let options = '--src-specials'
|
||||
else
|
||||
let options = ''
|
||||
endif
|
||||
let &l:makeprg = current_compiler . ' ' . options .
|
||||
\ escape(' \nonstopmode \input{$*}', escChars)
|
||||
endif
|
||||
|
||||
" }}}
|
||||
" ==============================================================================
|
||||
" Functions for setting up a customized 'efm' {{{
|
||||
|
||||
" IgnoreWarnings: parses g:Tex_IgnoredWarnings for message customization {{{
|
||||
" Description:
|
||||
function! <SID>IgnoreWarnings()
|
||||
let s:Ignored_Overfull = 0
|
||||
|
||||
let i = 1
|
||||
while s:Strntok(g:Tex_IgnoredWarnings, "\n", i) != '' &&
|
||||
\ i <= g:Tex_IgnoreLevel
|
||||
let warningPat = s:Strntok(g:Tex_IgnoredWarnings, "\n", i)
|
||||
let warningPat = escape(substitute(warningPat, '[\,]', '%\\\\&', 'g'), ' ')
|
||||
|
||||
if warningPat =~? 'overfull'
|
||||
let s:Ignored_Overfull = 1
|
||||
if ( v:version > 800 || v:version == 800 && has("patch26") )
|
||||
" Overfull warnings are ignored as 'warnings'. Therefore, we can gobble
|
||||
" some of the following lines with %-C (see below)
|
||||
exe 'setlocal efm+=%-W%.%#'.warningPat.'%.%#'
|
||||
else
|
||||
exe 'setlocal efm+=%-G%.%#'.warningPat.'%.%#'
|
||||
endif
|
||||
else
|
||||
exe 'setlocal efm+=%-G%.%#'.warningPat.'%.%#'
|
||||
endif
|
||||
|
||||
let i = i + 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
" SetLatexEfm: sets the 'efm' for the latex compiler {{{
|
||||
" Description:
|
||||
function! <SID>SetLatexEfm()
|
||||
|
||||
let pm = ( g:Tex_ShowallLines == 1 ? '+' : '-' )
|
||||
|
||||
" Add a dummy entry to overwrite the global setting.
|
||||
setlocal efm=dummy_value
|
||||
|
||||
if !g:Tex_ShowallLines
|
||||
call s:IgnoreWarnings()
|
||||
endif
|
||||
|
||||
setlocal efm+=%E!\ LaTeX\ %trror:\ %m
|
||||
setlocal efm+=%E!\ %m
|
||||
setlocal efm+=%E%f:%l:\ %m
|
||||
|
||||
" If we do not ignore 'overfull \hbox' messages, we care for them to get the
|
||||
" line number.
|
||||
if s:Ignored_Overfull == 0
|
||||
setlocal efm+=%+WOverfull\ %mat\ lines\ %l--%*\\d
|
||||
setlocal efm+=%+WOverfull\ %mat\ line\ %l
|
||||
endif
|
||||
|
||||
" Add some generic warnings
|
||||
setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
|
||||
setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d
|
||||
setlocal efm+=%+WLaTeX\ %.%#Warning:\ %m
|
||||
setlocal efm+=%+WPackage\ %.%#Warning:\ %m
|
||||
|
||||
" 'Overfull \hbox' messages are ended by:
|
||||
exec 'setlocal efm+=%'.pm.'Z\ []'
|
||||
|
||||
" Empty line ends multi-line messages
|
||||
setlocal efm+=%-Z
|
||||
|
||||
exec 'setlocal efm+=%'.pm.'C(%.%#)\ %#%m\ on\ input\ line\ %l.'
|
||||
exec 'setlocal efm+=%'.pm.'C(%.%#)\ %#%m'
|
||||
|
||||
exec 'setlocal efm+=%'.pm.'Cl.%l\ %m'
|
||||
exec 'setlocal efm+=%'.pm.'Cl.%l\ '
|
||||
exec 'setlocal efm+=%'.pm.'C\ \ %m'
|
||||
exec 'setlocal efm+=%'.pm.'C%.%#-%.%#'
|
||||
exec 'setlocal efm+=%'.pm.'C%.%#[]%.%#'
|
||||
exec 'setlocal efm+=%'.pm.'C[]%.%#'
|
||||
exec 'setlocal efm+=%'.pm.'C%.%#%[{}\\]%.%#'
|
||||
exec 'setlocal efm+=%'.pm.'C<%.%#>%m'
|
||||
exec 'setlocal efm+=%'.pm.'C\ \ %m'
|
||||
exec 'setlocal efm+=%'.pm.'GSee\ the\ LaTeX%m'
|
||||
exec 'setlocal efm+=%'.pm.'GType\ \ H\ <return>%m'
|
||||
exec 'setlocal efm+=%'.pm.'G\ ...%.%#'
|
||||
exec 'setlocal efm+=%'.pm.'G%.%#\ (C)\ %.%#'
|
||||
exec 'setlocal efm+=%'.pm.'G(see\ the\ transcript%.%#)'
|
||||
exec 'setlocal efm+=%'.pm.'G\\s%#'
|
||||
|
||||
" After a 'overfull \hbox' message, there is some garbage from the input.
|
||||
" We try to match it, such that parenthesis in this garbage does not
|
||||
" confuse the OPQ-patterns below.
|
||||
" Every line continues a multiline pattern (hopefully a 'overfull \hbox'
|
||||
" message).
|
||||
" Due to a bug in old versions of vim, this cannot be used if we ignore the
|
||||
" 'overfull \hbox' messages, see vim/vim#1126.
|
||||
if s:Ignored_Overfull == 0 || ( v:version > 800 || v:version == 800 && has("patch26") )
|
||||
exec 'setlocal efm+=%'.pm.'C%.%#'
|
||||
endif
|
||||
|
||||
" Now, we try to trace the used files.
|
||||
"
|
||||
" In principle, the following combinations could arise in the LaTeX logs:
|
||||
"
|
||||
" )* \((%f)\)* (%f
|
||||
" [Close files, skip some files, open a file]
|
||||
"
|
||||
" (%f))*
|
||||
" [Skip some files, close some files]
|
||||
"
|
||||
" And you will find many more awkward combinations...
|
||||
"
|
||||
" Even something like this is possible:
|
||||
" [18] [19] [20] (./bla.bbl [21])
|
||||
"
|
||||
" After a %[OPQ] is matched, the %r part is passed to the same and
|
||||
" following patterns. Hence, we have to add many $[OPQ]-patterns.
|
||||
"
|
||||
" If you use vim to compile your documents, you might want to use
|
||||
" :let $max_print_line=1024
|
||||
" such that latex will not wrap the filenames. Otherwise, you could use it
|
||||
" as an environment variable or simply use
|
||||
" max_print_line=1024 pdflatex ...
|
||||
" in your terminal. If you are using latexmk, you should set
|
||||
" $ENV{'max_print_line'} = '1024';
|
||||
" $log_wrap = $ENV{'max_print_line'};
|
||||
" in your ~/.latexmkrc
|
||||
|
||||
" The first pattern is needed to match lines like
|
||||
" '[10] [11] (some_file.txt)',
|
||||
" where the first number correspond to an output page in the document
|
||||
exec 'setlocal efm+=%'.pm.'O[%*\\d]%r'
|
||||
|
||||
" Some close patters
|
||||
exec 'setlocal efm+=%'.pm.'Q\ %#)%r'
|
||||
exec 'setlocal efm+=%'.pm.'Q\ %#[%\\d%*[^()])%r'
|
||||
" The next pattern is needed to match lines like
|
||||
" ' ])',
|
||||
exec 'setlocal efm+=%'.pm.'Q\ %#])%r'
|
||||
|
||||
" Skip pattern
|
||||
exec 'setlocal efm+=%'.pm.'O(%f)%r'
|
||||
|
||||
" Some openings
|
||||
exec 'setlocal efm+=%'.pm.'P(%f%r'
|
||||
exec 'setlocal efm+=%'.pm.'P%*[^()](%f%r'
|
||||
exec 'setlocal efm+=%'.pm.'P(%f%*[^()]'
|
||||
exec 'setlocal efm+=%'.pm.'P[%\\d%[^()]%#(%f%r'
|
||||
|
||||
|
||||
" Now, the sledgehammer to cope with awkward endless combinations (did you
|
||||
" ever tried tikz/pgf?)
|
||||
" We have to build up the string first, otherwise we cannot append it with
|
||||
" '+='.
|
||||
let PQO = '%'.pm.'P(%f%r,%'.pm.'Q)%r,%'.pm.'O(%f)%r,%'.pm.'O[%*\\d]%r'
|
||||
let PQOs = PQO
|
||||
for xxx in range(3)
|
||||
let PQOs .= ',' . PQO
|
||||
endfor
|
||||
exec 'setlocal efm+=' . PQOs
|
||||
|
||||
" Finally, there are some lonely page numbers after all the patterns.
|
||||
exec 'setlocal efm+=%'.pm.'O[%*\\d'
|
||||
|
||||
" This gobbles some entries consisting only of whitespace, in fact, it
|
||||
" matches the empty line.
|
||||
" See https://github.com/vim/vim/issues/807
|
||||
exec 'setlocal efm+=%'.pm.'O'
|
||||
|
||||
if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines
|
||||
" Ignore all lines which are unmatched so far.
|
||||
setlocal efm+=%-G%.%#
|
||||
" Sometimes, there is some garbage after a ')'
|
||||
setlocal efm+=%-O%.%#
|
||||
endif
|
||||
|
||||
" Finally, remove the dummy entry.
|
||||
setlocal efm-=dummy_value
|
||||
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
" Strntok: extract the n^th token from a list {{{
|
||||
" example: Strntok('1,23,3', ',', 2) = 23
|
||||
fun! <SID>Strntok(s, tok, n)
|
||||
return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}')
|
||||
endfun
|
||||
|
||||
" }}}
|
||||
" SetTexCompilerLevel: sets the "level" for the latex compiler {{{
|
||||
function! <SID>SetTexCompilerLevel(...)
|
||||
if a:0 > 0
|
||||
let level = a:1
|
||||
else
|
||||
call Tex_ResetIncrementNumber(0)
|
||||
echo substitute(g:Tex_IgnoredWarnings,
|
||||
\ '^\|\n\zs\S', '\=Tex_IncrementNumber(1)." ".submatch(0)', 'g')
|
||||
let level = input("\nChoose an ignore level: ")
|
||||
if level == ''
|
||||
return
|
||||
endif
|
||||
endif
|
||||
if level == 'strict'
|
||||
let g:Tex_ShowallLines = 1
|
||||
elseif level =~ '^\d\+$'
|
||||
let g:Tex_ShowallLines = 0
|
||||
let g:Tex_IgnoreLevel = level
|
||||
else
|
||||
echoerr "SetTexCompilerLevel: Unkwown option [".level."]"
|
||||
end
|
||||
call s:SetLatexEfm()
|
||||
endfunction
|
||||
|
||||
com! -nargs=? TCLevel :call <SID>SetTexCompilerLevel(<f-args>)
|
||||
" }}}
|
||||
|
||||
" }}}
|
||||
" ==============================================================================
|
||||
|
||||
call s:SetLatexEfm()
|
||||
|
||||
" Set the errorfile if not already set by somebody else
|
||||
if &errorfile ==# '' || &errorfile ==# 'errors.err'
|
||||
try
|
||||
execute 'set errorfile=' . fnameescape(Tex_GetMainFileName(':p:r') . '.log')
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
|
||||
|
||||
if !exists('*Tex_Debug')
|
||||
function! Tex_Debug(...)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
call Tex_Debug("compiler/tex.vim: sourcing this file", "comp")
|
||||
|
||||
" vim:fdm=marker:ff=unix:noet:ts=4:sw=4
|
@ -0,0 +1,62 @@
|
||||
projects = latex-suite latex-suite-quickstart
|
||||
htmlfiles = $(addsuffix .html, $(projects))
|
||||
txtfiles = $(addsuffix .txt, $(projects))
|
||||
cssfiles = $(addsuffix .css, $(projects))
|
||||
all = $(projects) $(htmlfiles) $(cssfiles) $(txtfiles)
|
||||
|
||||
|
||||
xsltproc=xsltproc
|
||||
db2vim=db2vim/db2vim
|
||||
|
||||
# Use for debugging:
|
||||
#xsltproc=strace -e trace=file xsltproc --nonet --load-trace
|
||||
# export XML_DEBUG_CATALOG = 1
|
||||
|
||||
# Specify local catalog to not use system installed dtd/xsl files
|
||||
# export XML_CATALOG_FILES=catalog.xml
|
||||
|
||||
# User configuration of this Makefile goes into Makefile.local
|
||||
# E.g. to use a catalog file installed by the user.
|
||||
-include Makefile.local
|
||||
|
||||
# Default Target is to create all documentation files
|
||||
all: $(all)
|
||||
|
||||
# create multi page html (chunk xhtml)
|
||||
$(projects): %: %.xml latex-suite-chunk.xsl latex-suite-common.xsl
|
||||
$(xsltproc) -o $@/ latex-suite-chunk.xsl $<
|
||||
|
||||
# create single html files
|
||||
$(htmlfiles): %.html: %.xml latex-suite.xsl latex-suite-common.xsl
|
||||
$(xsltproc) -o $@ latex-suite.xsl $<
|
||||
|
||||
# create vim flat files
|
||||
latex-suite.txt: %.txt: %.xml
|
||||
$(db2vim) --prefix=ls_ $< > $@
|
||||
|
||||
latex-suite-quickstart.txt: %.txt: %.xml
|
||||
$(db2vim) --prefix=lq_ $< > $@
|
||||
|
||||
# validate xml
|
||||
validate:
|
||||
for file in *.xml; do \
|
||||
xmllint --valid --noout $$file; \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f $(htmlfiles)
|
||||
rm -rf $(projects)
|
||||
|
||||
# $(txtfiles) are currently in revision control, therefore they are not
|
||||
# removed in the clean target
|
||||
mr-proper: clean
|
||||
rm -f $(txtfiles)
|
||||
|
||||
upload: $(all)
|
||||
# vim-latex-web is configured in ~/.ssh/config
|
||||
#Host vim-latex-web
|
||||
# Hostname web.sourceforge.net
|
||||
# User SOURCEFORGE_USERNAME,vim-latex
|
||||
rsync --perms --chmod g+w,o-w --delete -lrtvz $(all) vim-latex-web:/home/groups/v/vi/vim-latex/htdocs/documentation/
|
||||
|
||||
# vim:nowrap
|
@ -0,0 +1,29 @@
|
||||
# Manual files
|
||||
ls-flat:
|
||||
java com.icl.saxon.StyleSheet latex-suite.xml latex-suite.xsl > latex-suite.html
|
||||
|
||||
ls-chunk:
|
||||
( \
|
||||
cd latex-suite && \
|
||||
java com.icl.saxon.StyleSheet ../latex-suite.xml ../latex-suite-chunk.xsl \
|
||||
)
|
||||
|
||||
ls-txt:
|
||||
db2vim --prefix=ls_ latex-suite.xml > latex-suite.txt
|
||||
|
||||
# Quickstart files
|
||||
lsq-flat:
|
||||
java com.icl.saxon.StyleSheet latex-suite-quickstart.xml latex-suite.xsl > latex-suite-quickstart.html
|
||||
|
||||
lsq-chunk:
|
||||
( \
|
||||
cd latex-suite-quickstart && \
|
||||
java com.icl.saxon.StyleSheet ../latex-suite-quickstart.xml ../latex-suite-chunk.xsl \
|
||||
)
|
||||
|
||||
lsq-txt:
|
||||
db2vim --prefix=lq_ latex-suite-quickstart.xml > latex-suite-quickstart.txt
|
||||
|
||||
cvsci:
|
||||
cvs ci latex-suite.xml latex-suite.txt
|
||||
# vim:nowrap
|
@ -0,0 +1,110 @@
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
This file is outdated, please look at README.new for updated information
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
====================================
|
||||
Generating Latex-Suite documentation
|
||||
====================================
|
||||
|
||||
In order to generate the html files and vim-help files from the XML source,
|
||||
you will need to do follow the following steps. The steps are complex only
|
||||
for a windows machine. On most (modern) linux machines, the various
|
||||
utilities are already installed and all you need to do is some
|
||||
soft-linking.
|
||||
|
||||
1. Download the Docbook XSL stylesheets from
|
||||
|
||||
http://sourceforge.net/project/showfiles.php?group_id=21935
|
||||
|
||||
I downloaded docbook-xsl-1.61.2.tar.gz. Unpack this archive under the
|
||||
present directory. You should see something like::
|
||||
|
||||
./docbook-xsl-1.XX.X/
|
||||
|
||||
Rename this to::
|
||||
|
||||
./docbook-xsl
|
||||
|
||||
Alternatively, if you are on a modern unix system, the docbook-xsl
|
||||
stylesheets should already be installed on your system. Soft-linking
|
||||
will thus work more simply. On a typical Debian box, just do::
|
||||
|
||||
ln -s /usr/share/sgml/docbook/stylesheet/xsl/nwalsh docbook-xsl
|
||||
|
||||
The docbook-xsl stylesheets can be installed via the docbook-xsl
|
||||
package on Debian. (Just use apt-get).
|
||||
|
||||
2. Download the Docbook DTD from
|
||||
|
||||
http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip
|
||||
|
||||
Extract this into a subdirectory ``docbook-xml/`` under the present
|
||||
directory. You should see something like::
|
||||
|
||||
./docbook-xml/
|
||||
|
||||
with a file ``docbookx.dtd`` located there.
|
||||
|
||||
**CAUTION**:
|
||||
The archive above does not create a top level directory but
|
||||
unzips directly into the present directory. Therefore, make sure to
|
||||
run the unzip by first creating ``./docbook-xml/``, copying the zip
|
||||
file there and then unzipping.
|
||||
|
||||
Alternatively, if you are on a modern unix system, the docbook-xml DTD
|
||||
will already be installed. Softlinking will thus work. On a typical
|
||||
Debian box, you could do::
|
||||
|
||||
ln -s /usr/share/sgml/docbook/dtd/xml/4.2 docbook-xml
|
||||
|
||||
On debian, you need the docbook-xml package on Debian. (Just use
|
||||
apt-get).
|
||||
|
||||
3. Download saxon.jar from
|
||||
|
||||
http://vim-latex.sourceforge.net/documentation/saxon.jar
|
||||
|
||||
This is the bare .jar file without any of the other things which saxon
|
||||
comes with. Add the ``saxon.jar`` file to your ``$CLASSPATH`` setting.
|
||||
|
||||
**NOTE:**
|
||||
The ``$CLASSPATH`` setting should point to the ``saxon.jar`` file,
|
||||
not the directory where it resides.
|
||||
|
||||
Again, on a unix system, you might not need to download this. For debian
|
||||
systems, the saxon.jar file resides in::
|
||||
|
||||
/usr/share/java/saxon.jar
|
||||
|
||||
You can point your ``$CLASSPATH`` to that file.
|
||||
|
||||
4. Download db2vim (created by me :)) via anonymous cvs::
|
||||
|
||||
mkdir -p ~/bin/db2vim
|
||||
cvs -d :pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex \
|
||||
co -d ~/bin/db2vim db2vim
|
||||
|
||||
Add the ``~/bin/db2vim/`` directory thus created to your ``$PATH``
|
||||
setting.
|
||||
|
||||
5. Create a new directory ``latex-suite/`` under the present directory for
|
||||
the chunked html files to reside in. You should see something like::
|
||||
|
||||
./latex-suite/
|
||||
|
||||
6. Copy ``Makefile.in`` to ``Makefile`` or ``makefile`` and perform any
|
||||
necessary customizations. For example, if you are using Activestate
|
||||
python under windows, you will need to change the ls-txt: target as::
|
||||
|
||||
python e:/srinath/testing/db2vim/db2vim latex-suite.xml > latex-suite.txt
|
||||
|
||||
|
||||
Thats it! You are ready. Now you can do::
|
||||
|
||||
make ls-chunk
|
||||
make ls-flat
|
||||
make ls-txt
|
||||
|
||||
to create the 3 formats.
|
||||
|
||||
Author: Srinath Avadhanula <srinath@fastmail.fm>
|
@ -0,0 +1,25 @@
|
||||
====================================
|
||||
Generating Latex-Suite documentation
|
||||
====================================
|
||||
|
||||
You need:
|
||||
- xsltproc
|
||||
- Docbook XSL stylesheets (*)
|
||||
- Docbook DTD (*)
|
||||
|
||||
(*) These files will be downloaded every time you create the documentation,
|
||||
unless you install or download them.
|
||||
|
||||
To install the required packages, you can run as root on
|
||||
|
||||
Fedora:
|
||||
|
||||
yum install libxslt docbook-style-xsl docbook-dtds
|
||||
|
||||
Arch Linux:
|
||||
|
||||
pacman -S libxslt docbook-xml docbook-xsl
|
||||
|
||||
Ubuntu (16.04):
|
||||
|
||||
apt-get install xsltproc docbook-xsl
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE catalog
|
||||
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
|
||||
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
||||
<rewriteSystem
|
||||
systemIdStartString="http://docbook.sourceforge.net/release/xsl/current"
|
||||
rewritePrefix="docbook-xsl/"/>
|
||||
<rewriteURI
|
||||
uriStartString="http://docbook.sourceforge.net/release/xsl/current/"
|
||||
rewritePrefix="docbook-xsl/" />
|
||||
</catalog>
|
@ -0,0 +1,715 @@
|
||||
#!/usr/bin/env python2
|
||||
r"""
|
||||
db2vim [options] file.xml
|
||||
|
||||
SHORT OPTIONS
|
||||
|
||||
-d Prints some debugging information on stderr.
|
||||
|
||||
-s If given, the db2vim operates in a 'stict' conversion mode, i.e, any
|
||||
element which does not have a handler defined for them it be
|
||||
completeley ignored including all its children. Otherwise, db2vim will
|
||||
recurse into an unknown tag and process any of its children it
|
||||
recognizes. Since db2vim always recognizes text nodes, not using this
|
||||
option has the effect that all text will be printed out, even if
|
||||
somewhat incorrectly.
|
||||
|
||||
LONG OPTIONS
|
||||
|
||||
--prefix=<prefix>
|
||||
This is a string like "ls_" which will be prepended to the section
|
||||
numbers. Default to 'ls_' if unsupplied.
|
||||
"""
|
||||
|
||||
|
||||
import xml.dom.minidom
|
||||
import getopt
|
||||
import string
|
||||
import re
|
||||
import sys
|
||||
|
||||
# Okay. so I import *. Shoot me.
|
||||
from textutils import *
|
||||
from domutils import *
|
||||
|
||||
# define a bunch of constants for formatting.
|
||||
TEXT_WIDTH = 80
|
||||
BLOCK_QUOTE = 4
|
||||
COL_SPACE = 2
|
||||
|
||||
# a bunch of globals used in creating the Table of contents.
|
||||
#
|
||||
# TOC_HASH['section 1.1 label'] = 'ls_1_1'
|
||||
#
|
||||
# LEVEL_HASH['section 1.1 label'] = 1
|
||||
# (top level article has level 0)
|
||||
#
|
||||
# TITLE_HASH['section 1.1 label'] = 'Title of section 1.1'
|
||||
#
|
||||
# FILENAME = the name of the file being processed with the last extension
|
||||
# changed to .txt
|
||||
#
|
||||
# TOC_PREFIX = 'ls_' (the prefix used to create the section labels).
|
||||
TOC_HASH = {}
|
||||
LEVEL_HASH = {}
|
||||
TITLE_HASH = {}
|
||||
FILENAME = ''
|
||||
TOC_PREFIX = ''
|
||||
|
||||
ANCHOR_HASH = {}
|
||||
URL_HASH = {}
|
||||
|
||||
# STDERR for printing debugging info.
|
||||
DEBUG = 0
|
||||
STDERR = sys.stderr
|
||||
STRICT = 0
|
||||
NUM_ANCHORS = {0: 1}
|
||||
|
||||
###############################################################################
|
||||
# Miscellaneous utility functions
|
||||
###############################################################################
|
||||
|
||||
|
||||
def encodeTo52(num):
|
||||
if num < 26:
|
||||
return unichr(ord('a') + num)
|
||||
elif num < 52:
|
||||
return unichr(ord('A') + num - 26)
|
||||
else:
|
||||
return encodeTo52(int(num / 52)) + encodeTo52(num % 52)
|
||||
|
||||
|
||||
def makeTocHash(rootElement, width, prefix='', level=0):
|
||||
lastLabelUsed = 0
|
||||
|
||||
for section in rootElement.getChildrenByTagName('section'):
|
||||
title = section.getChildrenByTagName('title')[0]
|
||||
titleText = handleElement(title, width)
|
||||
lastLabelUsed += 1
|
||||
thisLabel = TOC_PREFIX + prefix + str(lastLabelUsed)
|
||||
|
||||
sectionid = section.getAttribute('id')
|
||||
if not sectionid:
|
||||
section.setAttribute('id', thisLabel)
|
||||
sectionid = thisLabel
|
||||
|
||||
NUM_ANCHORS[0] += 1
|
||||
ANCHOR_HASH[sectionid] = TOC_PREFIX + 'a_' + encodeTo52(
|
||||
NUM_ANCHORS[0] + 52)
|
||||
|
||||
TOC_HASH[sectionid] = thisLabel
|
||||
LEVEL_HASH[sectionid] = level
|
||||
TITLE_HASH[sectionid] = titleText
|
||||
|
||||
if section.getChildrenByTagName('section'):
|
||||
makeTocHash(section, width - 5, prefix=prefix +
|
||||
str(lastLabelUsed) + '_', level=level + 1)
|
||||
|
||||
|
||||
def makeAnchorHash(rootElement):
|
||||
anchors = rootElement.getElementsByTagName(
|
||||
'anchor') + rootElement.getElementsByTagName('note')
|
||||
for anchor in anchors:
|
||||
if not anchor.getAttribute('id'):
|
||||
continue
|
||||
|
||||
NUM_ANCHORS[0] += 1
|
||||
if anchor.getAttribute('id') in ANCHOR_HASH or \
|
||||
anchor.getAttribute('id') in TOC_HASH:
|
||||
sys.stderr.write("Warning: anchor [%s] multiply defined\n" %
|
||||
anchor.getAttribute('id'))
|
||||
|
||||
ANCHOR_HASH[anchor.getAttribute(
|
||||
'id')] = TOC_PREFIX + 'a_' + encodeTo52(NUM_ANCHORS[0] + 52)
|
||||
|
||||
|
||||
def makeURLHash(rootElement):
|
||||
urls = rootElement.getElementsByTagName('ulink')
|
||||
numURLs = 0
|
||||
for url in urls:
|
||||
if not url.getAttribute('url') or url.getAttribute('url') in URL_HASH:
|
||||
continue
|
||||
numURLs += 1
|
||||
URL_HASH[url.getAttribute('url')] = TOC_PREFIX + 'u_' + str(numURLs)
|
||||
|
||||
|
||||
def makeTOC(node, width, maxlevel=1):
|
||||
retText = ""
|
||||
|
||||
for section in node.getChildrenByTagName('section'):
|
||||
|
||||
sectionid = section.getAttribute('id')
|
||||
thisLabel = TOC_HASH.get(sectionid, '')
|
||||
titleText = TITLE_HASH.get(sectionid, '')
|
||||
level = LEVEL_HASH.get(sectionid, 10)
|
||||
|
||||
if level <= maxlevel:
|
||||
retText += '|' + thisLabel + '| ' + titleText + '\n'
|
||||
|
||||
if level < maxlevel and section.getChildrenByTagName('section'):
|
||||
childText = makeTOC(section, width - 5)
|
||||
retText += VertCatString(" ", 4, childText) + '\n'
|
||||
|
||||
retText = re.sub(r'\s+$', r'\n', retText)
|
||||
|
||||
return retText
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Generalized function for handling dom elements.
|
||||
###############################################################################
|
||||
|
||||
|
||||
def IsInlineTag(self):
|
||||
if self.nodeType == self.TEXT_NODE:
|
||||
return 1
|
||||
elif inlineTags.get(self.tagName, 0):
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
def getChildrenByTagName(self, name):
|
||||
"""
|
||||
extension to the xml.dom.minidom.Element class. returns all direct
|
||||
descendants of this Element.
|
||||
"""
|
||||
nodeList = []
|
||||
|
||||
child = self.firstChild
|
||||
while not child is None:
|
||||
if child.nodeType == child.ELEMENT_NODE and child.nodeName == name:
|
||||
nodeList.append(child)
|
||||
|
||||
child = child.nextSibling
|
||||
|
||||
return nodeList
|
||||
|
||||
xml.dom.minidom.Element.getChildrenByTagName = getChildrenByTagName
|
||||
|
||||
|
||||
def handleElement(rootElement, width=TEXT_WIDTH):
|
||||
"""
|
||||
Generalized function to handle an Element node in a DOM tree.
|
||||
"""
|
||||
|
||||
retText = ""
|
||||
child = rootElement.firstChild
|
||||
while not child is None:
|
||||
|
||||
printerr('node type = %d' % child.nodeType)
|
||||
if child.nodeType == child.ELEMENT_NODE:
|
||||
printerr('processing [%s]' % child.tagName)
|
||||
|
||||
isinline = IsInlineTag(child)
|
||||
|
||||
# if the child is an Element and if a handler exists, then call it.
|
||||
if not isinline \
|
||||
and child.nodeType == child.ELEMENT_NODE \
|
||||
and child.tagName in handlerMaps:
|
||||
# offset the child text by the current indentation value
|
||||
printerr('making recursive call to known child.')
|
||||
retText += handlerMaps[child.tagName](child, width)
|
||||
child = child.nextSibling
|
||||
|
||||
elif not isinline \
|
||||
and child.nodeType == child.PROCESSING_INSTRUCTION_NODE \
|
||||
and child.target == 'vimhelp':
|
||||
|
||||
if child.data in handlerMaps:
|
||||
retText += handlerMaps[child.data](child, width)
|
||||
|
||||
child = child.nextSibling
|
||||
|
||||
# if its a text node or an inline element node, collect consecutive
|
||||
# text nodes into a single paragraph and indent it.
|
||||
elif isinline:
|
||||
|
||||
text = ""
|
||||
while not child is None and IsInlineTag(child):
|
||||
if child.nodeType == child.TEXT_NODE:
|
||||
text += child.data
|
||||
elif child.nodeType == child.ELEMENT_NODE:
|
||||
if child.tagName in handlerMaps:
|
||||
text += handlerMaps[child.tagName](child, width)
|
||||
else:
|
||||
text += GetText(child.childNodes)
|
||||
child = child.nextSibling
|
||||
|
||||
retText += IndentParagraphs(text, width)
|
||||
|
||||
# If we cannot understand _anything_ about the element, then just
|
||||
# handle its children hoping we have something to gather from
|
||||
# there.
|
||||
elif not STRICT:
|
||||
printerr('making recursive call for unkown child')
|
||||
retText += handleElement(child, width)
|
||||
child = child.nextSibling
|
||||
|
||||
else:
|
||||
child = child.nextSibling
|
||||
|
||||
return retText
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Functions for handling various xml tags
|
||||
###############################################################################
|
||||
|
||||
|
||||
def handleArticleInfo(articleinfo, width):
|
||||
|
||||
makeTocHash(articleinfo.parentNode, width)
|
||||
makeAnchorHash(articleinfo.parentNode)
|
||||
makeURLHash(articleinfo.parentNode)
|
||||
|
||||
title = articleinfo.getChildrenByTagName('title')
|
||||
if title is None:
|
||||
print("Article should have a title!")
|
||||
sys.exit(1)
|
||||
|
||||
name = GetText(title[0].childNodes)
|
||||
authors = articleinfo.getChildrenByTagName('author')
|
||||
|
||||
authorText = ''
|
||||
for author in authors:
|
||||
firstname = ''
|
||||
surname = ''
|
||||
if author.getElementsByTagName('firstname'):
|
||||
firstname = GetTextFromElementNode(author, 'firstname')[0]
|
||||
if author.getChildrenByTagName('surname'):
|
||||
surname = GetTextFromElementNode(author, 'surname')[0]
|
||||
if author.getElementsByTagName('email'):
|
||||
email = GetTextFromElementNode(author, 'email')[0]
|
||||
authorText = authorText + firstname + ' ' + surname + \
|
||||
' <' + email + '>\n'
|
||||
|
||||
abstractText = ''
|
||||
abstract = articleinfo.getChildrenByTagName('abstract')
|
||||
if abstract is not None:
|
||||
abstractText = '\n\n' + CenterText('Abstract\n========', width)
|
||||
abstractText += handleElement(abstract[0], width) + '\n'
|
||||
|
||||
retText = CenterText(name + '\n*' + FILENAME + '*\n' + authorText, width)
|
||||
retText += abstractText
|
||||
|
||||
toc = makeTOC(articleinfo.parentNode, width)
|
||||
|
||||
return retText + '\n' + RightJustify('*' + FILENAME + '-toc*', width) + \
|
||||
'\n' + toc
|
||||
|
||||
|
||||
def handleOption(option, width):
|
||||
retText = ""
|
||||
names = GetTextFromElementNode(option, "name")
|
||||
|
||||
for name in names:
|
||||
retText += string.rjust("*" + name + "*", width) + "\n"
|
||||
|
||||
nameTexts = ""
|
||||
maxNameLen = -1
|
||||
for name in names:
|
||||
maxNameLen = max(maxNameLen, len(name + " "))
|
||||
nameTexts += name + " \n"
|
||||
|
||||
desc = option.getChildrenByTagName("desc")[0]
|
||||
descText = handleElement(desc, width=width - maxNameLen)
|
||||
|
||||
retText += VertCatString(nameTexts + " ", None, descText)
|
||||
|
||||
return retText + "\n"
|
||||
|
||||
|
||||
def handleOptionDefault(default, width):
|
||||
type = string.join(GetTextFromElementNode(default, "type"), "\n")
|
||||
extra = string.join(GetTextFromElementNode(default, "extra"), "\n")
|
||||
return type + "\t(" + extra + ")"
|
||||
|
||||
|
||||
def handleTableRoot(root, width):
|
||||
tgroup = root.getChildrenByTagName('tgroup')[0]
|
||||
if tgroup is None:
|
||||
return ''
|
||||
|
||||
rows = []
|
||||
numHeadRows = 0
|
||||
if tgroup.getChildrenByTagName('thead'):
|
||||
thead = tgroup.getChildrenByTagName('thead')[0]
|
||||
rows = thead.getChildrenByTagName('row')
|
||||
numHeadRows = len(rows)
|
||||
|
||||
tbody = tgroup.getChildrenByTagName('tbody')[0]
|
||||
rows += tbody.getChildrenByTagName('row')
|
||||
|
||||
widths, text = calculateColumnWidthsDoublePass(rows, width)
|
||||
|
||||
headText = text[0:numHeadRows]
|
||||
bodyText = text[numHeadRows:]
|
||||
|
||||
headTable = FormatTable(headText, ROW_SPACE=1, COL_SPACE=
|
||||
COL_SPACE, justify=0, widths=widths)
|
||||
if headTable:
|
||||
headTable = re.sub(r'\n|$', '\g<0>~', headTable)
|
||||
bodyTable = FormatTable(bodyText, ROW_SPACE=1, COL_SPACE=
|
||||
COL_SPACE, justify=0, widths=widths)
|
||||
|
||||
return headTable + '\n' + re.sub(r'\n+$', '', bodyTable) + '\n\n'
|
||||
|
||||
|
||||
def calculateColumnWidths(rows, alloc_widths):
|
||||
widths = {}
|
||||
text = []
|
||||
for row in rows:
|
||||
cols = row.getChildrenByTagName("entry")
|
||||
if len(alloc_widths) == 1:
|
||||
alloc_widths *= len(cols)
|
||||
|
||||
colwidths = []
|
||||
rowtext = []
|
||||
for col, width in zip(cols, alloc_widths):
|
||||
coltext = handleElement(col, width)
|
||||
|
||||
rowtext.append(coltext)
|
||||
# This is the 'width' of the current cell including the
|
||||
# whitespace padding.
|
||||
colwidths.append(max(map(len, coltext.split("\n")))
|
||||
+ COL_SPACE)
|
||||
|
||||
text.append(rowtext)
|
||||
|
||||
# update the widths of the columns by finding the maximum
|
||||
# width of all cells in this column.
|
||||
for i in range(len(colwidths)):
|
||||
widths[i] = max(colwidths[i], widths.get(i, -1))
|
||||
|
||||
return widths, text
|
||||
|
||||
|
||||
def calculateColumnWidthsDoublePass(rows, width):
|
||||
maxwidths, text = calculateColumnWidths(rows, [width])
|
||||
if reduce(lambda x, y: x + y, maxwidths.values()) <= width:
|
||||
return maxwidths, text
|
||||
|
||||
# now find out how many columns exceed the maximum permitted width.
|
||||
# nlarge: number of columns which are too wide.
|
||||
# remainingWidth: width which these large columns can share.
|
||||
nlarge = 0
|
||||
remainingWidth = width
|
||||
for colwidth in maxwidths.values():
|
||||
if colwidth > width / len(maxwidths):
|
||||
nlarge += 1
|
||||
else:
|
||||
remainingWidth += -colwidth
|
||||
|
||||
# newmaxwidth: width which each of the large columns is allowed.
|
||||
newmaxwidth = remainingWidth / max(nlarge, 1)
|
||||
|
||||