Skip to content

Commit

Permalink
Merge pull request OpenMDAO#449 from kmarsteller/master
Browse files Browse the repository at this point in the history
Fix for tag linking problem...
  • Loading branch information
Keith Marsteller authored Nov 14, 2017
2 parents a2ce794 + 4d8be3b commit 2ab84c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
7 changes: 2 additions & 5 deletions openmdao/docs/_exts/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ def run(self):
links = []

for tagg in taggs:
# Create rst hyperlinks of format `Python <http://www.python.org/>`_.
import os
cwd = os.getcwd()
html_dir = os.path.join(cwd, "_build", "html")
link = "`" + tagg + " <" + html_dir + os.sep + "tags" + os.sep + tagg + ".html>`_ "
# Create Sphinx doc refs of format :ref:`Tagname<Tagname>`
link = ":ref:`" + tagg + "<" + tagg + ">`"
links.append(link)
# Put links back in a single comma-separated string together
linkjoin = ", ".join(links)
Expand Down
8 changes: 5 additions & 3 deletions openmdao/docs/_utils/preprocess_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ def make_tagfiles(docdirs, tagdir):

# If the tagfile doesn't exist, let's put in a header
if not os.path.exists(filepath):
tagfilelabel = ".. _" + tag + ": \n"
tagfileheader = """
=========================
%s
=========================
.. toctree::
""" % tag


# Write the header for this tag's file.
with open(filepath, 'a') as tagfile:
tagfile.write(tagfilelabel)
tagfile.write(tagfileheader)
# Write a link into an existing tagfile.
with open(filepath, 'a') as tagfile:
Expand All @@ -71,9 +74,8 @@ def make_tagindex(tagdir):
# Once all the files exist, create a simple index.rst file
indexfile = tagdir + "/index.rst"

for filepath, dirnames, filenames in os.walk(tagdir):
with open(indexfile, 'a') as index:
index.write("""
with open(indexfile, 'a') as index:
index.write("""
:orphan:
================
Expand Down
2 changes: 1 addition & 1 deletion openmdao/docs/examples/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _Examples:
.. _OpenMDAO_Examples:

********
Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ Here are several examples of how you can specify derivative values for different
openmdao.jacobians.tests.test_jacobian_features.SimpleCompConst


.. tags:: Partial Derivatives

.. tags:: PartialDerivatives

0 comments on commit 2ab84c7

Please sign in to comment.