Hi,

Yes, you need to create pending_xref as a result of your directive.
But it is a bit complex. How about using inline_text() to parse
generated "txt" in your directive?

::

    def run(self):
        txt = "Blablabla moved to :doc:{0}".format(self.arguments[0])
        inodes, messages = self.state.inline_text(txt, self.lineno)
        para = nodes.paragraph('', '', *inodes)
        return [para, messages]

This example tries to parse the text using inline_text(). It parses
given text as a inline text, and returns nodes as a result.
I think this is much simpler thank generating pending_xref manually.

Thanks,
Takeshi KOMIYA

2019年1月24日(木) 0:35 Maxime Adam <gr4ph0...@gmail.com>:
>
> Hi I'm pretty new to Sphinx directive development so I may miss some 
> background information.
>
> With that's said I'm willing to do this following directive
>
>
> class MarkAsDeprecated(Directive):
>
>     def run(self):
>
>         txt = "Blablabla moved to :doc:{0}".format(self.arguments[0])
>         paragraph_node = nodes.paragraph(text=txt)
>
>         return [paragraph_node]
>
>
> But :doc: is not render. I think I should insert a pending_xref(note sur it's 
> the correct one but it's seems to be) node but I really don't know how to do 
> it.
>
> And here is my directive
>
>
> .. deprecated:: `/manuals/something/my_new_manual`
>
> Thanks in advance!
>
> Cheers,
>
> Maxime.
>
> --
> 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