Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Nov 08, 2012
@mccuneware mccuneware Hack to add "bnr" theme.
This is a hack to be able to use a bnr theme. There's probably a better way to modify this to allow any theme to used at any time. But I haven't taken the time to look into it yet and I'm not a pythonista. Eventually, I (or someone) will look into this.
7fbd42e
Showing with 58 additions and 2 deletions.
  1. +57 −1 mcider/converter.py
  2. +1 −1  mcider/main.py
View
58 mcider/converter.py
@@ -13,7 +13,7 @@ class Slide():
""" opts
.themes themes path
- .theme io2012(default) or io2011
+ .theme io2012(default) or io2011 or bnr
.contents
.extensions extra fenced_code tables, ...
.clean (boolean, default False)
@@ -59,6 +59,8 @@ def _get_slide(self, theme=None, contents=None, extensions=[]):
html = self._get_slide_io2011(contents, extensions)
elif theme == 'io2012':
html = self._get_slide_io2012(contents, extensions)
+ elif theme == 'bnr':
+ html = self._get_slide_bnr(contents, extensions)
else:
html = self._get_slide_none(contents, extensions)
return html
@@ -79,6 +81,60 @@ def _get_slide_none(self, contents=None, extensions=[]):
html += '</article>\n\n'
return html
+ def _get_slide_bnr(self, contents=None, extensions=[]):
+ """ bnr style """
+ md = Markdown(extensions=extensions)
+ splits = [
+ {'horizon': '---', 'style': 'none'},
+ {'horizon': '___', 'style': 'smaller'},
+ {'horizon': '***', 'style': 'fill'}
+ ]
+
+ styles = []
+ for split in splits:
+ styles.append(split['style'])
+ horizon = '\n' + split['horizon'] + '\n'
+ contents = contents.replace(horizon, '\n---\n' + split['style'] + '\n')
+
+ pages = contents.split('\n---\n')
+
+ # from pages to slides
+ slides = []
+ for page in pages:
+ sections = page.split('\n\n', 2)
+ slide = {}
+ if not sections[0] in styles:
+ if len(sections) > 2:
+ sections[1] += '\n\n' + sections[2]
+ sections.insert(0, 'none')
+ slide['style'] = sections[0]
+ if len(sections) > 1:
+ slide['hgroup'] = sections[1]
+ if len(sections) > 2:
+ slide['article'] = sections[2]
+ slides.append(slide)
+
+ # from slides to html
+ html = '\n'
+ for slide in slides:
+ html += '<slide>\n'
+ if slide.has_key('hgroup'):
+ html += '<hgroup>\n'
+ html += md.convert(slide['hgroup']) + '\n'
+ html += '</hgroup>\n'
+ if slide.has_key('article'):
+ html += '<article class="' + slide['style'] + '">\n'
+ html += md.convert(slide['article']) + '\n'
+ html += '</article>\n'
+ html += '</slide>\n\n'
+
+ # from comment out to presener note
+ html = html.replace('\n<!--\n', '\n<aside class="note">\n')
+ html = html.replace('\n-->\n', '\n</aside>\n')
+
+ return html
+
+
def _get_slide_io2012(self, contents=None, extensions=[]):
""" io-2012 style """
md = Markdown(extensions=extensions)
View
2  mcider/main.py
@@ -41,7 +41,7 @@ def main():
util.fs_writer(output_file, html)
if args.browser:
url = 'file://' + output_file
- if slide.options['theme'] == 'io2012':
+ if slide.options['theme'] == 'io2012' or slide.options['theme'] == 'bnr':
url += '?presentme='
url += 'true' if args.presenter else 'false'
webbrowser.open_new_tab(url)

No commit comments for this range

Something went wrong with that request. Please try again.