File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,13 @@ class BibTexCommentStyle(CommentStyle):
272272
273273 MULTI_LINE = ("@Comment{" , "" , "}" )
274274
275+ class BladeCommentStyle (CommentStyle ):
276+ """Laravel Blade Template comment style."""
277+
278+ _shorthand = "blade"
279+
280+ MULTI_LINE = ("{{--" , "" , "--}}" )
281+ NEWLINE_AFTER = False
275282
276283class CCommentStyle (CommentStyle ):
277284 """C comment style."""
@@ -646,6 +653,15 @@ class VimCommentStyle(CommentStyle):
646653 k .lower (): v for k , v in EXTENSION_COMMENT_STYLE_MAP .items ()
647654}
648655
656+ #: A map of (common) double file extensions against comment types.
657+ EXTENSIONS_COMMENT_STYLE_MAP = {
658+ ".blade.php" : BladeCommentStyle ,
659+ }
660+
661+ EXTENSIONS_COMMENT_STYLE_MAP_LOWERCASE = {
662+ k .lower (): v for k , v in EXTENSIONS_COMMENT_STYLE_MAP .items ()
663+ }
664+
649665FILENAME_COMMENT_STYLE_MAP = {
650666 ".bashrc" : PythonCommentStyle ,
651667 ".coveragerc" : PythonCommentStyle ,
Original file line number Diff line number Diff line change 3535from . import SpdxInfo
3636from ._comment import (
3737 EXTENSION_COMMENT_STYLE_MAP_LOWERCASE ,
38+ EXTENSIONS_COMMENT_STYLE_MAP_LOWERCASE ,
3839 FILENAME_COMMENT_STYLE_MAP_LOWERCASE ,
3940 NAME_STYLE_MAP ,
4041 CCommentStyle ,
@@ -330,6 +331,9 @@ def find_and_replace_header(
330331def _get_comment_style (path : Path ) -> Optional [CommentStyle ]:
331332 """Return value of CommentStyle detected for *path* or None."""
332333 style = FILENAME_COMMENT_STYLE_MAP_LOWERCASE .get (path .name .lower ())
334+ if style is None :
335+ suffixes_lower = "" .join (path .suffixes ).lower ()
336+ style = EXTENSIONS_COMMENT_STYLE_MAP_LOWERCASE .get (suffixes_lower )
333337 if style is None :
334338 style = EXTENSION_COMMENT_STYLE_MAP_LOWERCASE .get (path .suffix .lower ())
335339 return style
You can’t perform that action at this time.
0 commit comments