ElkArte Community

General => Site Feedback => Topic started by: Joshua Dickerson on August 08, 2015, 01:42:05 am

Title: Gist BBC
Post by: Joshua Dickerson on August 08, 2015, 01:42:05 am
I think it would be cool to add a gist BBC here.

[gist https://gist.github.com/joshuaadickerson/fea8b2dd1a5ca756f6a0[/gist] would become <script src="https://gist.github.com/joshuaadickerson/fea8b2dd1a5ca756f6a0.js"></script> and would embed a gist in the page.

Add a hook on integrate_bbc_codes. Add a new file https://gist.github.com/joshuaadickerson/376d510c9d752e9b290a (a gist)

FYI: I wrote that function in the GH editor and didn't test it.
Title: Re: Gist BBC
Post by: Spuds on August 09, 2015, 06:41:55 am
Cool idea :D
Title: Re: Gist BBC
Post by: Spuds on August 09, 2015, 08:35:31 am
There you go
[gist]https://gist.github.com/joshuaadickerson/376d510c9d752e9b290a[/gist]
Title: Re: Gist BBC
Post by: emanuele on August 09, 2015, 08:41:29 am
I would validate the url starts with "https://gist.github.com", otherwise it would be a risk. ;)
Title: Re: Gist BBC
Post by: Spuds on August 09, 2015, 08:47:57 am
Fair point ... removed it for now to be safe !

Code: [Select]
		'content' => '<script src="https://gist.github.com/$1.js"></script>',
and
Code: [Select]
			$data = parse_url($data, PHP_URL_PATH);
would probably do :/

Title: Re: Gist BBC
Post by: meetdilip on August 09, 2015, 10:01:08 am
What exactly is this ?
Title: Re: Gist BBC
Post by: emanuele on August 09, 2015, 10:29:14 am
Guess so @Spuds !
Title: Re: Gist BBC
Post by: Spuds on August 09, 2015, 11:33:39 am
Redone with that update ...Now that its back on, just look up in the thread for the example http://www.elkarte.net/community/index.php?topic=2820.msg19268#msg19268
Title: Re: Gist BBC
Post by: Joshua Dickerson on August 09, 2015, 02:47:09 pm
Good catch @emanuele. Thanks @Spuds.

Now I think I'm much more likely to use Gist over code tags. Just a nicer way of presenting code and keeping track of the changes.
Title: Re: Gist BBC
Post by: Joshua Dickerson on August 14, 2015, 05:35:54 pm
When I do
Code: [Select]
[gist]https://gist.github.com/joshuaadickerson/c528aae77d1cf0de029d[/gist]
I get
Code: [Select]
<script src="https://gist.github.com//joshuaadickerson/c528aae77d1cf0de029d.js"></script>


PS: how do you specify the language for code tags? Or is that not doable anymore?
Title: Re: Gist BBC
Post by: Spuds on August 14, 2015, 06:59:24 pm
Thats a big old gist ... looks like an extra / getting added.  I'll take a look tommorrow and see whats going on.

I can't remember on the code language, but pretty print is built in for the highlighting these days so it may have been depreciated.
Title: Re: Gist BBC
Post by: Spuds on August 15, 2015, 06:06:33 am
Test:

[gist]https://gist.github.com/joshuaadickerson/c528aae77d1cf0de029d[/gist]
Title: Re: Gist BBC
Post by: Flavio93Zena on August 15, 2015, 10:12:45 am
That's probably the longest message I have ever seen... #_#
Title: Re: Gist BBC
Post by: Joshua Dickerson on August 15, 2015, 12:48:10 pm
Yeah, I wonder if gist has a limit
Title: Re: Gist BBC
Post by: Flavio93Zena on August 15, 2015, 12:58:57 pm
I think it would worth adding it, at least for template sake ;D
Title: Re: Gist BBC
Post by: Joshua Dickerson on August 15, 2015, 01:49:36 pm
Hopefully nobody does something as stupid as I tried to do ;)
Title: Re: Gist BBC
Post by: live627 on August 15, 2015, 02:15:10 pm
You can never tell with coders (and geeks). Breaking things is our pastime :D
Title: Re: Gist BBC
Post by: Spuds on August 15, 2015, 02:44:30 pm
I put in a max height so each gist will be a bit better controlled, so at least the page layout is not crazy long.