Skip to content

Commit

Permalink
doc: simplify doc redirection messages
Browse files Browse the repository at this point in the history
We have directives in conf.py to create redirect links for docs that
have been moved around because of content reorganization.  Reduce the
number of messages written out while debugging was going on and add some
comments to conf.py to explain how the directive works.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
  • Loading branch information
dbkinder authored and nashif committed Jun 26, 2019
1 parent 41f1f64 commit 3a16001
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 5 additions & 2 deletions doc/conf.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -292,10 +292,13 @@
htmlhelp_basename = 'zephyrdoc' htmlhelp_basename = 'zephyrdoc'




# Custom added feature to allow redirecting old URLs # Custom added feature to allow redirecting old URLs (caused by
# reorganizing doc directories)
# #
# list of tuples (old_url, new_url) for pages to redirect # list of tuples (old_url, new_url) for pages to redirect
# (URLs should be relative to document root, only) #
# URLs must be relative to document root (with NO leading slash),
# and without the html extension)
html_redirect_pages = [ html_redirect_pages = [
('contribute/contribute_guidelines', 'contribute/index'), ('contribute/contribute_guidelines', 'contribute/index'),
('application/application', 'application/index.rst'), ('application/application', 'application/index.rst'),
Expand Down
4 changes: 1 addition & 3 deletions doc/extensions/zephyr/html_redirects.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ def create_redirect_pages(app, docname):
return # only relevant for standalone HTML output return # only relevant for standalone HTML output


for (old_url, new_url) in app.config.html_redirect_pages: for (old_url, new_url) in app.config.html_redirect_pages:
print("Creating redirect %s to %s..." % (old_url, new_url))
if old_url.startswith('/'): if old_url.startswith('/'):
print("Stripping leading / from URL in config file...")
old_url = old_url[1:] old_url = old_url[1:]
print("Creating redirect: %s.html to %s.html" % (old_url, new_url))


new_url = app.builder.get_relative_uri(old_url, new_url) new_url = app.builder.get_relative_uri(old_url, new_url)
out_file = app.builder.get_outfilename(old_url) out_file = app.builder.get_outfilename(old_url)
print("HTML file %s redirects to relative URL %s" % (out_file, new_url))


out_dir = os.path.dirname(out_file) out_dir = os.path.dirname(out_file)
if not os.path.exists(out_dir): if not os.path.exists(out_dir):
Expand Down

0 comments on commit 3a16001

Please sign in to comment.