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.
Here’s how to select just a couple of functions out of a Gist Module
https://storage.googleapis.com/toasty/p/gaspubcontainer.html?library=3665672&func=getSheetObj,getCache&source=gist
That gives us this
Here’s a GAS version – (in fact of the modules that process the func parameter requests)
https://storage.googleapis.com/toasty/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.
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.