Improved TOC title parsing
This commit is contained in:
parent
ecd0306709
commit
43410759c3
@ -127,26 +127,25 @@ function! s:read_toc(auxfile, texfile, ...)
|
||||
endif
|
||||
|
||||
" Parse number
|
||||
if len(tree[1]) > 3 && empty(tree[1][1])
|
||||
call remove(tree[1], 1)
|
||||
let secnum = ''
|
||||
let tree = tree[1]
|
||||
if len(tree) > 3 && empty(tree[1])
|
||||
call remove(tree, 1)
|
||||
endif
|
||||
if len(tree[1]) > 1
|
||||
if !empty(tree[1][1])
|
||||
let secnum = latex#util#tree2tex(tree[1][1])
|
||||
if len(tree) > 1
|
||||
if tree[0] =~ '^\\numberline'
|
||||
let secnum = latex#util#tree2tex(tree[1])
|
||||
let secnum = substitute(secnum, '\\\S\+\s', '', 'g')
|
||||
let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g')
|
||||
let secnum = substitute(secnum, '^{\+\|}\+$', '', 'g')
|
||||
call remove(tree, 1)
|
||||
endif
|
||||
let tree = tree[1][2:]
|
||||
else
|
||||
let secnum = ''
|
||||
let tree = tree[1]
|
||||
endif
|
||||
|
||||
" Parse title
|
||||
let text = latex#util#tree2tex(tree)
|
||||
let text = substitute(text, '^{\+\|}\+$', '', 'g')
|
||||
let text = substitute(text, '^\\nonumberline\s*', '', 'g')
|
||||
let text = substitute(text, '^\\\(no\)\?numberline\s*', '', 'g')
|
||||
|
||||
" Add TOC entry
|
||||
call add(fileindices[texfile], len(toc))
|
||||
|
Loading…
Reference in New Issue
Block a user