diff --git a/figures/email-src-hbs.tex b/figures/email-src-hbs.tex index c5ab855..9f8ec9c 100644 --- a/figures/email-src-hbs.tex +++ b/figures/email-src-hbs.tex @@ -1,5 +1,5 @@ \begin{figure} - \begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}, breaklines=true, basicstyle=\small] + \begin{lstlisting}[language=hbs, numbers=none] {{#>mint.main}} {{#>mint.title}} Bienvenue [[surname]] [[name]] diff --git a/figures/email-src-mjml.tex b/figures/email-src-mjml.tex index 7eb2f2f..6ada83c 100644 --- a/figures/email-src-mjml.tex +++ b/figures/email-src-mjml.tex @@ -1,5 +1,5 @@ \begin{figure} - \begin{lstlisting}[language=xml, numbers=none, backgroundcolor=\color{bgColor}, breaklines=true, basicstyle=\small, showstringspaces=false] + \begin{lstlisting}[language=xml, numbers=none] diff --git a/figures/email.tex b/figures/email.tex index c144610..157efdb 100644 --- a/figures/email.tex +++ b/figures/email.tex @@ -10,7 +10,7 @@ \end{subfigure} \begin{subfigure}[t]{\textwidth} - \begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}, breaklines=true, basicstyle=\small] + \begin{lstlisting}[language=hbs, numbers=none] Bienvenue Paul Durant Nous sommes heureux de vous accompagner lors de votre séjour en vous proposant du divertissement. diff --git a/figures/fromeffectloop.tex b/figures/fromeffectloop.tex index 4384567..866edd1 100644 --- a/figures/fromeffectloop.tex +++ b/figures/fromeffectloop.tex @@ -1,6 +1,6 @@ \begin{figure} \begin{subfigure}[t]{\textwidth} - \begin{lstlisting}[style=JavaScript] + \begin{lstlisting}[language=JavaScript] function useCategoryCache() { const [cache, setCache] = React.useState>({}); @@ -47,12 +47,12 @@ const Page = (props) => { \begin{subfigure}[t]{0.45\textwidth} \includegraphics[width=\textwidth]{fromeffectloop} - \caption{Les flèches correspondent à un appel, les points à une dépendance} + \caption{Schéma des dépendances et des appels: une flèche correspond à un appel, un point à une dépendance} \end{subfigure} \hfill \begin{subfigure}[t]{0.45\textwidth} - \includegraphics[width=0.3\textwidth]{fromeffectloop2} - \caption{TODO} + \includegraphics[width=\textwidth]{fromeffectloop2} + \caption{\og Flame graph \fg abstrait des appels} \end{subfigure} \caption{Version simplifiée du bug causant plusieures requêtes à être executées} \label{fromeffectloop} diff --git a/figures/hbs1.tex b/figures/hbs1.tex index 00c30d2..f4c273b 100644 --- a/figures/hbs1.tex +++ b/figures/hbs1.tex @@ -1,27 +1,27 @@ \begin{figure}[H] \begin{subfigure}[t]{0.45\textwidth} - \begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] + \begin{lstlisting}[language=hbs, numbers=none]
\end{lstlisting} \caption{Composant \entity{Mustache} \og \texttt{component\_start} \fg} \end{subfigure} \hfill \begin{subfigure}[t]{0.45\textwidth} - \begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] + \begin{lstlisting}[language=hbs, numbers=none]
{{@partial-block}}
\end{lstlisting} \caption{Composant \entity{Handlebars} \og \texttt{component} \fg} \end{subfigure} \begin{subfigure}[t]{0.45\textwidth} - \begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] + \begin{lstlisting}[language=hbs, numbers=none]
\end{lstlisting} \caption{Composant \entity{Mustache} \og \texttt{component\_end} \fg} \end{subfigure} \begin{subfigure}[t]{0.45\textwidth} - \begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] + \begin{lstlisting}[language=hbs, numbers=none] {{>component_start}}

Hello, world!

