Hi Matthias and Doug,

Thanks for the information. I was able to piece together something
that seems to work by looking at each of your pointers. By
constructing from my JSON source the rst string with the reference, I
could pass this through `sphinx.util.nested_parse_with_titles` to get
the links I wanted in the output.

Matthias, I tried for quite a while to get pending_xref to work. I
would prefer this method of being able to explicitly construct the
references. The thing about the example you provided that was
confusing to me is that it seemed as though existing references were
replaced with the pending_xref. I'd like to explicitly create those
new references and that is what I couldn't figure out.
On Tue, Oct 9, 2018 at 2:58 AM Matthias Geier <matthias.ge...@gmail.com> wrote:
>
> On Tue, Oct 9, 2018 at 2:08 AM Noah Watkins  wrote:
> >
> > Hi,
> >
> > I'm working on a custom directive, and have made a lot of progress, but I'm 
> > hitting a bit of a wall. My directive is fundamentally simple: I'm 
> > rendering a source json file to table format. I've used other extensions as 
> > a reference and have gotten this to work well.
> >
> > The problem I'm trying to solve now is resolving references (e.g. to 
> > section labels, etc...) that are specified in the json source. I don't need 
> > to worry about any internal references within the source.
>
> If I understood correctly what you want to do, you can insert nodes of
> the type "sphinx.addnodes.pending_xref" to your document.
>
> http://www.sphinx-doc.org/en/master/extdev/nodes.html#sphinx.addnodes.pending_xref
>
> The documentation is a bit sparse, those are the arguments I've used so far:
>
> reftype='ref' or reftype='doc' or ...: the type of reference
>
> reftarget='my-reference': the actual reference, e.g. a label or document name
>
> refdomain='std': This is typically 'std', but there are other domains
>
> refwarn=True, refexplicit=True: I don't remember what they do
>
> refdoc=env.docname: I guess the name of the current doc, I've used
> "env.docname".
>
> > Unfortunately, I haven't been able to find any sample code that does this, 
> > to use a model. The todo extension comes close: it seems to resolve 
> > references within the todo items, but the extension itself is built quite 
> > differently, and the resolution occurs after 'doctree-resolved' fires and 
> > uses custom nodes etc...
>
> I don't know if that helps, but I've created some labels and
> references in my extension "nbsphinx":
> https://github.com/spatialaudio/nbsphinx/blob/master/src/nbsphinx.py
> Just search for "pending_xref".
>
> cheers,
> Matthias
>
> > Any pointers or suggestions would be useful. Thanks.
> >
> > - Noah
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sphinx-users+unsubscr...@googlegroups.com.
> To post to this group, send email to sphinx-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To post to this group, send email to sphinx-users@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to