diff --git a/tex/part-practical.tex b/tex/part-practical.tex index 140d694..d04f367 100644 --- a/tex/part-practical.tex +++ b/tex/part-practical.tex @@ -374,13 +374,15 @@ Echo's built-in facilities in a more ergonomic manner using \texttt{return c.Render(http.StatusOk, "home.tmpl")}. \vspace{\parskip} -\begin{lstlisting}[language=Go, caption={A conditional inside a Go template}, +\begin{lstlisting}[ +caption={Conditionaly enabling functionality inside a Go template based on user access level}, label=tmplConditionals, basicstyle=\linespread{0.9}\small\ttfamily, backgroundcolor=\color{lstbg}, +morekeywords={if,and,end}, ] {{ if and .User .User.IsLoggedIn .User.IsAdmin }} ... -{{end}} +{{ end }} \end{lstlisting} Templates used for rendering of the web pages were created in a composable