Commit 646af0a7 authored by catch's avatar catch
Browse files

Issue #3086075 by jhodgdon, andypost, Charlie ChX Negyesi, Spokje: Use Twig to...

Issue #3086075 by jhodgdon, andypost, Charlie ChX Negyesi, Spokje: Use Twig to strip Twig syntax from help topics files in the syntax checker

(cherry picked from commit 79c009db)
parent a3c9d9d1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
---
label: 'Help topic with locale-unsafe tag'
top_level: true
---
<p>{% trans %}some translated text and a <script>alert('hello')</script>{% endtrans %}</p>
+1 −0
Original line number Diff line number Diff line
@@ -3,3 +3,4 @@ label: 'Help topic with untranslated text'
top_level: true
---
<p>Body goes here</p>
<p>{% trans %}some translated text too{% endtrans %}</p>
+6 −0
Original line number Diff line number Diff line
name: 'Help Topics Twig Tester'
type: module
description: 'Support module for help testing.'
package: Testing
dependencies:
  - drupal:help_topics
+6 −0
Original line number Diff line number Diff line
services:
  help_test_twig.extension:
    class: Drupal\help_topics_twig_tester\HelpTestTwigExtension
    arguments: []
    tags:
      - { name: twig.extension, priority: 500 }
+21 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\help_topics_twig_tester;

use Twig\Extension\AbstractExtension;

/**
 * Defines and registers Drupal Twig extensions for testing help topics.
 */
class HelpTestTwigExtension extends AbstractExtension {

  /**
   * {@inheritdoc}
   */
  public function getNodeVisitors() {
    return [
      new HelpTestTwigNodeVisitor(),
    ];
  }

}
Loading