sphinx-needs icon indicating copy to clipboard operation
sphinx-needs copied to clipboard

Support needs_templates for needextract

Open twodrops opened this issue 3 years ago • 2 comments

#689 will allow usage of needextract as target links. It will then be good to have possibilties of using needs_templates for needextract together with the already supported layout and style.

This will allow the extracted needs to be templated without affecting the original need.

Is this feasible?

twodrops avatar Sep 13 '22 09:09 twodrops

Ohh, tough one. I'm afraid that this is not doable.

needextract itself gets executed after the rst-rendering phase of Sphinx. So this is too late to add any rst-based (pre/post-)content.

I think the current needextract mechanism simply copies the content-node from the original need-node. Therefore it does not need to render anything again.

I will recheck the code, but I do not have much hope.

danwos avatar Sep 13 '22 09:09 danwos

Ok I thought so too that it might be a tough one :)

The usecase is:

  • needs are imported flat in a single page (from external tools or using needimport)
  • needextract is used to (re)document the imported needs in separate pages
  • The newly documented needs are set as target link #689
  • the newly documented needs have contents added like needflow etc. automatically
  • the original needs in the needimport page are not affected as the page might othwerwise be slow to generate/load

twodrops avatar Sep 13 '22 09:09 twodrops