@@ -76,6 +76,8 @@ def generate_tree_from_commits(
7676) -> Iterable [Dict ]:
7777 pat = re .compile (changelog_pattern )
7878 map_pat = re .compile (commit_parser , re .MULTILINE )
79+ body_map_pat = re .compile (commit_parser , re .MULTILINE | re .DOTALL )
80+
7981 # Check if the latest commit is not tagged
8082 latest_commit = commits [0 ]
8183 current_tag : Optional [GitTag ] = get_commit_tag (latest_commit , tags )
@@ -110,8 +112,8 @@ def generate_tree_from_commits(
110112 if not matches :
111113 continue
112114
115+ # Process subject from commit message
113116 message = map_pat .match (commit .message )
114- message_body = map_pat .search (commit .body )
115117 if message :
116118 parsed_message : Dict = message .groupdict ()
117119 # change_type becomes optional by providing None
@@ -122,9 +124,18 @@ def generate_tree_from_commits(
122124 if changelog_message_builder_hook :
123125 parsed_message = changelog_message_builder_hook (parsed_message , commit )
124126 changes [change_type ].append (parsed_message )
125- if message_body :
127+
128+ # Process body from commit message
129+ body_parts = commit .body .split ("\n \n " )
130+ for body_part in body_parts :
131+ message_body = body_map_pat .match (body_part )
132+ if not message_body :
133+ continue
126134 parsed_message_body : Dict = message_body .groupdict ()
135+
127136 change_type = parsed_message_body .pop ("change_type" , None )
137+ if change_type_map :
138+ change_type = change_type_map .get (change_type , change_type )
128139 changes [change_type ].append (parsed_message_body )
129140
130141 yield {"version" : current_tag_name , "date" : current_tag_date , "changes" : changes }
0 commit comments