mattharrison / rst2odp

Create OpenOffice.org (impress) slideshows from restructured text (rst) or python
MIT License
27 stars 16 forks source link

Errof is First slide is missing body text #10

Open clach04 opened 12 years ago

clach04 commented 12 years ago

This file:

=================
Demo presentation
=================

Slide 2
=======

Previous slide was intro. NOTE the last slide had no body text.

Will fail with:

Could not import pygments code highlighting will not work
Traceback (most recent call last):
  File "E:\svn\rst2odp\rst2odp.py", line 992, in ?
    sys.exit(main(sys.argv) or 0)
  File "E:\svn\rst2odp\rst2odp.py", line 979, in main
    enable_exit_status=enable_exit_status)
  File "E:\svn\docutils\docutils\core.py", line 223, in publish
    output = self.writer.write(self.document, self.destination)
  File "E:\svn\docutils\docutils\writers\__init__.py", line 77, in write
    self.translate()
  File "E:\svn\rst2odp\rst2odp.py", line 124, in translate
    self.document.walkabout(self.visitor)
  File "E:\svn\docutils\docutils\nodes.py", line 173, in walkabout
    if child.walkabout(visitor):
  File "E:\svn\docutils\docutils\nodes.py", line 165, in walkabout
    visitor.dispatch_visit(self)
  File "E:\svn\rst2odp\rst2odp.py", line 181, in dispatch_visit
    nodes.GenericNodeVisitor.dispatch_visit(self, node)
  File "E:\svn\docutils\docutils\nodes.py", line 1611, in dispatch_visit
    return method(node)
  File "E:\svn\docutils\docutils\nodes.py", line 1688, in _call_default_visit
    self.default_visit(node)
  File "E:\svn\rst2odp\rst2odp.py", line 190, in default_visit
    raise NotImplementedError('node is %r, tag is %s' % (node, node.tagname))
NotImplementedError: node is <subtitle "slide 2": <#text: 'Slide 2'>>, tag is subtitle
mattharrison commented 12 years ago

Do the slides in doc/intro.rst work for you? I've never had a first slide without text in the body. Probably would be easy to patch so it works.

clach04 commented 12 years ago

Actually that fails miserably, it looks like it requires pygments in that test case:

E:\svn\rst2odp>rst2odp.py doc\intro.rst --traceback
Could not import pygments code highlighting will not work
Traceback (most recent call last):
  File "E:\svn\rst2odp\rst2odp.py", line 992, in ?
    sys.exit(main(sys.argv) or 0)
  File "E:\svn\rst2odp\rst2odp.py", line 979, in main
    enable_exit_status=enable_exit_status)
  File "E:\svn\docutils\docutils\core.py", line 223, in publish
    output = self.writer.write(self.document, self.destination)
  File "E:\svn\docutils\docutils\writers\__init__.py", line 77, in write
    self.translate()
  File "E:\svn\rst2odp\rst2odp.py", line 124, in translate
    self.document.walkabout(self.visitor)
  File "E:\svn\docutils\docutils\nodes.py", line 173, in walkabout
    if child.walkabout(visitor):
  File "E:\svn\docutils\docutils\nodes.py", line 173, in walkabout
    if child.walkabout(visitor):
  File "E:\svn\docutils\docutils\nodes.py", line 165, in walkabout
    visitor.dispatch_visit(self)
  File "E:\svn\rst2odp\rst2odp.py", line 181, in dispatch_visit
    nodes.GenericNodeVisitor.dispatch_visit(self, node)
  File "E:\svn\docutils\docutils\nodes.py", line 1611, in dispatch_visit
    return method(node)
  File "E:\svn\rst2odp\rst2odp.py", line 722, in visit_literal_block
    self.cur_slide.add_code(node_input, language)
  File "E:\svn\rst2odp\odplib\preso.py", line 631, in add_code
    output = pygments.highlight(code, lexers.get_lexer_by_name(language, stripall=True),
NameError: global name 'pygments' is not defined
mattharrison commented 12 years ago

Again, I always have pygments installed:) Feel free to create a pull request for handling missing pygments.

Can you try again with the code slide deleted?

clach04 commented 12 years ago

Removing the code avoids the pygments issue :-) I'll send you something for that one soon.

...but I still get a corrupted odp. I just saw a bunch of file opens in character mode (for read, the writes are binary). That may be it..... Have you done any testing with Windows (or wine and the win32 cpython)? Or reports from win users? I may be the first one

mattharrison commented 12 years ago

No, there was a patch a few months back see #7

clach04 commented 12 years ago

The pygments issue (not really relevant to this issue but came up as part of the discussion) has been hacked in my fork/branch https://github.com/clach04/rst2odp/commits/master - I've not yet made a pull request to get a feel for what you would expect the behavior to be.

I'm guessing the preferred behavior would be code without syntax highlighting (I've not yet worked out how to deal with that in docutils).