@@ -384,53 +384,31 @@ def _get_metadata() -> typing.Dict:
384384 email = raw_author_list [- 1 ].replace (">" , "" )
385385 metadata = conf ["tool" ]["qgis-plugin" ]["metadata" ].copy ()
386386
387- path = LOCAL_ROOT_DIR / "CHANGELOG.md"
388- with path .open () as fh :
389- changelog_file = fh .read ()
390-
391387 metadata .update (
392388 {
393389 "author" : author ,
394390 "email" : email ,
395391 "description" : poetry_conf ["description" ],
396392 "version" : poetry_conf ["version" ],
397393 "tags" : ", " .join (metadata .get ("tags" , [])),
398- "changelog" : _parse_changelog (
399- changelog_file , poetry_conf ["version" ]
400- ),
394+ "changelog" : _changelog (),
401395 }
402396 )
403397 return metadata
404398
405399
406- def _parse_changelog (changelog : str , version : str ) -> str :
407- """ Parses the text changelog into a format that can be
408- used inside the metadata.txt plugin file.
400+ def _changelog () -> str :
401+ """ Reads the changelog content from a config file.
409402
410- :param changelog: Plugin changelog
411- :type changelog: str
403+ :returns: Plugin changelog
404+ :type: str
405+ """
406+ path = LOCAL_ROOT_DIR / "docs/plugin/changelog.txt"
412407
413- :param version: Plugin version
414- :type version: str
408+ with path . open () as fh :
409+ changelog_file = fh . read ()
415410
416- :return changelog: Formatted plugin changelog
417- :type changelog: str
418- """
419- usable_fragment = changelog .partition (
420- f"[{ version } ]" )[- 1 ].partition ("[draft]" )[
421- 0
422- ]
423- if usable_fragment != "" :
424- no_square_brackets = re .sub (
425- r"(\[(\d+.\d+.\d+)\])" ,
426- "\g<2>" ,
427- usable_fragment )
428- result = f"{ version } { no_square_brackets } " . \
429- replace ("# " , "" ). \
430- replace ("#" , "" )
431- else :
432- result = ""
433- return result
411+ return changelog_file
434412
435413
436414def _add_to_zip (
0 commit comments