[gtksourceview: 3/3] tests: add syntax example for twig




commit 92016170d21d770c458315fa8d78f0eca0349394
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 24 12:04:22 2022 -0700

    tests: add syntax example for twig
    
    This comes from some examples on https://twig.symfony.com/

 tests/syntax-highlighting/file.twig | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/tests/syntax-highlighting/file.twig b/tests/syntax-highlighting/file.twig
new file mode 100644
index 00000000..cac141c9
--- /dev/null
+++ b/tests/syntax-highlighting/file.twig
@@ -0,0 +1,23 @@
+{{ var }}
+{{ var|escape }}
+{{ var|e }}         {# shortcut to escape a variable #}
+
+{% for user in users %}
+    * {{ user.name }}
+{% else %}
+    No users have been found.
+{% endfor %}
+
+{% extends "layout.html" %}
+
+{% block content %}
+    Content of the page...
+{% endblock %}
+
+{% autoescape "html" %}
+    {{ var }}
+    {{ var|raw }}     {# var won't be escaped #}
+    {{ var|escape }}  {# var won't be doubled-escaped #}
+{% endautoescape %}
+
+{{ include('page.html', sandboxed = true) }}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]