Hard Light Productions Forums
Site Management => Site Support / Feedback => Topic started by: jg18 on June 14, 2021, 01:01:18 pm
-
It would be handy to have an easy way to insert references to FSO GitHub issues (https://github.com/scp-fs2open/fs2open.github.com/issues) and pull requests (https://github.com/scp-fs2open/fs2open.github.com/pulls). How about a new "gh" tag?
Suggested syntax
[gh]Issue #3336[/gh]
would turn into
Issue #3336 (https://github.com/scp-fs2open/fs2open.github.com/issues/3336)
and
[gh]PR #3398[/gh]
would turn into
PR #3398 (https://github.com/scp-fs2open/fs2open.github.com/pull/3398)
If "gh" is confusing, the tag could be "github" instead.
Thoughts?
-
I don't know exactly what would be needed to be done to implement this... but I bet I know enough of the relevant languages to figure it out if given the access, and would be willing to take a crack at it if the existing admin pool thinks this is a good idea but not one they're prepared to dive into.
-
The forum is written in PHP, and the code is publicly downloadable at simplemachines.org. Here's how the URL tag is set up:
array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener noreferrer">$1</a>',
'validate' => function(&$tag, &$data, $disabled)
{
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = '//' . $data;
},
),
-
Done. I've used a simple regex to find the # number which means that "PR #123" and "PR #123: Some test" work but "PR #123a" doesn't. "Did you look at #123 already?" would work as well. Just make sure that your text contains #<number><some kind of separator like " ", ":", ".", ...> somwhere.
The current tag always links to the FSO repo. I could add [gh=pcs2], [gh=knossos], ... as well if there's interest.
EDIT: I've also added the gh and fsolog tags to the toolbar as well since I keep forgetting them.
-
Sweet! It works great. :D Thanks, ngld! :yes: