Can I embed a Google Doc into a FogBugz wiki page? - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com 2013-05-18T12:10:20Z http://fogbugz.stackexchange.com/feeds/question/10523 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://fogbugz.stackexchange.com/questions/10523/can-i-embed-a-google-doc-into-a-fogbugz-wiki-page Can I embed a Google Doc into a FogBugz wiki page? Ben McCormack 2012-06-21T15:57:47Z 2012-06-21T16:01:48Z <p>I would like to embed a Google Doc into a FogBugz wiki page? Can I do it?</p> http://fogbugz.stackexchange.com/questions/10523/can-i-embed-a-google-doc-into-a-fogbugz-wiki-page/10524#10524 Answer by Ben McCormack for Can I embed a Google Doc into a FogBugz wiki page? Ben McCormack 2012-06-21T16:01:48Z 2012-06-21T16:01:48Z <p>FogBugz doesn't really support this out of the box (it will rewrite iFrames if you try to paste them in. However, you can use a simple BugMonkey script to replace google doc links with embedded doc links on view. I tried this out with google spreadsheets. Here's the finished result:</p> <p><img src="http://i.imgur.com/H6Je3.png" alt="alt text"></p> <p>First, I went to <a href="http://support.google.com/docs/bin/answer.py?hl=en&amp;answer=55244" rel="nofollow">http://support.google.com/docs/bin/answer.py?hl=en&amp;answer=55244</a> to learn how to publish a spreadsheet to html. This is what my config looked like:</p> <p><img src="http://i.imgur.com/qPNQY.png" alt="alt text"></p> <p>Next, I added inserted a link using that URL to where I want the spreadsheet to appear in the wiki page.</p> <p>The final step is to add a BugMonkey script (My Settings > Customizations) to append an iFrame for the document after the link:</p> <pre><code>name: Insert Google Doc into Wiki description: Finds Google Doc links within a Wiki article and embeds the published Doc into the wiki author: Ben McCormack version: 1.0.0.0 minApi: 1.0 js: $(document).ready(function(){ //make sure we're on the view wiki page, not editing if ($('a#idViewArticle.selected').length === 0) { return; } var toMatch = /\bhttps:\/\/docs\.google\.com.*pub\?key=.*html\b/i; var matches = $('a[href*="https://docs.google.com/"]').filter(function(){ return $(this).attr('href').match(toMatch); }); $(matches).each(function() { var href = $(this).attr('href'); var iframe = '&lt;iframe src="' + href + '"width="800" height="600" frameborder="0"&gt;&lt;/iframe&gt;'; var replaceWith = $(this).clone().wrap('&lt;p&gt;').parent().html() + "&lt;br/&gt;" + iframe; $(this).after(iframe); }); }); css: /* body { background-color: red !important; } */ </code></pre> <p>I haven't tested this on different types of documents, but the regex seemed to work for the spreadsheet I published.</p>