Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
isVoid committed Jul 14, 2021
1 parent 84b0725 commit ee3bda9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docs/cudf/source/_ext/PandasCompat.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# This file is adapted from official sphinx tutorial for `todo` extension:
# https://www.sphinx-doc.org/en/master/development/tutorials/PandasCompat.html
# https://www.sphinx-doc.org/en/master/development/tutorials/todo.html

from docutils import nodes
from docutils.parsers.rst import Directive
from sphinx.locale import _
from sphinx.locale import get_translation
from sphinx.util.docutils import SphinxDirective

translator = get_translation("sphinx")


class PandasCompat(nodes.Admonition, nodes.Element):
pass
Expand Down Expand Up @@ -39,7 +41,8 @@ def run(self):

PandasCompat_node = PandasCompat("\n".join(self.content))
PandasCompat_node += nodes.title(
_("Pandas Compatibility Note"), _("Pandas Compatibility Note")
translator("Pandas Compatibility Note"),
translator("Pandas Compatibility Note"),
)
self.state.nested_parse(
self.content, self.content_offset, PandasCompat_node
Expand All @@ -51,7 +54,6 @@ def run(self):
self.env.PandasCompat_all_pandas_compat.append(
{
"docname": self.env.docname,
"lineno": self.lineno,
"PandasCompat": PandasCompat_node.deepcopy(),
"target": targetnode,
}
Expand Down Expand Up @@ -105,7 +107,9 @@ def process_PandasCompat_nodes(app, doctree, fromdocname):

# Create a reference back to the original docstring
newnode = nodes.reference("", "")
innernode = nodes.emphasis(_("[source]"), _("[source]"))
innernode = nodes.emphasis(
translator("[source]"), translator("[source]")
)
newnode["refdocname"] = PandasCompat_info["docname"]
newnode["refuri"] = app.builder.get_relative_uri(
fromdocname, PandasCompat_info["docname"]
Expand Down

0 comments on commit ee3bda9

Please sign in to comment.