Skip to content

Commit a35b8b9

Browse files
authored
Merge pull request #36 from minrk/heading-newlines
👌IMPROVE: add blank lines below headings
2 parents cfd0dc2 + 78452a9 commit a35b8b9

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

github_activity/github_activity.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,12 @@ def generate_activity_md(
394394
changelog_url = f"https://github.com/{org}/{repo}/compare/{since_ref}...{until_ref}"
395395

396396
# Build the Markdown
397-
md = [f"# {since}...{until}", f"([full changelog]({changelog_url}))", ""]
397+
md = [f"# {since}...{until}", "", f"([full changelog]({changelog_url}))"]
398398
for kind, info in prs.items():
399399
if len(info["md"]) > 0:
400400
md += [""]
401401
md.append(f"## {info['description']}")
402+
md += [""]
402403
md += info["md"]
403404

404405
# Add a list of author contributions
@@ -411,9 +412,11 @@ def generate_activity_md(
411412
gh_contributors_link = f"https://github.com/{org}/{repo}/graphs/contributors?from={data.since_dt:%Y-%m-%d}&to={data.until_dt:%Y-%m-%d}&type=c"
412413
md += [""]
413414
md += ["## Contributors to this release"]
415+
md += [""]
414416
md += [f"([GitHub contributors page for this release]({gh_contributors_link}))"]
415417
md += [""]
416418
md += [contributor_md]
419+
md += [""]
417420
md = "\n".join(md)
418421
return md
419422

@@ -486,12 +489,19 @@ def _get_datetime_and_type(org, repo, datetime_or_git_ref):
486489
dt = datetime.datetime.now().astimezone(pytz.utc)
487490
return (dt, False)
488491

489-
if _valid_git_reference_check(datetime_or_git_ref):
492+
try:
490493
dt = _get_datetime_from_git_ref(org, repo, datetime_or_git_ref)
491494
return (dt, True)
492-
else:
493-
dt = dateutil.parser.parse(datetime_or_git_ref)
494-
return (dt, False)
495+
except Exception as ref_error:
496+
try:
497+
dt = dateutil.parser.parse(datetime_or_git_ref)
498+
return (dt, False)
499+
except Exception as datetime_error:
500+
raise ValueError(
501+
"{0} not found as a ref or valid date format".format(
502+
datetime_or_git_ref
503+
)
504+
)
495505

496506

497507
def _get_datetime_from_git_ref(org, repo, ref):

tests/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ def test_cli(tmpdir, file_regression):
66
path_tmp = Path(tmpdir)
77
path_output = path_tmp.joinpath("out.md")
88

9-
url = "https://github.com/choldgraf/github-activity"
10-
org, repo = ("choldgraf", "github-activity")
9+
url = "https://github.com/executablebooks/github-activity"
10+
org, repo = ("executablebooks", "github-activity")
1111

1212
# CLI with URL
1313
cmd = f"github-activity {url} -s 2019-09-01 -u 2019-11-01 -o {path_output}"

tests/test_cli/test_cli.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
# master@{2019-09-01}...master@{2019-11-01}
2-
([full changelog](https://github.com/choldgraf/github-activity/compare/479cc4b2f5504945021e3c4ee84818a10fabf810...ed7f1ed78b523c6b9fe6b3ac29e834087e299296))
32

3+
([full changelog](https://github.com/executablebooks/github-activity/compare/479cc4b2f5504945021e3c4ee84818a10fabf810...ed7f1ed78b523c6b9fe6b3ac29e834087e299296))
44

55
## Merged PRs
6-
* defining contributions [#14](https://github.com/choldgraf/github-activity/pull/14) ([@choldgraf](https://github.com/choldgraf))
7-
* updating CLI for new tags [#12](https://github.com/choldgraf/github-activity/pull/12) ([@choldgraf](https://github.com/choldgraf))
8-
* fixing link to changelog with refs [#11](https://github.com/choldgraf/github-activity/pull/11) ([@choldgraf](https://github.com/choldgraf))
9-
* adding contributors list [#10](https://github.com/choldgraf/github-activity/pull/10) ([@choldgraf](https://github.com/choldgraf))
10-
* some improvements to `since` and opened issues list [#8](https://github.com/choldgraf/github-activity/pull/8) ([@choldgraf](https://github.com/choldgraf))
11-
* Support git references etc. [#6](https://github.com/choldgraf/github-activity/pull/6) ([@consideRatio](https://github.com/consideRatio))
12-
* adding authentication information [#2](https://github.com/choldgraf/github-activity/pull/2) ([@choldgraf](https://github.com/choldgraf))
13-
* Mention the required GITHUB_ACCESS_TOKEN [#1](https://github.com/choldgraf/github-activity/pull/1) ([@consideRatio](https://github.com/consideRatio))
6+
7+
* defining contributions [#14](https://github.com/executablebooks/github-activity/pull/14) ([@choldgraf](https://github.com/choldgraf))
8+
* updating CLI for new tags [#12](https://github.com/executablebooks/github-activity/pull/12) ([@choldgraf](https://github.com/choldgraf))
9+
* fixing link to changelog with refs [#11](https://github.com/executablebooks/github-activity/pull/11) ([@choldgraf](https://github.com/choldgraf))
10+
* adding contributors list [#10](https://github.com/executablebooks/github-activity/pull/10) ([@choldgraf](https://github.com/choldgraf))
11+
* some improvements to `since` and opened issues list [#8](https://github.com/executablebooks/github-activity/pull/8) ([@choldgraf](https://github.com/choldgraf))
12+
* Support git references etc. [#6](https://github.com/executablebooks/github-activity/pull/6) ([@consideRatio](https://github.com/consideRatio))
13+
* adding authentication information [#2](https://github.com/executablebooks/github-activity/pull/2) ([@choldgraf](https://github.com/choldgraf))
14+
* Mention the required GITHUB_ACCESS_TOKEN [#1](https://github.com/executablebooks/github-activity/pull/1) ([@consideRatio](https://github.com/consideRatio))
1415

1516
## Contributors to this release
16-
([GitHub contributors page for this release](https://github.com/choldgraf/github-activity/graphs/contributors?from=2019-09-01&to=2019-11-01&type=c))
1717

18-
[@betatim](https://github.com/search?q=repo%3Acholdgraf%2Fgithub-activity+involves%3Abetatim+updated%3A2019-09-01..2019-11-01&type=Issues) | [@choldgraf](https://github.com/search?q=repo%3Acholdgraf%2Fgithub-activity+involves%3Acholdgraf+updated%3A2019-09-01..2019-11-01&type=Issues) | [@consideRatio](https://github.com/search?q=repo%3Acholdgraf%2Fgithub-activity+involves%3AconsideRatio+updated%3A2019-09-01..2019-11-01&type=Issues)
18+
([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2019-09-01&to=2019-11-01&type=c))
19+
20+
[@betatim](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Abetatim+updated%3A2019-09-01..2019-11-01&type=Issues) | [@choldgraf](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2019-09-01..2019-11-01&type=Issues) | [@consideRatio](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2019-09-01..2019-11-01&type=Issues)

tests/test_cli/test_pr_split.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
# v0.7.1...v0.7.3
2-
([full changelog](https://github.com/executablebooks/jupyter-book/compare/v0.7.1...v0.7.3))
32

3+
([full changelog](https://github.com/executablebooks/jupyter-book/compare/v0.7.1...v0.7.3))
44

55
## New features added
6+
67
* ✨ NEW: Adding - chapter entries to _toc.yml [#817](https://github.com/executablebooks/jupyter-book/pull/817) ([@choldgraf](https://github.com/choldgraf))
78

89
## Enhancements made
10+
911
* 👌 IMPROVE: improving numbered sections [#826](https://github.com/executablebooks/jupyter-book/pull/826) ([@choldgraf](https://github.com/choldgraf))
1012
* ✨ NEW: Adding - chapter entries to _toc.yml [#817](https://github.com/executablebooks/jupyter-book/pull/817) ([@choldgraf](https://github.com/choldgraf))
1113
* checking for toc modification time [#772](https://github.com/executablebooks/jupyter-book/pull/772) ([@choldgraf](https://github.com/choldgraf))
1214
* first pass toc directive [#757](https://github.com/executablebooks/jupyter-book/pull/757) ([@choldgraf](https://github.com/choldgraf))
1315

1416
## Bugs fixed
17+
1518
* Fix typo in content-blocks.md documentation [#811](https://github.com/executablebooks/jupyter-book/pull/811) ([@MaxGhenis](https://github.com/MaxGhenis))
1619
* [BUG] Using relative instead of absolute links [#747](https://github.com/executablebooks/jupyter-book/pull/747) ([@AakashGfude](https://github.com/AakashGfude))
1720
* 🐛 FIX: fixing jupytext install/UI links [#737](https://github.com/executablebooks/jupyter-book/pull/737) ([@chrisjsewell](https://github.com/chrisjsewell))
1821

1922
## Documentation improvements
23+
2024
* 📚 DOC: update gh-pages + ghp-import docs [#814](https://github.com/executablebooks/jupyter-book/pull/814) ([@TomasBeuzen](https://github.com/TomasBeuzen))
2125
* 📚 DOC: note about licenses [#806](https://github.com/executablebooks/jupyter-book/pull/806) ([@choldgraf](https://github.com/choldgraf))
2226
* 📖 DOCS: Fix google analytics instructions [#799](https://github.com/executablebooks/jupyter-book/pull/799) ([@tobydriscoll](https://github.com/tobydriscoll))
@@ -27,6 +31,7 @@
2731
* typo fix [#731](https://github.com/executablebooks/jupyter-book/pull/731) ([@MaxGhenis](https://github.com/MaxGhenis))
2832

2933
## API and Breaking Changes
34+
3035
* ✨ NEW: Adding - chapter entries to _toc.yml [#817](https://github.com/executablebooks/jupyter-book/pull/817) ([@choldgraf](https://github.com/choldgraf))
3136
* removing config file numbered sections to use toc file instead [#768](https://github.com/executablebooks/jupyter-book/pull/768) ([@choldgraf](https://github.com/choldgraf))
3237

0 commit comments

Comments
 (0)