Skip to content

Commit

Permalink
Revert "ENH: Add Styler.disable_mathjax() method (pandas-dev#19824)."
Browse files Browse the repository at this point in the history
This reverts commit 3df97e3.
  • Loading branch information
David Hall committed Feb 24, 2018
1 parent 3df97e3 commit f48f587
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
22 changes: 2 additions & 20 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class Styler(object):
a unique identifier to avoid CSS collisons; generated automatically
caption: str, default None
caption to attach to the table
disabled_mathjax: bool, default False
prevent MathJax from processing table contents
Attributes
----------
Expand Down Expand Up @@ -113,7 +111,7 @@ class Styler(object):
template = env.get_template("html.tpl")

def __init__(self, data, precision=None, table_styles=None, uuid=None,
caption=None, disabled_mathjax=False, table_attributes=None):
caption=None, table_attributes=None):
self.ctx = defaultdict(list)
self._todo = []

Expand All @@ -131,7 +129,6 @@ def __init__(self, data, precision=None, table_styles=None, uuid=None,
self.uuid = uuid
self.table_styles = table_styles
self.caption = caption
self.disabled_mathjax = disabled_mathjax
if precision is None:
precision = get_option('display.precision')
self.precision = precision
Expand Down Expand Up @@ -184,7 +181,6 @@ def _translate(self):
"""
table_styles = self.table_styles or []
caption = self.caption
disabled_mathjax = self.disabled_mathjax
ctx = self.ctx
precision = self.precision
hidden_index = self.hidden_index
Expand Down Expand Up @@ -331,8 +327,7 @@ def format_attr(pair):

return dict(head=head, cellstyle=cellstyle, body=body, uuid=uuid,
precision=precision, table_styles=table_styles,
caption=caption, disabled_mathjax=disabled_mathjax,
table_attributes=self.table_attributes)
caption=caption, table_attributes=self.table_attributes)

def format(self, formatter, subset=None):
"""
Expand Down Expand Up @@ -436,7 +431,6 @@ def render(self, **kwargs):
* precision
* table_styles
* caption
* disabled_mathjax
* table_attributes
"""
self._compute()
Expand Down Expand Up @@ -471,7 +465,6 @@ def _update_ctx(self, attrs):
def _copy(self, deepcopy=False):
styler = Styler(self.data, precision=self.precision,
caption=self.caption, uuid=self.uuid,
disabled_mathjax=self.disabled_mathjax,
table_styles=self.table_styles)
if deepcopy:
styler.ctx = copy.deepcopy(self.ctx)
Expand Down Expand Up @@ -801,17 +794,6 @@ def set_table_styles(self, table_styles):
self.table_styles = table_styles
return self

def disable_mathjax(self):
"""
Prevent MathJax from processing table contents.
Returns
-------
self : Styler
"""
self.disabled_mathjax = True
return self

def hide_index(self):
"""
Hide any indices from rendering.
Expand Down
12 changes: 2 additions & 10 deletions pandas/io/formats/templates/html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
{%- endblock cellstyle %}
</style>
{%- endblock style %}
{%- block before_table %}
{%- if disabled_mathjax -%}
<div class="tex2jax_ignore">
{%- endif -%}
{% endblock before_table %}
{%- block before_table %}{% endblock before_table %}
{%- block table %}
<table id="T_{{uuid}}" {% if table_attributes %}{{ table_attributes }}{% endif %}>
{%- block caption %}
Expand Down Expand Up @@ -71,8 +67,4 @@
{%- endblock tbody %}
</table>
{%- endblock table %}
{%- block after_table %}
{%- if disabled_mathjax -%}
</div>
{%- endif -%}
{% endblock after_table %}
{%- block after_table %}{% endblock after_table %}

0 comments on commit f48f587

Please sign in to comment.