Difference between revisions of "Widget:Google Document"

From Bogleheads
Jump to navigation Jump to search
m (Text replace - "{{Template:" to "{{")
(Added section.)
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
This widget allows you to add '''[http://documents.google.com/support/ Google Documents]''' to your wiki page.
 
This widget allows you to add '''[http://documents.google.com/support/ Google Documents]''' to your wiki page.
  
It was originally created by Sergey Chernyshev for [http://www.semanticcommunities.com/ Semantic Communities LLC.]
+
It was originally created by [[mediawikiwiki:User:Sergey Chernyshev|Sergey Chernyshev]] for [http://www.semanticcommunities.com/ Semantic Communities LLC.]
  
 
To insert this widget, use the following code:
 
To insert this widget, use the following code:
  
 
  <nowiki>{{#widget:</nowiki>{{PAGENAME}}<nowiki>
 
  <nowiki>{{#widget:</nowiki>{{PAGENAME}}<nowiki>
|key=dcn37mcz_34cvfjpmhf
+
|id=1hhpWRL4oyH6Aqf42laXo_lElObX_1JiaV4FMt8llA_U
 
|width=500
 
|width=500
 
|height=300
 
|height=300
Line 13: Line 13:
  
 
== Parameters ==
 
== Parameters ==
* '''docid''' - docID parameter in document URL
 
 
* '''width''' and '''height''' define document dimensions, 500x300 is default
 
* '''width''' and '''height''' define document dimensions, 500x300 is default
 +
* '''id''' - id parameter in URLs of the form: <nowiki>https://docs.google.com/document/d/(id)/edit?usp=sharing</nowiki> (published document)
 +
* '''Fid''' - id parameter in URLs of the form: <nowiki>https://docs.google.com/file/d/(Fid)/edit</nowiki> (uploaded file)
 +
* '''key''' - docID parameter used in old document URL (use it instead of '''id''' to embed old document)
  
{{Copy to your site}}
+
== Sample result ==
 +
{{#widget:{{PAGENAME}}
 +
|id=1hhpWRL4oyH6Aqf42laXo_lElObX_1JiaV4FMt8llA_U
 +
|width=500
 +
|height=300
 +
}}
  
 
== Related widgets ==
 
== Related widgets ==
Line 23: Line 30:
 
* [[Widget:Google Presentation|Google Presentation]] - for embedding presentations
 
* [[Widget:Google Presentation|Google Presentation]] - for embedding presentations
  
== Sample result ==
+
==Widget internals==
 
+
Widgets do not use [[mw:Help:Magic_words#Parser_functions|parser functions]]. Instead, a template programming language known as "Smarty" is used. Refer to the [https://www.smarty.net/docs/en/ Smarty 3 Manual] for the details.
{{#widget:{{PAGENAME}}
+
</noinclude><includeonly><iframe width="<!--{$width|escape:'html'|default:500}-->" height="<!--{$height|escape:'html'|default:300}-->" frameborder="1"  src="https://docs.google.com/<!--{if isset($id)}-->document/pub?id=<!--{$id|escape:'urlpathinfo'}-->&amp;embedded=1<!--{elseif isset($Fid)}-->file/d/<!--{$Fid|escape:'urlpathinfo'}-->/edit<!--{elseif isset($key)}-->View?docID=<!--{$key|escape:'urlpathinfo'}-->&hgd=1<!--{/if}-->"></iframe></includeonly>
|key=dcn37mcz_34cvfjpmhf
 
|width=500
 
|height=300
 
}}
 
</noinclude><includeonly><iframe width="<!--{$width|escape:'html'|default:500}-->" height="<!--{$height|escape:'html'|default:300}-->" frameborder="1"  src="http://docs.google.com/View?docID=<!--{$key|escape:'urlpathinfo'}-->&hgd=1"></iframe></includeonly>
 
 
<noinclude>[[Category:Widgets]]</noinclude>
 
<noinclude>[[Category:Widgets]]</noinclude>

Latest revision as of 17:21, 26 December 2020

This widget allows you to add Google Documents to your wiki page.

It was originally created by Sergey Chernyshev for Semantic Communities LLC.

To insert this widget, use the following code:

{{#widget:Google Document
|id=1hhpWRL4oyH6Aqf42laXo_lElObX_1JiaV4FMt8llA_U
|width=500
|height=300
}}

Parameters

  • width and height define document dimensions, 500x300 is default
  • id - id parameter in URLs of the form: https://docs.google.com/document/d/(id)/edit?usp=sharing (published document)
  • Fid - id parameter in URLs of the form: https://docs.google.com/file/d/(Fid)/edit (uploaded file)
  • key - docID parameter used in old document URL (use it instead of id to embed old document)

Sample result

Related widgets

Widget internals

Widgets do not use parser functions. Instead, a template programming language known as "Smarty" is used. Refer to the Smarty 3 Manual for the details.