Skip to content
This repository has been archived by the owner on Jul 20, 2018. It is now read-only.

Commit

Permalink
add option at presenter
Browse files Browse the repository at this point in the history
  • Loading branch information
ogom committed Aug 27, 2012
1 parent 5cee2e0 commit 2644fbe
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 8 deletions.
35 changes: 30 additions & 5 deletions README.md
Expand Up @@ -3,7 +3,7 @@ Mcider

Mcider is to convert markdown into slideshow.

![mcider](https://github.com/ogom/python-mcider/raw/master/mcider.png)
![mcider](https://ogom.github.com/python-mcider/images/mcider.png)

### Examples of themes

Expand Down Expand Up @@ -32,22 +32,26 @@ Simple, the file is output to the same directory as the markdown.

$ mcider ./slide.md

If you wanted to display the WEB browser with the option of `-b`.
`-b` option is displayed in the web browser.

$ mcider ./slide.md -b

The output destination can be changed in the options `-o`.
`-o` option to change the location to save the file.

$ mcider ./slide.md -o /tmp/my.html

Theme is provided io2012 and io2011. Select the option `-t`.
`-t` option to change the theme of the slide.

$ mcider ./slide.md -t io2011

[Extensions](http://freewisdom.org/projects/python-markdown/Available_Extensions) of markdown is the options `-x`.
`-x` option to extend the markdown. [(Available Extensions)](http://freewisdom.org/projects/python-markdown/Available_Extensions)

$ mcider ./slide.md -x fenced_code tables

`--presenter` option is displayed in Presenter mode. Only theme `io2012`.

$ mcider ./slide.md -b --presenter


See also `mcider --help`.

Expand All @@ -65,6 +69,27 @@ io2012 or io2011 of the theme to change the class of article in the horizon.
*** | fill


### I/O 2012

#### Presenter note

converted to the presenter note from markdown comment tag.

```markdown
<!--
write a note here.
-->
```

```html
<aside class="note">
write a note here.
</aside>
```

![presenter](https://ogom.github.com/python-mcider/images/presenter.png)


## Examples

### Theme of io2012
Expand Down
Binary file removed mcider.png
Binary file not shown.
5 changes: 5 additions & 0 deletions mcider/cli_helper.py
Expand Up @@ -40,6 +40,11 @@
help='Theme was to clean the output.'
)

parser.add_argument(
'--presenter', action='store_true', default=False,
help='Presenter mode.'
)

parser.add_argument(
'--themes', metavar='PATH',
help='Path of the custom themes'
Expand Down
5 changes: 5 additions & 0 deletions mcider/converter.py
Expand Up @@ -125,6 +125,11 @@ def _get_slide_io2012(self, contents=None, extensions=[]):
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_io2011(self, contents=None, extensions=[]):
Expand Down
6 changes: 5 additions & 1 deletion mcider/main.py
Expand Up @@ -40,7 +40,11 @@ def main():
html = slide.maker(output_path)
util.fs_writer(output_file, html)
if args.browser:
webbrowser.open_new_tab('file://' + output_file)
url = 'file://' + output_file
if slide.options['theme'] == 'io2012':
url += '?presentme='
url += 'true' if args.presenter else 'false'
webbrowser.open_new_tab(url)
except KeyError as e:
print "KeyError: %s" % e
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -17,7 +17,7 @@ def set_install_requires():

setup(
name='mcider',
version='0.0.9',
version='0.1.0',
description='to convert markdown into slideshow',
license='Apache 2.0',
url='http://ogom.github.com/python-mcider',
Expand Down
7 changes: 6 additions & 1 deletion test/unit/converter_test.py
Expand Up @@ -22,9 +22,14 @@ def setUp(self):
def test_set_theme(self):
self.assertEqual(self.slide.options['theme'], 'io2012')

def test_get_slide(self):
def test_get_slide_base(self):
self.assertIsNotNone(self.slide._get_slide('io2012', self.contents, []))
#print self.slide._get_slide('io2012', self.contents, []).encode('utf-8')

def test_get_slide_note(self):
contents = util.fs_reader(os.path.join(test_path, 'fixtures', 'note.md'))
self.assertIsNotNone(self.slide._get_slide('io2012', contents, []))
#print self.slide._get_slide('io2012', contents, []).encode('utf-8')

if __name__ == '__main__':
unittest.main()

0 comments on commit 2644fbe

Please sign in to comment.