<commit_before>" vimtex - LaTeX plugin for Vim
"
" Maintainer: <NAME>
" Email:      <EMAIL>
"

function! vimtex#toc#init_options() " {{{1
  call vimtex#util#set_default('g:vimtex_toc_enabled', 1)
  if !g:vimtex_toc_enabled | return | endif

  call vimtex#util#set_default('g:vimtex_toc_fold', 0)
  call vimtex#util#set_default('g:vimtex_toc_fold_levels', 10)
  call vimtex#util#set_default('g:vimtex_toc_number_width', 0)
  call vimtex#util#set_default('g:vimtex_toc_secnumdepth', 3)
  call vimtex#util#set_default('g:vimtex_toc_show_numbers', 1)
  call vimtex#util#set_default('g:vimtex_toc_show_preamble', 1)
endfunction

" }}}1
function! vimtex#toc#init_script() " {{{1
  call vimtex#util#set_highlight('VimtexTocNum', 'Number')
  call vimtex#util#set_highlight('VimtexTocSec0', 'Title')
  call vimtex#util#set_highlight('VimtexTocSec1', 'Normal')
  call vimtex#util#set_highlight('VimtexTocSec2', 'helpVim')
  call vimtex#util#set_highlight('VimtexTocSec3', 'NonText')
  call vimtex#util#set_highlight('VimtexTocSec4', 'Comment')
  call vimtex#util#set_highlight('VimtexTocHelp', 'helpVim')

  if !g:vimtex_toc_enabled | return | endif

  let s:name = 'Table of contents (vimtex)'

  "
  " Define TOC variables
  "

  " Define counters
  let s:max_level = 0
  let s:count_matters = 0

  " Define dictionary to keep track of TOC numbers
  let s:number = {
        \ 'part' : 0,
        \ 'chapter' : 0,
        \ 'section' : 0,
        \ 'subsection' : 0,
        \ 'subsubsection' : 0,
        \ 'subsubsubsection' : 0,
        \ 'current_level' : 0,
        \ 'preamble' : 0,
        \ 'frontmatter' : 0,
        \ 'mainmatter' : 0,
        \ 'appendix' : 0,
        \ 'backmatter' : 0,
        \ }

  " Map for section hierarchy
  let s:sec_to_value = {
        \ '_' : 0,
        \ 'subsubsubsection' : 1,
        \ 'subsubsection' : 2,
        \ 'subsection' : 3,
        \ 'section' : 4,
        \ 'chapter' : 5,
        \ 'part' : 6,
        \ }

  " Define regular expressions to match document parts
  let s:re_sec = '\v^\s*\\%(part|chapter|%(sub)*section)\*?\s*%(\[.{-}\])?\{'
  let s:re_sec_starred = '\v^\s*\\%(part|chapter|%(sub)*section)\*'
  let s:re_sec_level = '\v^\s*\\\zs%(part|chapter|%(sub)*section)'
  let s:re_sec_title = s:re_sec . '\zs.{-}\ze\}?\%?\s*$'
  let s:re_matters = '\v^\s*\\%(front|main|back)matter>'
  let s:re_structure = '\v^\s*\\((front|main|back)matter|appendix)>'
  let s:re_structure_match = '\v((front|main|back)matter|appendix)'
  let s:re_other = {
        \ 'toc' : {
        \   'title' : 'Table of contents',
        \   're'    : '\v^\s*\\tableofcontents',
        \   },
        \ 'index' : {
        \   'title' : 'Alphabetical index',
        \   're'    : '\v^\s*\\printindex\[?',
        \   },<commit_msg>Include titlepage in TOC (#508)<commit_after>" vimtex - LaTeX plugin for Vim
"
" Maintainer: <NAME>
" Email:      <EMAIL>
"

function! vimtex#toc#init_options() " {{{1
  call vimtex#util#set_default('g:vimtex_toc_enabled', 1)
  if !g:vimtex_toc_enabled | return | endif

  call vimtex#util#set_default('g:vimtex_toc_fold', 0)
  call vimtex#util#set_default('g:vimtex_toc_fold_levels', 10)
  call vimtex#util#set_default('g:vimtex_toc_number_width', 0)
  call vimtex#util#set_default('g:vimtex_toc_secnumdepth', 3)
  call vimtex#util#set_default('g:vimtex_toc_show_numbers', 1)
  call vimtex#util#set_default('g:vimtex_toc_show_preamble', 1)
endfunction

" }}}1
function! vimtex#toc#init_script() " {{{1
  call vimtex#util#set_highlight('VimtexTocNum', 'Number')
  call vimtex#util#set_highlight('VimtexTocSec0', 'Title')
  call vimtex#util#set_highlight('VimtexTocSec1', 'Normal')
  call vimtex#util#set_highlight('VimtexTocSec2', 'helpVim')
  call vimtex#util#set_highlight('VimtexTocSec3', 'NonText')
  call vimtex#util#set_highlight('VimtexTocSec4', 'Comment')
  call vimtex#util#set_highlight('VimtexTocHelp', 'helpVim')

  if !g:vimtex_toc_enabled | return | endif

  let s:name = 'Table of contents (vimtex)'

  "
  " Define TOC variables
  "

  " Define counters
  let s:max_level = 0
  let s:count_matters = 0

  " Define dictionary to keep track of TOC numbers
  let s:number = {
        \ 'part' : 0,
        \ 'chapter' : 0,
        \ 'section' : 0,
        \ 'subsection' : 0,
        \ 'subsubsection' : 0,
        \ 'subsubsubsection' : 0,
        \ 'current_level' : 0,
        \ 'preamble' : 0,
        \ 'frontmatter' : 0,
        \ 'mainmatter' : 0,
        \ 'appendix' : 0,
        \ 'backmatter' : 0,
        \ }

  " Map for section hierarchy
  let s:sec_to_value = {
        \ '_' : 0,
        \ 'subsubsubsection' : 1,
        \ 'subsubsection' : 2,
        \ 'subsection' : 3,
        \ 'section' : 4,
        \ 'chapter' : 5,
        \ 'part' : 6,
        \ }

  " Define regular expressions to match document parts
  let s:re_sec = '\v^\s*\\%(part|chapter|%(sub)*section)\*?\s*%(\[.{-}\])?\{'
  let s:re_sec_starred = '\v^\s*\\%(part|chapter|%(sub)*section)\*'
  let s:re_sec_level = '\v^\s*\\\zs%(part|chapter|%(sub)*section)'
  let s:re_sec_title = s:re_sec . '\zs.{-}\ze\}?\%?\s*$'
  let s:re_matters = '\v^\s*\\%(front|main|back)matter>'
  let s:re_structure = '\v^\s*\\((front|main|back)matter|appendix)>'
  let s:re_structure_match = '\v((front|main|back)matter|appendix)'
  let s:re_other = {
        \ 'toc' : {
        \   'title' : 'Table of contents',
        \   're'    : '\v^\s*\\tableofcontents',
        \   },
        \ 'index' : {
        \   'title' : 'Alphabetical index',
        \   're'    : '\v^\s*\\printindex\[?',
        \   },
        \ 'titlepage' : {
        \   'title' : 'Titlepage',
        \   're'    : '\v^\s*\\begin{titlepage}',
        \   },
{'fraction_non_alphanumeric': 0.1800705467372134, 'fraction_numerical': 0.013580246913580247, 'mean_word_length': 2.9056473829201104, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6923664', 'n_tokens_mistral': 2376, 'n_tokens_neox': 2197, 'n_words': 373}