Show More
@@ -538,20 +538,20 b' class MarkupRenderer(object):' | |||||
538 | body = '\n'.join([header, css, js, body]) |
|
538 | body = '\n'.join([header, css, js, body]) | |
539 | return body, resources |
|
539 | return body, resources | |
540 |
|
540 | |||
541 |
|
|
541 | captured_errors = {} | |
542 |
|
|
542 | # TODO: In the event of a newer jupyter notebook version, consider increasing the as_version parameter | |
543 |
|
|
543 | notebook = nbformat.reads(source, as_version=4, capture_validation_error=captured_errors) | |
544 | try: |
|
544 | if captured_errors: | |
545 | (body, resources) = as_html(notebook) |
|
545 | error_messages = '<br>'.join(str(error) for error in captured_errors.values()) | |
546 | except AttributeError: |
|
546 | body = f""" | |
547 | error_messages = '<br>'.join(str(error) for error in captured_errors.values()) |
|
547 | <div style="text-align: center;"> | |
548 | body = f""" |
|
548 | <h3>Invalid Notebook!</h3> | |
549 | <div style="text-align: center;"> |
|
549 | <p>{error_messages}</p> | |
550 | <h3>Invalid Notebook!</h3> |
|
550 | </div> | |
551 | <p>{error_messages}</p> |
|
551 | """ | |
552 | </div> |
|
552 | else: | |
553 | """ |
|
553 | body, _ = as_html(notebook) | |
554 |
|
|
554 | return body | |
555 |
|
555 | |||
556 |
|
556 | |||
557 | class RstTemplateRenderer(object): |
|
557 | class RstTemplateRenderer(object): |
General Comments 0
You need to be logged in to leave comments.
Login now