From 0b002377bec2914f6d619ea67f6a50b05d5bb25c Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Tue, 22 Jan 2019 14:58:23 -0800 Subject: [PATCH] add error artifacts for local build --- docs/build_version_doc/artifacts/.htaccess | 1 - docs/build_version_doc/artifacts/404.html | 2 +- docs/build_version_doc/update_all_version.sh | 32 -------------------- docs/error/404.md | 3 -- docs/error/api.md | 3 -- docs/mxdoc.py | 14 +++++++++ 6 files changed, 15 insertions(+), 40 deletions(-) delete mode 100644 docs/error/404.md delete mode 100644 docs/error/api.md diff --git a/docs/build_version_doc/artifacts/.htaccess b/docs/build_version_doc/artifacts/.htaccess index 106d13c27577..f334982a356e 100644 --- a/docs/build_version_doc/artifacts/.htaccess +++ b/docs/build_version_doc/artifacts/.htaccess @@ -4,7 +4,6 @@ RewriteRule ^get_started/why_mxnet.html$ %{ENV:default_version}/faq/why_mxnet.ht RewriteRule ^get_started.*$ %{ENV:default_version}/install/ [R=301,L] RewriteRule ^how_to.*$ %{ENV:default_version}/faq/ [R=301,L] RewriteRule ^api/python/symbol.html$ %{ENV:default_version}/api/python/symbol/symbol.html [R=301,L] -RewriteRule ^(?:versions\/[^\/]+\/)?community/index.html$ %{ENV:default_version}/community/contribute.html [R=301,L] # Navigation bar redirects to latest info RewriteCond %{ENV:default_version}#\/$1 !^([^#]+)#\1$ diff --git a/docs/build_version_doc/artifacts/404.html b/docs/build_version_doc/artifacts/404.html index 46690fcea2b4..86c91f738876 100644 --- a/docs/build_version_doc/artifacts/404.html +++ b/docs/build_version_doc/artifacts/404.html @@ -44,7 +44,7 @@

Page Does Not Exist

-

If you’re here that means you requested a page that doesn’t exist. Sorry about that! Maybe try the search box to find what you’re looking for, or navigate to the Home Page. Also, make sure you’re looking in the correct version, as some features may only be available in newer versions or the master branch.

+

If you’re here that means you requested a page that doesn’t exist. Sorry about that! Maybe try the search box to find what you’re looking for, or navigate to the Home Page. Also, make sure you’re looking in the correct version, as some features may only be available in newer versions or the master branch.

diff --git a/docs/build_version_doc/update_all_version.sh b/docs/build_version_doc/update_all_version.sh index b6abf9f27742..d3305d462dff 100755 --- a/docs/build_version_doc/update_all_version.sh +++ b/docs/build_version_doc/update_all_version.sh @@ -78,27 +78,6 @@ for tag in $tag_list; do echo "$tag" >> "$tag_file" done -function update_mxnet_css { - tag=$1 - echo "Begin update fixes.." - # All fixes are done on the master branch of mxnet-incubator repository - # During a nightly build, these fixes will be patched to all the versions in the asf-site repository including the master folder under versions directory. - # copy - - echo "Copying mxnet.css from artifacts folder..." - cp "artifacts/mxnet.css" "$built/versions/$tag/_static" - - echo "Update fixes complete.." -} - -function update_error_pages { - tag=$1 - # Static error pages avoid many issues with redirects and templating - echo "Copying error pages from artifacts folder..." - cp "artifacts/404.html" "$built/versions/$tag/error" - cp "artifacts/api.html" "$built/versions/$tag/error" - echo "Error copies complete..." -} # Update the specified tags with the Versions dropdown # Add various artifacts depending on the version @@ -108,17 +87,6 @@ for tag in $tag_list; do python AddVersion.py --root_url "$root_url" --file_path "$built/versions/$tag" --current_version "$tag" --tag_default "$tag_default" || exit 1 - # Patch any fixes to all versions except 0.11.0. - # Version 0.11.0 has old theme and does not make use of the current mxnet.css - # It also has its install page in /getting_started, so we skip updating that - if [ $tag != '0.11.0' ]; then - if [ -d $built/versions/$tag ]; then - echo "The $tag is going to be updated with new css and install pages." - update_mxnet_css $tag - update_error_pages $tag - fi - fi - # Update all the files that are required to go into the root folder or live version if [ $tag == $tag_default ] then diff --git a/docs/error/404.md b/docs/error/404.md deleted file mode 100644 index 63ebdeb4cbef..000000000000 --- a/docs/error/404.md +++ /dev/null @@ -1,3 +0,0 @@ -# Page Does Not Exist - -If you're here that means you requested a page that doesn't exist. Sorry about that! Maybe try the search box to find what you're looking for, or navigate to the [Home Page](../index.html). Also, make sure you're looking in the correct version, as some features may only be available in [newer versions](https://github.com/apache/incubator-mxnet/releases) or the [master branch](../versions/master). diff --git a/docs/error/api.md b/docs/error/api.md deleted file mode 100644 index 37de50291abd..000000000000 --- a/docs/error/api.md +++ /dev/null @@ -1,3 +0,0 @@ -# API Not Available - -You selected an API that is not available for this version of MXNet. Try a more recent version of MXNet, or go to the [master](../versions/master/) version. diff --git a/docs/mxdoc.py b/docs/mxdoc.py index 52f050e0ad2f..33201dae56d6 100644 --- a/docs/mxdoc.py +++ b/docs/mxdoc.py @@ -16,6 +16,7 @@ # under the License. """A sphnix-doc plugin to build mxnet docs""" +from __future__ import print_function import subprocess import re import os @@ -434,6 +435,18 @@ def add_buttons(app, docname, source): # source[i] = '\n'.join(lines) + +def copy_artifacts(app): + """Copies artifacts needed for website presentation""" + print("Copying artifacts...") + dest_path = app.builder.outdir + '/error/' + _run_cmd('cd ' + app.builder.srcdir) + _run_cmd('cp build_version_doc/artifacts/404.html ' + dest_path) + _run_cmd('cp build_version_doc/artifacts/api.html ' + dest_path) + dest_path = app.builder.outdir + '/_static/' + _run_cmd('cp _static/mxnet.css ' + dest_path) + + def setup(app): # If MXNET_DOCS_BUILD_MXNET is set something different than 1 # Skip the build step @@ -458,6 +471,7 @@ def setup(app): if _R_DOCS: print("Building R Docs!") app.connect("builder-inited", build_r_docs) + app.connect("builder-inited", copy_artifacts) app.connect('source-read', convert_table) app.connect('source-read', add_buttons) app.add_config_value('recommonmark_config', {