Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #107 from aaugustin/master

Add an option to strip presenter notes from output
  • Loading branch information...
commit 8fd5feeffa0b18222c62893b6851cf820b52a101 2 parents f5dd864 + f1bcfed
@adamzap authored
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)
@@ -349,7 +351,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):
Please sign in to comment.
Something went wrong with that request. Please try again.