diff --git a/Resources/views/Base/letter.tex.twig b/Resources/views/Base/letter.tex.twig index b3832ef..0e2ef29 100644 --- a/Resources/views/Base/letter.tex.twig +++ b/Resources/views/Base/letter.tex.twig @@ -30,7 +30,7 @@ \@setplength{refvpos}{ {{- refvpos -}} } \makeatletter - \date{ {{- date|latex_escape|raw -}} } + \date{ {{- date|latex_escape -}} } {% include '@BobVLatex/extra_commands.twig.twig' %} diff --git a/Resources/views/Element/blacktitle.tex.twig b/Resources/views/Element/blacktitle.tex.twig index 1d59f2c..a084f77 100644 --- a/Resources/views/Element/blacktitle.tex.twig +++ b/Resources/views/Element/blacktitle.tex.twig @@ -1,4 +1,4 @@ {% include '@BobVLatex/extra_commands.twig.twig' %} -{\normalfont\huge\bfseries}{}{\colorbox{black}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\textcolor{white}{\textbf{ {{- title|latex_escape|raw -}} }}}}} +{\normalfont\huge\bfseries}{}{\colorbox{black}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\textcolor{white}{\textbf{ {{- title|latex_escape -}} }}}}} \vspace*{-0.2cm} diff --git a/Resources/views/Element/custom_element.tex.twig b/Resources/views/Element/custom_element.tex.twig index ef2c9c1..148e146 100644 --- a/Resources/views/Element/custom_element.tex.twig +++ b/Resources/views/Element/custom_element.tex.twig @@ -1,5 +1,5 @@ {% block bobv_latex_custom_element %} % Custom element - {{ custom|latex_escape|raw }} + {{ custom|latex_escape }} {% endblock bobv_latex_custom_element %} diff --git a/Resources/views/Element/graphic.tex.twig b/Resources/views/Element/graphic.tex.twig index 79c1555..65c23c5 100644 --- a/Resources/views/Element/graphic.tex.twig +++ b/Resources/views/Element/graphic.tex.twig @@ -8,9 +8,9 @@ \centering {% endif %} {% if caption != false %} - \caption{ {{- caption|latex_escape|raw -}} } + \caption{ {{- caption|latex_escape -}} } {% endif %} - \label{ {{- label|latex_escape|raw -}} } + \label{ {{- label|latex_escape -}} } \end{figure} {% endblock bobv_latex_graphic_element %} diff --git a/Resources/views/Element/letter.tex.twig b/Resources/views/Element/letter.tex.twig index 5d39aa1..17167da 100644 --- a/Resources/views/Element/letter.tex.twig +++ b/Resources/views/Element/letter.tex.twig @@ -1,14 +1,14 @@ {% block bobv_latex_letter_element %} - \begin{letter}{ {{- address|latex_escape|raw -}} } + \begin{letter}{ {{- address|latex_escape -}} } % Letter element {% include '@BobVLatex/extra_commands.twig.twig' %} - \opening{ {{- opening|latex_escape|raw -}},} + \opening{ {{- opening|latex_escape -}},} - {{ text|latex_escape|raw }} + {{ text|latex_escape }} \end{letter} diff --git a/Resources/views/Element/listing.tex.twig b/Resources/views/Element/listing.tex.twig index 27b4625..7ad9755 100644 --- a/Resources/views/Element/listing.tex.twig +++ b/Resources/views/Element/listing.tex.twig @@ -4,7 +4,7 @@ {{ enumerate ? '\\begin{enumerate}' : '\\begin{itemize}' }} {% include '@BobVLatex/extra_commands.twig.twig' %} {% for item in list %} - \item {{ item|latex_escape|raw }} + \item {{ item|latex_escape }} {% endfor %} {{ enumerate ? '\\end{enumerate}' : '\\end{itemize}' }} diff --git a/Resources/views/Element/longtable.tex.twig b/Resources/views/Element/longtable.tex.twig index 20b6b43..c276db1 100644 --- a/Resources/views/Element/longtable.tex.twig +++ b/Resources/views/Element/longtable.tex.twig @@ -6,30 +6,30 @@ \begin{longtable}{ {%- for row in rows %}{{ row }} {% endfor -%} } {% if caption != null %} - \caption{ {{- caption|latex_escape|raw -}} } + \caption{ {{- caption|latex_escape -}} } {% endif %} {# First head #} {% if firsthead != null %} - {{ firsthead|latex_escape(false)|raw }} + {{ firsthead|latex_escape(false) }} \endfirsthead {% endif %} {# Head #} {% if head != null %} - {{ head|latex_escape(false)|raw }} + {{ head|latex_escape(false) }} \endhead {% endif %} {# Foot #} {% if foot != null %} - {{ foot|latex_escape(false)|raw }} + {{ foot|latex_escape(false) }} \endfoot {% endif %} {# Last foot #} {% if lastfoot %} - {{ lastfoot|latex_escape(false)|raw }} + {{ lastfoot|latex_escape(false) }} \endlastfoot {% endif %} @@ -40,7 +40,7 @@ {% set first = true %} {% for cellData in rowData['data'] %} {% if not first %}&{% endif %} - {{ cellData|latex_escape|raw }} + {{ cellData|latex_escape }} {% set first = false %} {% endfor %} \\ diff --git a/Resources/views/Element/table.tex.twig b/Resources/views/Element/table.tex.twig index 6627f09..aa9f04c 100644 --- a/Resources/views/Element/table.tex.twig +++ b/Resources/views/Element/table.tex.twig @@ -5,7 +5,7 @@ {% if caption != null %} \begin{table}[h!] - \caption{ {{- caption|latex_escape|raw -}} } + \caption{ {{- caption|latex_escape -}} } {% endif %} {% if width == '\\textwidth' %} @@ -20,7 +20,7 @@ {% for cellData in rowData['data'] %} {% if not loop.first %}&{% endif %} - {{ cellData|latex_escape|raw }} + {{ cellData|latex_escape }} {% endfor %} \\ diff --git a/Resources/views/Element/text.tex.twig b/Resources/views/Element/text.tex.twig index c5afe4f..22efd89 100644 --- a/Resources/views/Element/text.tex.twig +++ b/Resources/views/Element/text.tex.twig @@ -3,5 +3,5 @@ % Text element {% include '@BobVLatex/extra_commands.twig.twig' %} - {{ text|latex_escape|raw }} + {{ text|latex_escape }} {% endblock bobv_latex_text_element %} diff --git a/Resources/views/Element/titlepage.tex.twig b/Resources/views/Element/titlepage.tex.twig index 719f1f7..3c87f0e 100644 --- a/Resources/views/Element/titlepage.tex.twig +++ b/Resources/views/Element/titlepage.tex.twig @@ -3,12 +3,12 @@ % Title page \title{ \vspace{ {{ vspace|raw }} } - \textmd{\textbf{ {{- title|latex_escape|raw -}} }}\\ - \normalsize\vspace{ {{- vspace_subtitle|latex_escape|raw -}} }\small{ {{- subtitle|latex_escape|raw -}} } + \textmd{\textbf{ {{- title|latex_escape -}} }}\\ + \normalsize\vspace{ {{- vspace_subtitle|latex_escape -}} }\small{ {{- subtitle|latex_escape -}} } } - \author{\textbf{ {{- author|latex_escape|raw -}} }} - \date{ {{- date|latex_escape|raw -}} } % Insert date here if you want it to appear below your name + \author{\textbf{ {{- author|latex_escape -}} }} + \date{ {{- date|latex_escape -}} } % Insert date here if you want it to appear below your name {% include '@BobVLatex/extra_commands.twig.twig' %} diff --git a/Twig/BobVLatexExtension.php b/Twig/BobVLatexExtension.php index 3260102..a463f0f 100644 --- a/Twig/BobVLatexExtension.php +++ b/Twig/BobVLatexExtension.php @@ -22,11 +22,11 @@ public function __construct() { * @return array */ public function getFilters() { - return array( - new \Twig_SimpleFilter('latex_escape', array($this->parser, 'parseText')), - new \Twig_SimpleFilter('latex_escape_all', array($this, 'latexEscapeAll')), - new \Twig_SimpleFilter('latex_parse_html', array($this->parser, 'parseHtml')), - ); + return [ + new \Twig_SimpleFilter('latex_escape', [$this->parser, 'parseText'], ['is_safe' => ['all']]), + new \Twig_SimpleFilter('latex_escape_all', [$this, 'latexEscapeAll'], ['is_safe' => ['all']]), + new \Twig_SimpleFilter('latex_parse_html', [$this->parser, 'parseHtml'], ['is_safe' => ['all']]), + ]; } /**