@@ -1502,20 +1502,22 @@ comment_to_algebra({comment, _Meta, Lines}) ->
15021502 LinesD = lists :map (fun erlfmt_algebra :string /1 , Lines ),
15031503 fold_doc (fun erlfmt_algebra :line /2 , LinesD ).
15041504
1505-
1506-
1507-
15081505% % Detect comment banners (section dividers with === patterns)
15091506
1510-
1511-
1512- is_comment_banner ({comment , _Meta , [Line ]}) ->
1513- % % Single-line comments that contain at least 3 consecutive = characters
1514- string :find (Line , " ===" ) =/= nomatch ;
1515-
15161507is_comment_banner ({comment , _Meta , Lines }) ->
1517- % % Multi-line comments where any line contains at least 3 consecutive = characters
1518- lists :any (fun (Line ) -> string :find (Line , " ===" ) =/= nomatch end , Lines ).
1508+ % % A comment is a banner if:
1509+ % % 1. It has exactly 3 lines (delimiter, title, delimiter)
1510+ % % 2. First and last lines contain "==="
1511+ % % 3. Middle line(s) don't contain "==="
1512+ case Lines of
1513+ [First , Middle , Last ] ->
1514+ string :find (First , " ===" ) =/= nomatch andalso
1515+ string :find (Last , " ===" ) =/= nomatch andalso
1516+ string :find (Middle , " ===" ) =:= nomatch ;
1517+
1518+ _ ->
1519+ false
1520+ end .
15191521
15201522comments_with_pre_dot (Meta ) ->
15211523 {
0 commit comments