Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
524f8994
Commit
524f8994
authored
6 years ago
by
Samuel Jones
Browse files
Options
Downloads
Patches
Plain Diff
Re #0 Push tool extra charecters because I need more
parent
c430c961
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/scripts/OpenMostDocumentationForTesting.py
+93
-0
93 additions, 0 deletions
tools/scripts/OpenMostDocumentationForTesting.py
with
93 additions
and
0 deletions
tools/scripts/OpenMostDocumentationForTesting.py
0 → 100644
+
93
−
0
View file @
524f8994
# This was written for Python 2.7
# You are likely doing unscripted testing for MantidPlot/Workbench when using this script so basically follow this
# advice as well as using this script and it's results. (Confirm these all work as well)
# - Algorithm dialog snapshots should appear on algorithm pages in offline help
# - Math formulae should appear on algorithm pages in offline help
# - workflow diagrams should appear on algorithm pages in offline help
#
# Author: Samuel Jones - ISIS
# Need to install BeautifulSoup:
# pip install beautifulsoup
from
BeautifulSoup
import
BeautifulSoup
import
urllib2
import
re
import
webbrowser
import
time
def
crawl_url_for_html_addons
(
url
):
parent_url
=
url
parent_url
=
re
.
sub
(
'
index.html$
'
,
''
,
parent_url
)
html_page
=
urllib2
.
urlopen
(
url
)
soup
=
BeautifulSoup
(
html_page
)
urls
=
[]
for
link
in
soup
.
findAll
(
'
a
'
,
attrs
=
{
'
href
'
:
re
.
compile
(
"
.html
"
)}):
html_ref
=
link
.
get
(
'
href
'
)
urls
.
append
(
parent_url
+
html_ref
)
return
urls
def
open_urls
(
list_of_urls
,
delay
=
1
):
"""
:param list_of_urls:
:param delay: in seconds
:return:
"""
for
url
in
list_of_urls
:
time
.
sleep
(
delay
)
webbrowser
.
open
(
url
)
main_url
=
"
http://docs.mantidproject.org/nightly/
"
all_urls
=
[]
print
(
"
Crawling for Algorithm URLs...
"
)
algorithm_urls
=
crawl_url_for_html_addons
(
"
http://docs.mantidproject.org/nightly/algorithms/index.html
"
)
all_urls
.
extend
(
algorithm_urls
)
print
(
"
Crawling for Concept URLs...
"
)
concept_urls
=
crawl_url_for_html_addons
(
"
http://docs.mantidproject.org/nightly/concepts/index.html
"
)
all_urls
.
extend
(
concept_urls
)
print
(
"
Crawling for Interface URLs...
"
)
interface_urls
=
crawl_url_for_html_addons
(
"
http://docs.mantidproject.org/nightly/interfaces/index.html
"
)
all_urls
.
extend
(
interface_urls
)
print
(
"
Crawling for Technique URLs...
"
)
technique_urls
=
crawl_url_for_html_addons
(
"
http://docs.mantidproject.org/nightly/techniques/index.html
"
)
all_urls
.
extend
(
technique_urls
)
print
(
"
Crawling python api...
"
)
mantid_kernel_urls
=
crawl_url_for_html_addons
(
"
http://docs.mantidproject.org/nightly/api/python/mantid/kernel/
"
"
index.html
"
)
mantid_geometry_urls
=
crawl_url_for_html_addons
(
"
http://docs.mantidproject.org/nightly/api/python/mantid/geometry/
"
"
index.html
"
)
mantid_api_urls
=
crawl_url_for_html_addons
(
"
http://docs.mantidproject.org/nightly/api/python/mantid/api/
"
"
index.html
"
)
# Only one
mantid_plots_urls
=
[
"
http://docs.mantidproject.org/nightly/api/python/mantid/plots/index.html
"
]
# Only one
mantid_simpleapi_urls
=
[
"
http://docs.mantidproject.org/nightly/api/python/mantid/simpleapi.html
"
]
# Only one
mantid_fitfunctions
=
[
"
http://docs.mantidproject.org/nightly/api/python/mantid/fitfunctions.html
"
]
mantidplot_urls
=
crawl_url_for_html_addons
(
"
http://docs.mantidproject.org/nightly/api/python/mantidplot/index.html
"
)
all_urls
.
extend
(
mantid_api_urls
)
all_urls
.
extend
(
mantid_fitfunctions
)
all_urls
.
extend
(
mantid_geometry_urls
)
all_urls
.
extend
(
mantid_kernel_urls
)
all_urls
.
extend
(
mantid_plots_urls
)
all_urls
.
extend
(
mantid_simpleapi_urls
)
all_urls
.
extend
(
mantidplot_urls
)
print
(
"
All webpages crawled
"
)
print
(
"
Opening Urls...
"
)
open_urls
(
all_urls
)
print
(
"
All URLs opened
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment