Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add ability to skip individual slides #185

Merged
merged 1 commit into from

4 participants

@rafmagana

Sometimes one wants to see how the presentation looks like without some slides (mostly when we are uncertain about keeping slide or not) but one don't want to delete them, here's an example:

!SLIDE bullets incremental transition=fade skip

# Bullet Points #

* first point
* second point
* third point

what do you think?

@goncalossilva
Collaborator

I like this. I'm not sure if skip is better than ignore, but it's not really that important.

We're in the middle of a big discussion at PR #184. Maybe @burtlo could take a look at this and merge it with his branch?

Thanks!

@goncalossilva
Collaborator

A note about this on the README would be pretty cool, too.

@rafmagana

Are you talking about this? rafmagana@81a5669#diff-0

@goncalossilva
Collaborator

Yes. I have no idea how I missed that.

@burtlo

I will definitely add this feature to the branch I have created.

@rafmagana

@burtlo are you gonna use my commits or make the change yourself? Thanks anyways

@burtlo
@goncalossilva
Collaborator

git commit --author="Rafael Magana <rafmagana@gmail.com>" works, too :)

@rafmagana

That would be awesome, but I can add that functionality after your commits gets merged too. What do you think, @burtlo ?

@burtlo

@rafmagana currently the state of slide metadata has a poor implementation to support this feature.

I've updated the current implementation of Metadata.parse to use a list of parsers, which are simply classes that define the format of the metadata that is being captured.

Right now, there is no formal parsers registration, it's simply an entry in that list of classes.

So, if you would like to implement this functionality in the current setup I have you would:

  • Define a file in the lib/metadata folder, require it in the lib/metadata.rb file
  • Add it into the order of parsers, likely before CSSClasses, as that one swallows all terms to be CSS classes.
  • Add an attr_accessor for the skipping/ignoring

Then for the slide to be ignored/skipped, you will need to decide:

  • Do you want to have the slide ignored from the start, when it is parsed?

    Then you want to update the MarkdownSlideSplitter to simply not add slides with that metadata.

  • Do you want the slide to be included but simply not rendered?

    Then you want to likely create a new post renderer that could be initialized with the current state in the metadata and simply returns nil content. That will remote the content and that empty slide should be removed when the html content is compact'd and then join'd.

@rafmagana

@burtlo Cool, I will check your code out and add the functionality, should I fork your code and make a pull request to your repository? or how do you recommend me to do it?

@burtlo

Yes, @rafmagana fork my code and send me a pull request. That would be awesome!

@rafmagana

@burtlo ok, I will do it as soon as I have time, thanks!

@matthewmccullough matthewmccullough merged commit e68a92b into schacon:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 3, 2012
  1. @rafmagana
This page is out of date. Refresh to see the latest.
View
4 README.rdoc
@@ -166,6 +166,10 @@ definition, where tname is one of the following supported transitions:
The transitions are provided by jQuery Cycle plugin. See http://www.malsup.com/jquery/cycle/browser.html to view the effects and http://www.malsup.com/jquery/cycle/adv2.html for how to add custom effects.
+Here's a list of other available keywords:
+
+* skip - Skips slides marked with this keyword
+
You can manage the presentation with the following keys:
* space, cursor right: next slide
View
5 lib/showoff.rb
@@ -143,6 +143,9 @@ def <<(s)
def empty?
@text.strip == ""
end
+ def skip?
+ @classes.include? 'skip'
+ end
end
@@ -171,7 +174,7 @@ def process_markdown(name, content, static=false, pdf=false)
end
end
- slides.delete_if {|slide| slide.empty? }
+ slides.delete_if {|slide| slide.empty? || slide.skip? }
final = ''
if slides.size > 1
View
6 test/basic_test.rb
@@ -24,6 +24,12 @@ def app
assert_match '<h1>My Presentation</h1>', last_response.body
end
+ test "can skip slides" do
+ get '/slides'
+ assert last_response.ok?
+ assert_no_match /Skipped slide/, last_response.body
+ end
+
test "can get asset list" do
get '/assets_needed'
assert last_response.ok?
View
6 test/fixtures/simple/one/01_slide.md
@@ -7,3 +7,9 @@
* first point
* second point
* third point
+
+!SLIDE skip
+
+# Skipped slide
+
+This won't show up
Something went wrong with that request. Please try again.