Selecting specific Gist and GAS functions for publication

In publishing gists and publishing Google Apps Scripts I showed how to prettify and embed  snippets in web sites, blogs and so on. However, one last requirement is to be able to publish only particular functions. Although you can select particular modules and libraries for publication, this is probably not granular enough for small snippets. So here’s how to select particular functions from a module for publication.

For gists.
Here’s how to select just a couple of functions out of  a Gist Module

http://xliberation.com/p/gaspubcontainer.html?
library=3665672&func=getSheetObj,getCache&source=gist

That gives us this

http://xliberation.com/p/gaspubcontainer.html?library=3665672&func=getSheetObj,getCache&source=gist

Here’s a GAS version – (in fact of the modules that process the func parameter requests)

http://xliberation.com/p/gaspubcontainer.html?
module=gasPub&library=mcpher&func=getFunction,getFunctions,getFunPos,getGeneralSource

http://xliberation.com/p/gaspubcontainer.html?module=gasPub&library=mcpher&func=getFunction,getFunctions,getFunPos,getGeneralSource

Parameters
You’ve probably figured out that functions can be selected by adding a func=x,y,z parameter to the URl for the container or the Google Apps Script link. That’s all there is to it. See the Excel liberation site for more detail.

Restrictions and coverage
For the moment, only javaScript (and GAS script functions) are selectable. At some later release I will update to include other languages. Although this post covers type=js, as used by the publisher container, this also work with type=json|jsonp|html.

Author: bm082975

Leave a Reply

Your email address will not be published. Required fields are marked *