Skip to content

Commit

Permalink
Support hyperlinks for restructured text file format
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Dec 1, 2023
1 parent 140ca24 commit 1a6b421
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
9 changes: 9 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Commit History
==============

0.5.3 (11/30/2023)
------------------
- Support hyperlinks for restructured text file format

0.5.2 (10/25/2023)
------------------
- Update release_notes.rst and cleanup

0.5.1 (10/25/2023)
------------------
- Reduce redundancy in looping through `git tag`
Expand Down Expand Up @@ -36,6 +44,7 @@ Commit History

0.4.5 (08/30/2023)
------------------
- Restructure version naming in output files
- Set return type to None from NoReturn
- Upgrade to latest flake8 and isort
- Bump version
Expand Down
2 changes: 1 addition & 1 deletion gitverse/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "2.9"
version = "3.0"
5 changes: 4 additions & 1 deletion gitverse/models/callables.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
options = {'debug': False, 'reverse': False, 'start': 0.0}
import re

md_link_pattern = re.compile(r'\[([^\]]+)]\(([^)]+)\)') # noqa
options = {'debug': False, 'reverse': False, 'start': 0.0, 'ext': None}
13 changes: 11 additions & 2 deletions gitverse/releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from gitverse import version as pkg_version
from gitverse.models import debugger
from gitverse.models.auth_bearer import BearerAuth
from gitverse.models.callables import options
from gitverse.models.callables import md_link_pattern, options


def get_api_releases() -> Dict[str, List[str]]:
Expand Down Expand Up @@ -135,6 +135,8 @@ def generate_snippets() -> List[str]:
line2 = "-" * len(line1)
description = []
for desc in each_tag['description']:
if options['ext'] == '.rst':
desc = md_link_pattern.sub(r'`\1 <\2>`_', desc)
if desc.startswith('-'):
description.append(desc)
else:
Expand Down Expand Up @@ -209,11 +211,18 @@ def main(*args, reverse: str = None, debug: str = None,
return

if filename is None:
filename = 'ReleaseNotes'
filename = 'release_notes.md'
if title is None:
title = 'Release Notes'
if env is None:
env = '.env'

name, extension = os.path.splitext(filename.lower())
if name and extension in ('.rst', '.md'):
options['ext'] = extension
else:
debugger.info("Module generates the notes in markdown or restructured text format")
debugger.warning(f"Using {filename!r} may render unexpected format")
kwargs = dict(dotenv_path=env, override=True, verbose=False)
if options['debug']:
kwargs['verbose'] = True
Expand Down
4 changes: 4 additions & 0 deletions release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release Notes
=============

v3.0 (11/30/2023)
-----------------
- Support hyperlinks for restructured text file format

v2.9 (10/25/2023)
-----------------
- Reduces redundancy and improves reliability
Expand Down

0 comments on commit 1a6b421

Please sign in to comment.