Skip to content

Commit

Permalink
Fix FixOuterDocLinks Fuzzinator-specific Sphinx extension
Browse files Browse the repository at this point in the history
The transformation now correctly rewrites `docs/filename.rst`
references to `` :doc:`filename` `` xrefs.
  • Loading branch information
akosthekiss committed Jul 9, 2021
1 parent a5bdb26 commit b865e41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ needed during a fuzz session:

All the above features are fully customizable either by writing a simple config
file or by implementing Python snippets to cover special needs. Check out some
slides_ about *Fuzzinator* for a general overview, or see the
`Tutorial <docs/tutorial.rst>`_ for a detailed walk-through. There is also a
repository collecting configurations_ for various real-life SUTs and fuzzers.
slides_ about *Fuzzinator* for a general overview, or see the Tutorial_ for a
detailed walk-through. There is also a repository collecting configurations_ for
various real-life SUTs and fuzzers.

To help tracking the progress of the fuzzing, *Fuzzinator* provides three
interfaces:
Expand Down
14 changes: 7 additions & 7 deletions docs/_ext/fuzzinator_sphinx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 Renata Hodovan, Akos Kiss.
# Copyright (c) 2020-2021 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
Expand Down Expand Up @@ -38,7 +38,7 @@ def apply(self):

# Useful for README.rst that is also included by docs/introduction.rst but
# is linking to docs/tutorial.rst. (From within docs/introduction.rst, the
# proper way of linking would be :docs:`tutorial`, but that cannot be used
# proper way of linking would be :doc:`tutorial`, but that cannot be used
# in the standalone README.rst.)
class FixOuterDocLinks(Transform):
default_priority = 900
Expand All @@ -50,14 +50,14 @@ def apply(self):
if not refuri.startswith('docs/') or not refuri.endswith('.rst'):
continue

# replace them with :doc:`/FILENAME` to turn them into
# replace them with :doc:`FILENAME` to turn them into
# sphinx-specific direct document links
_ = ''
xrefnode = addnodes.pending_xref(_, nodes.inline(_, *tuple(refnode.children), classes=['xref', 'doc']),
xrefnode = addnodes.pending_xref(_, nodes.inline(_, *tuple(refnode.children), classes=['xref', 'std', 'std-doc']),
refdoc='.'.join(self.document['source'].rpartition('docs/')[2].rsplit('.', maxsplit=1)[:-1]),
refdomain='',
refexplicit=True,
reftarget=refuri[len('docs'):-len('.rst')],
refdomain='std',
refexplicit=False,
reftarget=refuri[len('docs/'):-len('.rst')],
reftype='doc',
refwarn=True)
refnode.replace_self(xrefnode)
Expand Down

0 comments on commit b865e41

Please sign in to comment.