Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link PR and issues in README #13099

Merged
merged 2 commits into from
Jul 6, 2020
Merged

Link PR and issues in README #13099

merged 2 commits into from
Jul 6, 2020

Conversation

iota97
Copy link
Contributor

@iota97 iota97 commented Jul 5, 2020

This will make them clickable for now, not sure if is worth the trouble tho'.

@hrydgard
Copy link
Owner

hrydgard commented Jul 5, 2020

Readme becomes slightly more annoying to edit, but no big deal probably. I'll consider it.

@iota97
Copy link
Contributor Author

iota97 commented Jul 6, 2020

If needed this script can convert the README automatically (it check for the # to not have a [ before so it won't change already changed one), if you want I can just commit it.

#!/bin/python

import re
f = open("README.md", "r+")
cont = f.read()
updated = re.sub(r"([^[])#(\d+)", r"\1[#\2](https://github.com/hrydgard/ppsspp/issues/\2)", cont)
f.seek(0)
f.write(updated)
f.truncate()
f.close()

@hrydgard
Copy link
Owner

hrydgard commented Jul 6, 2020

Yeah, throw in the script, that's nice.

@hrydgard hrydgard merged commit 2a28842 into hrydgard:master Jul 6, 2020
@hrydgard
Copy link
Owner

hrydgard commented Jul 6, 2020

Though I just thought of something else, the .md is also used as the README.txt kind of equivalent, and it got a lot harder to read in raw text form with this unfortunately. Not that big of a deal though...

@iota97 iota97 deleted the readme-issues branch July 6, 2020 11:41
@Anuskuss
Copy link
Contributor

Thanks for implementing this @iota97. I'm late to the party but I've also written a python script but never submitted it, but after seeing your script I would like to nit-pick a little and recommend the use #!/usr/bin/env python instead of #!/bin/python.

I'm kinda disappointed that hovering over the urls doesn't reveal that issue/pr sneak peak with the title and description (like it does when referencing in comments) since that was be very useful when skimming through the changes. Well, maybe that would be a feature request for dear-github.

Though I just thought of something else, the .md is also used as the README.txt kind of equivalent, and it got a lot harder to read in raw text form with this unfortunately. Not that big of a deal though...

I already thought about that and have a solution for you. This solves two problems but could be considered hacky:

  • README becomes unreadable as text
  • Repo changes name breaking the links
#!/usr/bin/env python
import re

with open('README.md', 'r+') as f:
  md = re.sub('(?<!\[)#(\d+)', '[#\\1](/../../issues/\\1)', f.read())
  f.seek(0)
  f.write(md)
  f.truncate()

So this

What's new in 1.10.0
--------------------
* Graphics and compatibility fixes ([#12800](https://github.com/hrydgard/ppsspp/issues/12800), [#12670](https://github.com/hrydgard/ppsspp/issues/12670), [#12635](https://github.com/hrydgard/ppsspp/issues/12635), [#12857](https://github.com/hrydgard/ppsspp/issues/12857), [#12941](https://github.com/hrydgard/ppsspp/issues/12941), [#11898](https://github.com/hrydgard/ppsspp/issues/11898), [#12695](https://github.com/hrydgard/ppsspp/issues/12695), more)

becomes this

What's new in 1.10.0
--------------------
* Graphics and compatibility fixes ([#12800](/../../issues/12800), [#12670](/../../issues/12670), [#12635](/../../issues/12635), [#12857](/../../issues/12857), [#12941](/../../issues/12941), [#11898](/../../issues/11898), [#12695](/../../issues/12695), more)

@unknownbrackets
Copy link
Collaborator

FYI - the way to keep it readable in markdown, and also to add title previews, is this:

 * Graphics and compatibility fixes ([#12800][])

[#12800]: https://github.com/hrydgard/ppsspp/issues/12800 "x86jit: Force INF * 0 to +NAN #12800"

Which looks like this:

  • Graphics and compatibility fixes (#12800)

-[Unknown]

@Anuskuss
Copy link
Contributor

Wow, that's even cleaner (minus the repo changing the name though). Needs a more advanced script to fetch all the titles but should be easy enough. I can create one if you want to do it that way :)

@unknownbrackets
Copy link
Collaborator

Well, the only trouble with relative links is I don't think there's a way to specify a base path (<base href="https://www.google.com" /> doesn't work.) So if you're trying to keep it readable as a document outside github.com, the links won't work.

-[Unknown]

@iota97
Copy link
Contributor Author

iota97 commented Jul 15, 2020

Updated in #13153

About relative link I prefer to have it accessible from everywhere (it would broke it outside of github and on fork as well).

As URL are at the end of the file how long they are should not be a concern anymore, and if repo changes name a regex will fix it in no time anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants