Hi, thanks a lot didn't know about inline_text. I deleted my post because I
solved it by creating a ListView and using nested_parse. But indeed
inline_text is shorter and better suited for this easy task.
Thanks a lot!
Le jeudi 24 janvier 2019 16:41:52 UTC+1, Komiya Takeshi a écrit :
>
> 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 <[email protected] <javascript:>>:
> >
> > 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 [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.