Skip to content

Commit

Permalink
showoff.json: if it starts with '#' it's not a file name, it's raw ma…
Browse files Browse the repository at this point in the history
…rkdown
  • Loading branch information
alexch committed Jul 27, 2011
1 parent efd7d80 commit ee20a61
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
22 changes: 18 additions & 4 deletions README.rdoc
Expand Up @@ -33,7 +33,7 @@ It might will can:
* broadcast itself on Bonjour
* let audience members download slides, code samples or other supplementary material
* let you write on the slide with your mouse, madden-style via canvas
* automatically resize text to fit screen
* automatically resize text to fit screen [see Alex's shrink.js]

Some of the nice things are that you can easily version control it, you
can easily move sections between presentations, and you can rearrange or
Expand Down Expand Up @@ -87,14 +87,28 @@ second is faded into view showing the title and three bullets that are then
incrementally shown. In order for ShowOff to see those slides, your
<tt>showoff.json</tt> file needs to look something like this:

[
{"section":"one"}
]
{
"name": "Something",
"description": "Example Presentation",
"sections": [
{"section":"one"},
]
}

If you have multiple sections in your talk, you can make this json array
include all the sections you want to show in which order you want to show
them.

Instead of a hash, you can use a plain string as an entry in the `sections`
section of `showoff.json`.

And if that plain string starts with '#' then it is interpreted not as a
filename, but as markdown. This is used for inserting interstitial slides
or notes -- for instance, Alex Chaffee's
[Ruby Notes](http://github.com/alexch/ruby_notes)
uses it to insert lab instructions between lecture slide sections, which may
vary from venue to venue.

If you want to keep the ability to emit an HTML document from your
Markdown source file -- say, for a TextMate preview or a GitHub rendering
-- you can use angle brackets around the `!SLIDE` keyword and styles, e.g.
Expand Down
23 changes: 14 additions & 9 deletions lib/showoff.rb
Expand Up @@ -243,17 +243,22 @@ def update_commandline_code(slide)

def get_slides_html(static=false, pdf=false)
sections = ShowOffUtils.showoff_sections(options.pres_dir)
files = []
if sections
sections.each do |section|
files << load_section_files(section)
end
files = files.flatten
files = files.select { |f| f =~ /.md$/ }
data = ''
files.each do |f|
fname = f.gsub(options.pres_dir + '/', '').gsub('.md', '')
data += process_markdown(fname, File.read(f), static, pdf)
sections.each do |section|
if section =~ /^#/
name = section.each_line.first.gsub(/^#*/,'').strip
data << process_markdown(name, "<!SLIDE subsection>\n" + section, static, pdf)
else
files = []
files << load_section_files(section)
files = files.flatten
files = files.select { |f| f =~ /.md/ }
files.each do |f|
fname = f.gsub(options.pres_dir + '/', '').gsub('.md', '')
data << process_markdown(fname, File.read(f), static, pdf)
end
end
end
end
data
Expand Down

0 comments on commit ee20a61

Please sign in to comment.