Skip to content
Snippets Groups Projects
Commit 9423e274 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Add support for vim files to notebook

parent f1339082
Branches
No related tags found
No related merge requests found
""" Vim Config
" Tabs
set expandtab
set smarttab
" Indents
set shiftwidth=2
set tabstop=2
set autoindent
set smartindent
set cindent
" Turn backup off
set nobackup
set nowb
set noswapfile
" Highlight matching brackets
set showmatch
" Display line numbers
set number
File moved
......@@ -11,7 +11,9 @@ class Tree:
# and directories.
def build(self):
for di in self.dirs:
path_list = sorted(list(Path(di).glob('**/*.cpp')))
path_list = list(Path(di).glob('**/*.cpp'))
path_list += list(Path(di).glob('**/*.vim'))
path_list = sorted(path_list)
for path in path_list:
branch = str(path).split('/')
......@@ -46,7 +48,7 @@ class LatexGenerator:
self._add_header()
self.gen_latex(tree)
self.output.write('\end{document}')
self.output.write('\\end{document}')
# Adds Latex header to the output.
def _add_header(self):
......@@ -63,7 +65,8 @@ class LatexGenerator:
# Prints code in Latex format.
def gen_code_latex(self, path):
# TODO: Add code parsing funcion to extract text
self.output.write('\\begin{lstlisting}[style=customcpp]\n')
suffix = path.split('.')[-1]
self.output.write('\\begin{lstlisting}[style=custom%s]\n' % suffix)
with open(path) as f:
lines = f.readlines()
......@@ -84,7 +87,6 @@ class LatexGenerator:
self.gen_title_latex(self._parse_dir_name(i), depth)
self.gen_latex(sub[i], path + i + '/', depth + 1)
#self.output.write('\\newpage\n')
self.output.write('\n')
# Parses name of the section (capitalize)
......
......@@ -18,5 +18,12 @@
breaklines=true,
morekeywords={int32\_t, ll}
}
\lstdefinestyle{customvim}{
frame=single,
basicstyle=\small,
tabsize=2,
breaklines=true,
morekeywords={set}
}
\begin{document}
\tableofcontents
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment