Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Validation #3797

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions scripts/build/parse_features_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,22 +297,25 @@ def sort_versions_for(feature, high_to_low=True):
print("Modifying the docs TOCs of version " + version + " to remove the duplicate feature versions.")
feature_version_path = featurePath + version
for root, dirs, files in os.walk(feature_version_path):
for basename in files:
if fnmatch.fnmatch(basename, "*.html"):
if(basename != "index.html"):
href = path.join(root, basename)
page = BeautifulSoup(open(href), "lxml")

# Find the toc and replace it with the modified toc
page_toc = page.find_all('ul', {'class': 'nav-list'})[0]
if page_toc.find('span', text='Features') is not None:
toc_to_replace = page_toc.find('span', text='Features').parent
elif page_toc.find('a', text='Features') is not None:
toc_to_replace = page_toc.find('a', text='Features').parent
toc_to_replace.clear()
toc_to_replace.append(featureTOC)
with open(href, "w") as file:
file.write(str(page))
if "../" not in root:
for basename in files:
if fnmatch.fnmatch(basename, "*.html"):
if(basename != "index.html"):
href = path.join(root, basename)
page = BeautifulSoup(open(href), "lxml")

# Find the toc and replace it with the modified toc
page_toc = page.find_all('ul', {'class': 'nav-list'})[0]
if page_toc.find('span', text='Features') is not None:
toc_to_replace = page_toc.find('span', text='Features').parent
elif page_toc.find('a', text='Features') is not None:
toc_to_replace = page_toc.find('a', text='Features').parent
toc_to_replace.clear()
toc_to_replace.append(featureTOC)
with open(href, "w") as file:
file.write(str(page))
else:
print("Invalid path for root")

timerEnd = time.time()
print('Total execution time for parsing ToC Features: ', timerEnd - timerStart)
Loading