from IPython.display import display
from IPython.display import (
    HTML, Image, Latex, Math, Markdown, SVG
)

"""
Explanation: Upload Notebook for Examples
This notebook is designed to provide examples of different types of outputs that can be used to test the JupyterLab frontend and other Jupyter frontends.
End of explanation
"""


text = """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam urna
libero, dictum a egestas non, placerat vel neque. In imperdiet iaculis fermentum. 
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia 
Curae; Cras augue tortor, tristique vitae varius nec, dictum eu lectus. Pellentesque 
id eleifend eros. In non odio in lorem iaculis sollicitudin. In faucibus ante ut 
arcu fringilla interdum. Maecenas elit nulla, imperdiet nec blandit et, consequat 
ut elit."""
print(text)

"""
Explanation: Text
Plain text:
End of explanation
"""


text

"""
Explanation: Text as output:
End of explanation
"""


import sys; print('this is stderr', file=sys.stderr)

"""
Explanation: Standard error:
End of explanation
"""


div = HTML('<div style="width:100px;height:100px;background:grey;" />')
div

for i in range(3):
    print(7**10)
    display(div)

"""
Explanation: HTML
End of explanation
"""


md = Markdown("""
### Subtitle

This is some *markdown* text with math $F=ma$.

""")
md

display(md)

"""
Explanation: Markdown
End of explanation
"""


math = Latex("$F=ma$")
math

maxwells = Latex(r"""
\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\   \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}
""")
maxwells

"""
Explanation: LaTeX
Examples LaTeX in a markdown cell:
\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \   \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}
End of explanation
"""


svg_source = """
<svg width="400" height="110">
  <rect width="300" height="100" style="fill:#E0E0E0;" /> 
</svg>
"""
svg = SVG(svg_source)
svg

for i in range(3):
    print(10**i)
    display(svg)

"""
Explanation: SVG
End of explanation
"""


