Skip to content

Commit

Permalink
Fix name in categories directive
Browse files Browse the repository at this point in the history
The name can contain backslashes that need converting to
posix format before going into the subsequent code. Otherwise
the backslashes will break the documentation folder structure.
  • Loading branch information
jclarkeSTFC committed Oct 2, 2024
1 parent c35f82c commit 80da950
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/sphinxext/mantiddoc/directives/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ def __init__(self, name, docname, src_path):
self.section = docname.parts[0]
dirpath = docname.parent
html_dir = dirpath.joinpath(CATEGORIES_DIR)
self.html_path = html_dir.joinpath(name + ".html")
# name can arrive with a format like "MyAlgorithmCategory\\NameOfAlgorithm", so we
# have to sort those slashes out
name_with_slashes_fixed = name.replace("\\", "/").replace("//", "/")
self.html_path = html_dir.joinpath(name_with_slashes_fixed + ".html")
super(Category, self).__init__(name, self.html_path)
self.pages = set([])
self.subcategories = set([])
Expand Down Expand Up @@ -446,7 +449,7 @@ def create_top_algorithm_category(categories):
top_context["facilitycategories"] = sorted(facility_categories, key=lambda x: x.name)
top_context["title"] = "Algorithm Contents"
top_html_path_noext = str(Path("algorithms", "index"))
return (str(top_html_path_noext), top_context, template)
return (top_html_path_noext, top_context, template)


def extract_matching_categories(input_categories, filepath):
Expand Down

0 comments on commit 80da950

Please sign in to comment.