dbldatagen.html_utils module
This file defines the HtmlUtils classes and utility functions
- class HtmlUtils[source]
Bases:
object
Utility class for formatting code as HTML and other notebook related formatting
- classmethod formatCodeAsHtml(codeText)[source]
Formats supplied code as Html suitable for use with notebook
displayHTML
- Parameters:
codeText – Code to be wrapped in html section
- Returns:
Html string
This will wrap the code with a html section using html
pre
andcode
tags.It adds a copy text to clipboard button to enable users to easily copy the code to the clipboard.
It does not reformat code so supplied code should be preformatted into lines.
Note
As the notebook environment uses IFrames in rendering html within
displayHtml
, it cannot use the newernavigator
based functionality as this is blocked for cross domain IFrames by default.
- classmethod formatTextAsHtml(textContent, title='Output')[source]
Formats supplied text as Html suitable for use with notebook
displayHTML
- Parameters:
textContent – Text to be wrapped in html section
title – Title text to be used
- Returns:
Html string
This will wrap the text content with with Html formatting