{{>component_end}} @@ -30,7 +30,7 @@ \end{subfigure} \hfill \begin{subfigure}[t]{0.45\textwidth} - \begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] + \begin{lstlisting}[language=hbs, numbers=none] {{#>component}}

Hello, world!

{{/component}} diff --git a/figures/hbs2.tex b/figures/hbs2.tex index 9ee09b3..3147090 100644 --- a/figures/hbs2.tex +++ b/figures/hbs2.tex @@ -5,7 +5,7 @@ \end{figure} \begin{figure}[H] - \begin{lstlisting}[language=hbs, numbers=none, backgroundcolor=\color{bgColor}] + \begin{lstlisting}[language=hbs, numbers=none] Hello, user! This is an automated email sent to you, diff --git a/figures/nestjs1.tex b/figures/nestjs1.tex index 33d2f7c..6c5bcae 100644 --- a/figures/nestjs1.tex +++ b/figures/nestjs1.tex @@ -1,38 +1,38 @@ \begin{figure}[H] - \begin{lstlisting}[style=JavaScript] - export abstract class IChildService { - // ... - } - - @Injectable(IChildService) - export class ChildService implements IChildService { - // ... - } + \begin{lstlisting}[language=JavaScript] +export abstract class IChildService { + // ... +} - @Injectable() - export class ParentService { - private childService: IChildService; +@Injectable(IChildService) +export class ChildService implements IChildService { + // ... +} - constructor( - childService: IChildService - ) { - this.childService = IChildService; - } +@Injectable() +export class ParentService { + private childService: IChildService; - // ... + constructor( + childService: IChildService + ) { + this.childService = IChildService; } - @Module({ - providers: [ - ChildService, - ParentService - ], - exports: [ - ParentService - ] - }) - export class ParentModule {} + // ... +} + +@Module({ + providers: [ + ChildService, + ParentService + ], + exports: [ + ParentService + ] +}) +export class ParentModule {} \end{lstlisting} \centering diff --git a/figures/nestjs2.tex b/figures/nestjs2.tex index 4bd74af..9e7753b 100644 --- a/figures/nestjs2.tex +++ b/figures/nestjs2.tex @@ -1,25 +1,25 @@ \begin{figure}[H] - \begin{lstlisting}[style=JavaScript] - @Injectable() - export class MyService { - constructor( - parentService: ParentService - ) { - // ... - } + \begin{lstlisting}[language=JavaScript] +@Injectable() +export class MyService { + constructor( + parentService: ParentService + ) { + // ... } +} - @Module({ - imports: [ - // Comme ParentModule exporte ParentService, - // ce service est facilement rendu disponible ici pour MyService: - ParentModule - ], - providers: [ - MyService - ] - }) - export class MyModule {} +@Module({ + imports: [ + // Comme ParentModule exporte ParentService, + // ce service est facilement rendu disponible ici pour MyService: + ParentModule + ], + providers: [ + MyService + ] +}) +export class MyModule {} \end{lstlisting} \centering diff --git a/images/fromeffectloop2.pdf b/images/fromeffectloop2.pdf index 383a7e5..ba52bbb 100644 Binary files a/images/fromeffectloop2.pdf and b/images/fromeffectloop2.pdf differ diff --git a/report.tex b/report.tex index 54c74f1..fd31303 100644 --- a/report.tex +++ b/report.tex @@ -5,11 +5,13 @@ \usepackage[T1]{fontenc} \usepackage[a4paper, margin=0.7in]{geometry} \usepackage[french]{babel} +\usepackage{xspace} % From https://tex.stackexchange.com/questions/150640/missing-space-after-guillemets \usepackage{amsmath} \usepackage{amsfonts} \usepackage{mathtools} \usepackage{mathabx} \usepackage{listings} +\usepackage[many]{tcolorbox} \usepackage{xcolor} \usepackage{float} \usepackage{cite} @@ -32,11 +34,27 @@ % Requires xelatex to run (or maybe also lualatex) \usepackage{utbmcovers} +\setmonofont[Contextuals={Alternate}]{Fira Code} +\newfontfamily{\FiraCode}[Contextuals={Alternate}]{Fira Code} +\IfFontExistsTF{Fira Code SemiBold}{ + \newfontfamily{\FiraCodeSB}[UprightFont={* SemiBold}]{Fira Code} +}{ + \IfFontExistsTF{Fira Code Semi-Bold}{ + \newfontfamily{\FiraCodeSB}[UprightFont={* Semi-Bold}]{Fira Code} + }{ + \newfontfamily{\FiraCodeSB}[UprightFont={* Semibold}]{Fira Code} + } +} + + +\definecolor{kwColor}{rgb}{0.15,0.21,0.87} + % From https://tex.stackexchange.com/questions/89574/language-option-supported-in-listings \lstdefinelanguage{JavaScript}{ keywords={ typeof, new, abstract, class, interface, type, function, return, + async, await, try, catch, finally, switch, case, break, var, let, const, @@ -44,13 +62,13 @@ for, while, in, of, do, true, false, null, undefined }, - keywordstyle=\color{blue}\bfseries, + keywordstyle=\color{kwColor}\FiraCodeSB, ndkeywords={ export, implements, import, this, private, public, readonly, constructor, @Inject, @Injectable, @Controller, @Module }, - ndkeywordstyle=\color{darkgray}\bfseries, + ndkeywordstyle=\color{darkgray}\FiraCodeSB, identifierstyle=\color{black}, sensitive=false, comment=[l]{//}, @@ -62,31 +80,38 @@ } \lstdefinelanguage{hbs}{ - morecomment=[s]{\{\{!}{!\}\}}, + % morecomment=[s]{\{\{!}{!\}\}}, + morecomment=[s]{}, commentstyle=\color{purple}\ttfamily, stringstyle=\color{red}\ttfamily, morestring=[s]{\{\{}{\}\}}, } \definecolor{bgColor}{rgb}{0.95,0.94,0.92} -\lstdefinestyle{JavaScript}{ - backgroundcolor=\color{bgColor}, - commentstyle=\color{gray}, - keywordstyle=\color{magenta}, - numberstyle=\tiny\color{gray}, - stringstyle=\color{purple}, - basicstyle=\footnotesize, - breakatwhitespace=false, - breaklines=true, - captionpos=b, - keepspaces=true, - numbers=left, - numbersep=5pt, - showspaces=false, - showstringspaces=false, - showtabs=false, - tabsize=2, - language=JavaScript +\lstset{ + % backgroundcolor=\color{bgColor}, + commentstyle=\color{gray}, + keywordstyle=\color{magenta}, + numberstyle=\tiny\color{gray}, + stringstyle=\color{purple}, + basicstyle=\footnotesize, + breakatwhitespace=false, + breaklines=true, + captionpos=b, + keepspaces=true, + numbers=left, + numbersep=5pt, + showspaces=false, + showstringspaces=false, + showtabs=false, + tabsize=2, +} +\tcolorboxenvironment{lstlisting}{ + spartan, + frame empty, + boxsep=0mm, + left=1mm,right=1mm,top=-1mm,bottom=-1mm, + colback=bgColor, } \graphicspath{{build/figures/}{images/}}