Skip to content

Commit

Permalink
Source link in the box
Browse files Browse the repository at this point in the history
  • Loading branch information
isVoid committed Jul 2, 2021
1 parent 83dcb74 commit 1ab5306
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions docs/cudf/source/_ext/PandasCompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,26 @@ def process_PandasCompat_nodes(app, doctree, fromdocname):

for PandasCompat_info in env.PandasCompat_all_pandas_compat:
para = nodes.paragraph()
filename = env.doc2path(PandasCompat_info["docname"], base=None)
description = _(
"(The original entry is located in %s, line %d and can be "
"found "
) % (filename, PandasCompat_info["lineno"])
para += nodes.Text(description, description)

# Create a reference

# Create a reference back to the original docstring
newnode = nodes.reference("", "")
innernode = nodes.emphasis(_("here"), _("here"))
innernode = nodes.emphasis(_("[source]"), _("[source]"))
newnode["refdocname"] = PandasCompat_info["docname"]
newnode["refuri"] = app.builder.get_relative_uri(
fromdocname, PandasCompat_info["docname"]
)
newnode["refuri"] += "#" + PandasCompat_info["target"]["refid"]
newnode.append(innernode)
para += newnode
para += nodes.Text(".)", ".)")

# Insert into the PandasCompatList
# Insert the reference node into PandasCompat node
# Note that this node is a deepcopy from the original copy
# in the docstring, so changing this does not affect that in the
# doc.
PandasCompat_info["PandasCompat"].append(para)

# Insert the PandasCompand node into the PandasCompatList Node
content.append(PandasCompat_info["PandasCompat"])
content.append(para)

node.replace_self(content)

Expand Down

0 comments on commit 1ab5306

Please sign in to comment.