##// END OF EJS Templates
Fix issue #5877 with tests...
Fix issue #5877 with tests This pull request prevent to have lists environments inside the headings cells which break latex code. - First, the function `markdown2latex` has been changed in order to accept a markup keyword for pandoc reader, default to `markdown` as before(`test_markdown.py` updated too). - Headings cells are treated with markup `markdown_strict+tex_math_dollars` to remove enhancements of pandoc for lists and add math support. - Secondly, `prevent_list_blocks` filter escape characters `. - * +` in headings cells to prevent `enumerate` or `itemize` environments in latex sections(test added in `test_strings.py` Test files accessible at: <https://gist.github.com/benjaminabel/4a40d1300dcf087c8695&gt;

File last commit:

r17639:973125a7
r18427:7b2e741d
Show More
widget_selectioncontainer.py
67 lines | 2.1 KiB | text/x-python | PythonLexer
/ IPython / html / widgets / widget_selectioncontainer.py
"""SelectionContainer class.
Represents a multipage container that can be used to group other widgets into
pages.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from .widget_box import Box
from IPython.utils.traitlets import Unicode, Dict, CInt
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class _SelectionContainer(Box):
"""Base class used to display multiple child widgets."""
_titles = Dict(help="Titles of the pages", sync=True)
selected_index = CInt(0, sync=True)
# Public methods
def set_title(self, index, title):
"""Sets the title of a container page.
Parameters
----------
index : int
Index of the container page
title : unicode
New title"""
self._titles[index] = title
self.send_state('_titles')
def get_title(self, index):
"""Gets the title of a container pages.
Parameters
----------
index : int
Index of the container page"""
if index in self._titles:
return self._titles[index]
else:
return None
class Accordion(_SelectionContainer):
"""Displays children each on a separate accordion page."""
_view_name = Unicode('AccordionView', sync=True)
class Tab(_SelectionContainer):
"""Displays children each on a separate accordion tab."""
_view_name = Unicode('TabView', sync=True)
# Remove in IPython 4.0
AccordionWidget = DeprecatedClass(Accordion, 'AccordionWidget')
TabWidget = DeprecatedClass(Tab, 'TabWidget')