Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comment Style for Django template langauage #1259

@stroebjo

Description

@stroebjo

Django templates usually also use the file extension .html. While inside those files the HTML comments (<!-- … -->) do work, if a projects has multiple template snippets for each snippet the REUSE header would be printed in the HTML sent to the user agent.

I would suggest to add an DjangoCommentStyle that can be selected for reuse annotate. Django template comments can be written in:

  • single line: {# … #}
  • multi line: {% comment %} … {% endcomment %}

I'm not sure what is preferable, to use the line comments multiple times, or the multi line comment block?

{% comment %}
SPDX-FileCopyrightText: …

SPDX-License-Identifier: …
{% endcomment %}

…
{# SPDX-FileCopyrightText: … #}
{# #}
{# SPDX-License-Identifier: … #}

…

Django templates can start with an {% extends "…" %} tag for extending from a different template file. This tag has to be always the first line a template, so in this case the REUSE header would need to be after that line, this could probably achieved with the shebang setting in the CommentStyle?

I'm happy to prepare a PR if this would be included.

Metadata

Metadata

Assignees

No one assigned

    Labels

    comment-stylesRequest for a new comment style, or fixing a bug with these

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions