Select, prettify publish snippets in multiple languages from within a GIST module

I posted how to include and prettify snippets from GAS, Gist, and scriptDB the other day, adding the ability to select particular functions from within modules. See the Excel liberation site for more detailWith Google Apps Script, we only had to worry about how to pick out functions from a javascript module. Now that Gists are supported – well, they could be any language. Turns out though that it’s pretty straightforward to add new languages. Here’s an example of selecting a couple of functions from a module of many VBA functions, stored in a gist.

which gives us the code snippet below.


Here’s the code that figures out where the functions start and finish. (This time we’re showing some javascript hosted in a Google Apps Script shared library)



Challenge for you
Anybody want to contribute appropriate regexes for other languages (or improve the basic ones being used here) to be able to find the beginning and end of functions? See the snippets above for how.



About brucemcp 225 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.

Be the first to comment

Leave a Reply

Your email address will not be published.


1 + nineteen =