Skip to content

Commit

Permalink
[DOCS] Port Changes for sitemap generating to master (#27724)
Browse files Browse the repository at this point in the history
  • Loading branch information
akopytko authored Nov 25, 2024
1 parent f4a700d commit f11d8a5
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,21 @@ def extract_hierarchy(link):
segments = path.split('/')[1:]
if segments and segments[-1].endswith('.html'):
segments = segments[:-1]


if segments and '.' in segments[0]:
year, *rest = segments[0].split('.')
if year.isdigit() and len(year) == 4:
segments[0] = year

segments = [format_segment(segment) for segment in segments]

hierarchy = []
for i in range(1, len(segments) + 1):
hierarchy.append('|'.join(segments[:i]))

return ';'.join(hierarchy)

return ';'.join(hierarchy)

def format_segment(segment):
if segment == 'c_cpp_api': segment = 'c_c++_api'

return ' '.join(word.capitalize() for word in segment.replace('-', ' ').replace('_', ' ').split())

0 comments on commit f11d8a5

Please sign in to comment.