Skip to content

Commit

Permalink
Add support for XQuery file comments and extensions
Browse files Browse the repository at this point in the history
XQuery only supports multiline comments with a syntax currently
unsupported by the reuse-tool, see
<https://www.w3.org/TR/xquery-31/#comments>.

Close fsfe#583
  • Loading branch information
stexandev authored and carmenbianca committed Oct 12, 2022
1 parent 94a609a commit 28e1c54
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Contributors

- Pietro Albini <pietro.albini@ferrous-systems.com>

- Stefan Hynek <stefan.hynek@uni-goettingen.de>

Translators
-----------

Expand Down
17 changes: 17 additions & 0 deletions src/reuse/_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# SPDX-FileCopyrightText: 2021 Matija Šuklje <matija@suklje.name>
# SPDX-FileCopyrightText: 2022 Florian Snow <florian@familysnow.net>
# SPDX-FileCopyrightText: 2022 Nico Rikken <nico.rikken@fsfe.org>
# SPDX-FileCopyrightText: 2022 Stefan Hynek <stefan.hynek@uni-goettingen.de>
#
# SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -466,6 +467,17 @@ class VimCommentStyle(CommentStyle):
INDENT_AFTER_SINGLE = " "


class XQueryCommentStyle(CommentStyle):
"""XQuery comment style."""

_shorthand = "xq"

MULTI_LINE = MultiLineSegments("(:", ":", ":)")
INDENT_BEFORE_MIDDLE = " "
INDENT_AFTER_MIDDLE = " "
INDENT_BEFORE_END = " "


#: A map of (common) file extensions against comment types.
EXTENSION_COMMENT_STYLE_MAP = {
".adb": HaskellCommentStyle,
Expand Down Expand Up @@ -655,6 +667,11 @@ class VimCommentStyle(CommentStyle):
".xls": UncommentableCommentStyle,
".xlsx": UncommentableCommentStyle,
".xml": HtmlCommentStyle,
".xq": XQueryCommentStyle,
".xql": XQueryCommentStyle,
".xqm": XQueryCommentStyle,
".xqy": XQueryCommentStyle,
".xquery": XQueryCommentStyle,
".xsd": HtmlCommentStyle,
".xsh": PythonCommentStyle,
".xsl": HtmlCommentStyle,
Expand Down

0 comments on commit 28e1c54

Please sign in to comment.