rst2odp icon indicating copy to clipboard operation
rst2odp copied to clipboard

Errof is First slide is missing body text

Open clach04 opened this issue 12 years ago • 6 comments

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

clach04 avatar May 04 '12 17:05 clach04

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.

mattharrison avatar May 04 '12 17:05 mattharrison

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

clach04 avatar May 04 '12 17:05 clach04

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?

mattharrison avatar May 04 '12 17:05 mattharrison

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

clach04 avatar May 04 '12 18:05 clach04

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

mattharrison avatar May 04 '12 18:05 mattharrison

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).

clach04 avatar May 04 '12 19:05 clach04