AFAIK, Sphinx goes to resolve xrefs independently for other documents.
And it dumps the result after processing.
For this reason, we can never access the resolved xrefs whole of the project.
So I feel introducing xtext might be difficult.

It might be better to implement better astext() instead.

2018-01-20 1:36 GMT+09:00 Matthew Woehlke <mwoehlke.fl...@gmail.com>:
> On 2018-01-17 21:35, Komiya Takeshi wrote:
>> Thank you for investigation.
>> Unfortunatley, I don't know how sphinx generates TOC. Of course, I
>> know where the code is, but it is too difficult for me.
>> So I don't have any comments now.
>> I'll take a look later if I have time (but there are tons of issues and 
>> PRs....)
>
> I've been thinking about this more. I also have not dug out the TOC
> code, but I feel confident that astext() is involved at some stage.
>
> I *think* a plausible solution is:
>
> - Introduce a new node type similar to xref, but call it e.g. xtext.
> Like xref, this needs to be resolved in a later pass. These will
> *encapsulate* xref nodes (in order to reuse the resolution logic), but
> when processed, will strip the nodes to bare text via astext().
>
> - Add a pass to resolve xref (needs to happen after xref). Per above,
> resolution consists of flattening the node into bare text. Critically,
> though, this will happen *after* xrefs have been resolved.
>
> - Modify TOC to, rather than immediately doing astext(), turn any node
> tree that contains an xref into an xtext containing a copy of the node tree.
>
> If this sounds reasonable, I will look into implementing this.
>
> Per my other mail, this also suggests a way that existing xref roles
> could be extended to do text resolution but not produce links with
> minimal overhead, by simply tweaking the XRefRole logic to wrap the
> whole mess in an xtext.
>
> --
> Matthew
>
> --
> 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