Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add an option to strip presenter notes from output #107

Merged
merged 2 commits into from

2 participants

@aaugustin

When publishing a presentation on the web, I prefer not to include my personal notes, because they aren't written for publication.

Of course you're welcome to change the option name and the wording to suit your tastes.

@aaugustin aaugustin Add an option to strip presenter notes from output
Presenter notes often aren't suitable for publication.
cddad98
src/landslide/main.py
@@ -95,6 +95,13 @@ def _parse_options():
default=False)
parser.add_option(
+ "-P", "--no-presenter-notes",
+ action="store_false",
+ dest="presenter_notes",
+ help="Don't include presenter notes in the output",
+ default=False)
@adamzap Owner
adamzap added a note

Shouldn't this be default=True?

The tests still pass because you're testing the generator object and the bug is in the option parsing step.

Otherwise this patch looks great.

Thanks

Good catch, the default should be True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@adamzap
Owner

Great, thanks!

@adamzap adamzap merged commit 8fd5fee into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 24, 2012
  1. @aaugustin

    Add an option to strip presenter notes from output

    aaugustin authored
    Presenter notes often aren't suitable for publication.
Commits on May 4, 2012
  1. @aaugustin
This page is out of date. Refresh to see the latest.
View
5 src/landslide/generator.py
@@ -66,6 +66,7 @@ def __init__(self, source, **kwargs):
- ``encoding``: the encoding to use for this presentation
- ``extensions``: Comma separated list of markdown extensions
- ``logger``: a logger lambda to use for logging
+ - ``presenter_notes``: enable presenter notes
- ``relative``: enable relative asset urls
- ``theme``: path to the theme to use for this presentation
- ``verbose``: enables verbose output
@@ -79,6 +80,7 @@ def __init__(self, source, **kwargs):
self.encoding = kwargs.get('encoding', 'utf8')
self.extensions = kwargs.get('extensions', None)
self.logger = kwargs.get('logger', None)
+ self.presenter_notes = kwargs.get('presenter_notes', True)
self.relative = kwargs.get('relative', False)
self.theme = kwargs.get('theme', 'default')
self.verbose = kwargs.get('verbose', False)
@@ -346,7 +348,8 @@ def get_slide_vars(self, slide_src, source=None):
re.DOTALL | re.UNICODE | re.IGNORECASE)
if find:
- presenter_notes = content[find.end():].strip()
+ if self.presenter_notes:
+ presenter_notes = content[find.end():].strip()
content = content[:find.start()]
source_dict = {}
View
7 src/landslide/main.py
@@ -95,6 +95,13 @@ def _parse_options():
default=False)
parser.add_option(
+ "-P", "--no-presenter-notes",
+ action="store_false",
+ dest="presenter_notes",
+ help="Don't include presenter notes in the output",
+ default=True)
+
+ parser.add_option(
"-q", "--quiet",
action="store_false",
dest="verbose",
View
13 src/landslide/tests.py
@@ -135,6 +135,19 @@ def plop(foo):
self.assertRaises(TypeError, g.register_macro, plop)
+ def test_presenter_notes(self):
+ g = Generator(os.path.join(SAMPLES_DIR, 'example1', 'slides.md'))
+ svars = g.get_slide_vars("<h1>heading</h1>\n<p>foo</p>\n"
+ "<h1>Presenter Notes</h1>\n<p>bar</p>\n")
+ self.assertEquals(svars['presenter_notes'], "<p>bar</p>")
+
+ def test_skip_presenter_notes(self):
+ g = Generator(os.path.join(SAMPLES_DIR, 'example1', 'slides.md'),
+ presenter_notes=False)
+ svars = g.get_slide_vars("<h1>heading</h1>\n<p>foo</p>\n"
+ "<h1>Presenter Notes</h1>\n<p>bar</p>\n")
+ self.assertEquals(svars['presenter_notes'], None)
+
class CodeHighlightingMacroTest(BaseTestCase):
def setUp(self):
Something went wrong with that request. Please try again.