File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,13 @@ class BibTexCommentStyle(CommentStyle):
272
272
273
273
MULTI_LINE = ("@Comment{" , "" , "}" )
274
274
275
+ class BladeCommentStyle (CommentStyle ):
276
+ """Laravel Blade Template comment style."""
277
+
278
+ _shorthand = "blade"
279
+
280
+ MULTI_LINE = ("{{--" , "" , "--}}" )
281
+ NEWLINE_AFTER = False
275
282
276
283
class CCommentStyle (CommentStyle ):
277
284
"""C comment style."""
@@ -646,6 +653,15 @@ class VimCommentStyle(CommentStyle):
646
653
k .lower (): v for k , v in EXTENSION_COMMENT_STYLE_MAP .items ()
647
654
}
648
655
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
+
649
665
FILENAME_COMMENT_STYLE_MAP = {
650
666
".bashrc" : PythonCommentStyle ,
651
667
".coveragerc" : PythonCommentStyle ,
Original file line number Diff line number Diff line change 35
35
from . import SpdxInfo
36
36
from ._comment import (
37
37
EXTENSION_COMMENT_STYLE_MAP_LOWERCASE ,
38
+ EXTENSIONS_COMMENT_STYLE_MAP_LOWERCASE ,
38
39
FILENAME_COMMENT_STYLE_MAP_LOWERCASE ,
39
40
NAME_STYLE_MAP ,
40
41
CCommentStyle ,
@@ -330,6 +331,9 @@ def find_and_replace_header(
330
331
def _get_comment_style (path : Path ) -> Optional [CommentStyle ]:
331
332
"""Return value of CommentStyle detected for *path* or None."""
332
333
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 )
333
337
if style is None :
334
338
style = EXTENSION_COMMENT_STYLE_MAP_LOWERCASE .get (path .suffix .lower ())
335
339
return style
You can’t perform that action at this time.
0 commit comments