Author Topic: Suggestion: Add a "gh" BBCode tag for easy reference to FSO GitHub Issues/PRs  (Read 201 times)

0 Members and 1 Guest are viewing this topic.

Offline jg18

  • A very happy zod
  • 210
  • can do more than spellcheck
Suggestion: Add a "gh" BBCode tag for easy reference to FSO GitHub Issues/PRs
It would be handy to have an easy way to insert references to FSO GitHub issues and pull requests. How about a new "gh" tag?

Suggested syntax

Code: [Select]
[gh]Issue #3336[/gh]

would turn into

Issue #3336

and

Code: [Select]
[gh]PR #3398[/gh]

would turn into

PR #3398

If "gh" is confusing, the tag could be "github" instead.

Thoughts?

 

Offline EatThePath

  • 27
  • Laser Lich
Re: Suggestion: Add a "gh" BBCode tag for easy reference to FSO GitHub Issues/PRs
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.
"if disco is dead then I am the laser lich"
"...[Warmachine] keeps changing as fast as EatThePath can force the engine to do his dark bidding..."

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: Suggestion: Add a "gh" BBCode tag for easy reference to FSO GitHub Issues/PRs
The forum is written in PHP, and the code is publicly downloadable at simplemachines.org.  Here's how the URL tag is set up:

Code: [Select]
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;
},
),

 

Offline ngld

  • Administrator
  • 29
  • Knossos dev
Re: Suggestion: Add a "gh" BBCode tag for easy reference to FSO GitHub Issues/PRs
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.
« Last Edit: July 09, 2021, 02:57:30 pm by ngld »

  

Offline jg18

  • A very happy zod
  • 210
  • can do more than spellcheck
Re: Suggestion: Add a "gh" BBCode tag for easy reference to FSO GitHub Issues/PRs
Sweet! It works great. :D Thanks, ngld! :yes: