1👍
✅
The apostrohpe in SomeDude's
is acting as the end of the contentString for that line, then there is more content after it. You need to escape this variable, which should happen by default so maybe you turned off autoescaping? Try replacing with this:
'<h1 id="infolayer-title" class="firstHeading">{% autoescape on %}{{ variable1 }} {{ variable2 }}{% endautoescape %}</h1>'+
It will encode the '
in SomeDude's
as '
for a rendering of SomeDude's
which will not break your string.
Source:stackexchange.com