Skip to content

Commit

Permalink
Removing edit button fix (#2341)
Browse files Browse the repository at this point in the history
* Removing edit button fix

* Removing template file

* fix: the extension

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Revathyvenugopal162 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Revathy Venugopal <[email protected]>
  • Loading branch information
4 people authored Sep 28, 2023
1 parent 5ca648e commit d7fa8ec
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 257 deletions.
16 changes: 0 additions & 16 deletions doc/source/_templates/edit-this-page.html

This file was deleted.

52 changes: 3 additions & 49 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from ansys.mapdl import core as pymapdl
from ansys.mapdl.core import __version__
from ansys.mapdl.core.docs import linkcode_resolve

# Manage errors
pyvista.set_error_output_file("errors.txt")
Expand Down Expand Up @@ -54,7 +53,7 @@
cname = os.getenv("DOCUMENTATION_CNAME", "mapdl.docs.pyansys.com")

REPOSITORY_NAME = "pymapdl"
USERNAME = "pyansys"
USERNAME = "ansys"
BRANCH = "main"


Expand All @@ -74,17 +73,14 @@
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.extlinks",
# sphinx.ext.linkcode add the button ``[Source]`` to each website.
# The link of that button is created by calling ``linkcode_resolve``
# function which we overwrite in ansys.mapdl.core.docs
"sphinx.ext.linkcode",
"sphinx.ext.intersphinx",
"sphinx_autodoc_typehints",
"sphinx_copybutton",
"sphinx_gallery.gen_gallery",
"sphinxemoji.sphinxemoji",
"sphinx.ext.graphviz",
"sphinx_reredirects",
"ansys_sphinx_theme.extension.linkcode",
]

# Intersphinx mapping
Expand Down Expand Up @@ -288,6 +284,7 @@
"github_repo": REPOSITORY_NAME,
"github_version": BRANCH,
"doc_path": DOC_PATH,
"source_path": "src",
}
html_show_sourcelink = False

Expand Down Expand Up @@ -367,48 +364,6 @@
epub_exclude_files = ["search.html"]


def setup_to_py(
app: Sphinx, pagename: str, templatename: str, context, doctree
) -> None:
"""Add a function that jinja can access for returning an "edit this page" link pointing to `main`."""

def fix_edit_link_button(link: str) -> str:
"""Transform "edit on github" links and make sure they always point to the main branch.
Args:
link: the link to the github edit interface
Returns:
the link to the tip of the main branch for the same file
"""
# Create custom 'edit' URLs for API modules since they are dynamically generated.
doc_path = "/".join(link.split("/")[:-1])
file_name = link.split("/")[-1]

if GALLERY_EXAMPLES_PATH in doc_path:
# We are in a python example
doc_path = doc_path.replace(
f"{DOC_PATH}/{GALLERY_EXAMPLES_PATH}", EXAMPLES_ROOT
)
file_name = (
os.path.basename(file_name).replace(source_suffix, "")
+ f".{DEFAULT_EXAMPLE_EXTENSION}"
)
return f"{doc_path}/{file_name}"

elif "_autosummary" in link:
# This is an API example
fullname = link.split("_autosummary")[1][1:]
return linkcode_resolve(
"py", {"module": "ansys.mapdl.core", "fullname": fullname}, edit=True
)

else:
return link

context["fix_edit_link_button"] = fix_edit_link_button


def setup(app: Sphinx):
"""Add custom configuration to sphinx app.
Expand All @@ -417,7 +372,6 @@ def setup(app: Sphinx):
app : sphinx.application.Sphinx
The Sphinx application.
"""
app.connect("html-page-context", setup_to_py)

# Adding apdl syntax highlighting
from pygments.lexers.apdlexer import apdlexer
Expand Down
140 changes: 0 additions & 140 deletions src/ansys/mapdl/core/docs.py

This file was deleted.

52 changes: 0 additions & 52 deletions tests/test_docs.py

This file was deleted.

0 comments on commit d7fa8ec

Please sign in to comment.