Skip to content

Commit

Permalink
Make fix so that use of autosectionlabel is not required
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Mar 26, 2019
1 parent 27a64dc commit 9d0bd36
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sphinx_asdf/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ def handle_page_context(app, pagename, templatename, ctx, doctree):
return os.path.join(TEMPLATE_PATH, 'schema.html')


def normalize_name(name):
for char in ['.', '_', '/']:
name = name.replace(char, '-')
return name


def add_labels_to_nodes(app, document):
labels = app.env.domaindata['std']['labels']
anonlabels = app.env.domaindata['std']['anonlabels']
Expand All @@ -111,7 +117,11 @@ def add_labels_to_nodes(app, document):
labelid = node['ids'][0]
docname = app.env.docname
basename = os.path.relpath(docname, basepath)
name = nodes.fully_normalize_name(basename + ':' + labelid)

if labelid == normalize_name(basename):
name = basename
else:
name = nodes.fully_normalize_name(basename + ':' + labelid)

# labelname -> docname, labelid
anonlabels[name] = docname, labelid
Expand Down

0 comments on commit 9d0bd36

Please sign in to comment.