Repository: pygments/pygments (Python)

Issue:
Doxygen comments in django/javascript code creating weird behaviour from lexer
With the following code as an example
```
/**
  * @param {*} cool
  */
func = function(cool) {
};

/**
 * @param {*} stuff
 */
fun = function(stuff) {
};
```

For some reason the first '*' in '{\*}' causes everything after it to be marked a Token.Comment until you hit the second '{\*}'. The weirder thing is the behaviour only happens if both '{\*}' are present. Remove either one of the '{\*}' and it works as expected. Is there a formatter, filter, or another lexer I'm supposed to use to help with doxygen comments?

I confirmed this by running it through the demo you have on your website.

Just to clarify I'm using the javascriptDjangoLexer and I see the behaviour already happen before my filters run so its not any of my custom filters or formatters making something weird happen.

For reference of the correctness of the commenting you can look at JSDoc [here](https://jsdoc.app/tags-param.html)


Discussion:
Well, `{* ... *}` and `{# ... #}` are comments for the Django template language.
the second statement is true as I found [here](https://docs.djangoproject.com/en/3.1/ref/templates/language/#comments) but I don't see docs supporting that `{* ... *}` are comments, do you have a link supporting your claim?
It looks like the lexer is mistaken there.  Do you want to make a PR to fix it?
Sure I can do that, it looks like it will be a one line fix from the code



Patch:
diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py
index a056728e4c..2327589a62 100644
--- a/pygments/lexers/templates.py
+++ b/pygments/lexers/templates.py
@@ -338,7 +338,7 @@ class DjangoLexer(RegexLexer):
             (r'[^{]+', Other),
             (r'\{\{', Comment.Preproc, 'var'),
             # jinja/django comments
-            (r'\{[*#].*?[*#]\}', Comment),
+            (r'\{#.*?#\}', Comment),
             # django comments
             (r'(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)'
              r'(\{%)(-?\s*)(endcomment)(\s*-?)(%\})',


Test patch:
diff --git a/tests/test_djangojavascript_lexer.py b/tests/test_djangojavascript_lexer.py
new file mode 100644
index 0000000000..a8fb197b59
--- /dev/null
+++ b/tests/test_djangojavascript_lexer.py
@@ -0,0 +1,41 @@
+import pytest
+
+from pygments.lexers.templates import JavascriptDjangoLexer
+from pygments.token import Comment
+
+
+@pytest.fixture(scope="module")
+def lexer():
+    yield JavascriptDjangoLexer()
+
+
+def test_do_not_mistake_JSDoc_for_django_comment(lexer):
+    """
+    Test to make sure the lexer doesn't mistake
+    {* ... *} to be a django comment
+    """
+    text = """/**
+               * @param {*} cool
+               */
+              func = function(cool) {
+              };
+               
+              /**
+               * @param {*} stuff
+               */
+              fun = function(stuff) {
+              };"""
+    tokens = list(lexer.get_tokens(text))
+    assert (
+        (
+            Comment,
+            """{*} cool
+               */
+              func = function(cool) {
+              };
+               
+              /**
+               * @param {*}""",
+        )
+        not in tokens
+    )