Slideshow Demo (000009)
XSSFilter could not parse (X)HTML:


<p>To see this as a Slideshow:</p>

<ul>
    <li>On Firefox install <a href="https://addons.mozilla.org/en-US/firefox/addon/4650">FullerScreen</a>
    <ul>
        <li>Supposedly it works in Opera out-of-the-box</li>
    </ul></li>
    <li>Go to <a href='/en/Slideshow_Demo.slides'>Slideshow_Demo.slides</a></li>
    <li>Press F11</li>
</ul>

<p>Once you are in the slideshow, it will look like this:</p>

<p><a href="http://media.freewisdom.org/etc/slideshow_demo.png"
 <img src="http://media.freewisdom.org/etc/slideshow_demo_small.png"/>
</a></p>

<p>Use "Page Up" and "Page Down" to navigate.</p>

<h2>S9-Style Slideshow in Sputnik</h2>

<h3>S9 is a tool written in Ruby</h3>

<ul>
    <li>Converts Markdown into a web presentation</li>
    <li>Requires FullerScreen</li>
    <li>https://addons.mozilla.org/en-US/firefox/addon/4650</li>
    <li>See http://slideshow.rubyforge.org/</li>
</ul>


<h2>We Likes It</h2>

<p>...but not so excited about Ruby</p>

<h3>Let's do the same in Sputnik</h3>

<p>(But kudos to S9 for showing us the way!)</p>

<h2>Make the Template</h2>

<ol>
    <li>Look at the HTML generated by S9</li>
    <li>Turn it into a Cosmo template</li>
    <li>Save it to http://sputnik.freewisdom.org/en/_templates_for_s9
    <ul>
        <li>set "prototype" to "@Lua_Config"</li>
    </ul></li>
</ol>

<p>The only complicated part is the <code>$do_slides</code>:</p>

<pre><code>$do_slides[=[
 <div class='slide'>
  <h1>$heading</h1>
  $content
 </div>
]=]
</code></pre>


<h2>Write an Action</h2>

<p>We'll also need an "action".</p>

<p>It's simple: most of the work is done by markdown</p>

<pre><code>module(..., package.seeall)

actions = {}
actions.slides = function(node, request, sputnik)
   require"markdown"
   local delim = "@@@@@@@@@@"
   local html = ("\n"..node.markup.transform(node.content).."<h2>"):gsub("<h2>", "\n"..delim.."\n<h2>").."\n"..delim
   return cosmo.f(node.templates.SLIDESHOW){
      title = node.title,
      do_slides = function()
                     for heading, content in html:gmatch("\n<h2>(.-)</h2>(.-)\n"..delim) do
                        cosmo.yield{heading=heading, content=content}
                     end
                  end
   }
end
</code></pre>

<p>Save this to <code>~/sputnik/share/lua/5.1/sputnik/actions/s9.lua</code></p>

<h2>Make a Slide Node</h2>

<h3>Let's make a node "Slideshow_Demo".  (Yes, this one.)</h3>

<ol>
    <li>Put the markdown-formatted presentation in the body.
    <ul>
        <li>Use H2 (<code>##</code>) as slide titles</li>
    </ul></li>
    <li>Set <code>templates</code> to <code>_templates_for_s9</code></li>
    <li>Set <code>actions</code> to <code>slides="s9.slides"</code></li>
</ol>

<p>Save.</p>

<h3>Check that Slideshow_Demo displays fine.  Then try "Slideshow_Demo.slides".</h3>

<p>(Remember that you need "FullerScreen" - https://addons.mozilla.org/en-US/firefox/addon/4650)</p>

<h2>It's Still a Wiki</h2>

<h3>Note that it's still a wiki</h3>

<p>Wikilinks work as long as we append ".slides to them"</p>

<p>For example: <a href='/en/Slideshow_Demo_2.slides'>Slideshow Demo 2</a></p>

<p>To do: no way to link to specific slides</p>

<h2>Things to Try Next</h2>

<h3>We can also create a prototype</h3>

<p>(Handy if we'll be making many slideshows).</p>

<ol>
    <li>Create a node "@Slideshow"</li>
    <li>Set <code>templates</code> to <code>_templates_for_s9</code></li>
    <li>Set <code>actions</code> to <code>slides="s9.slides"</code></li>
</ol>

<p>Then create new slideshow nodes by just setting <code>prototype</code> to `@Slideshow'</p>

Powered by Sputnik | XHTML 1.1