christopher-ramirez / secretary

Take the power of Jinja2 templates to OpenOffice and LibreOffice.
Other
190 stars 48 forks source link

Get list of tags in template #48

Open wpregliasco opened 6 years ago

wpregliasco commented 6 years ago

I need to get a list of tags in a template document, but I can't figure how to do it. Is there any public function to use? Thanks.

christopher-ramirez commented 6 years ago

Hello!

There is not any official way to do this. There's an internal function of Renderer class which does exactly what you want. The function is called _tags_in_document.

As I said, this is an internal function and any code relaying on it is not guaranteed to work within version changes. I can tell you right now that it won't work for the next Secretary version (on development branch).

Hope this helps.

wpregliasco commented 6 years ago

Thank you very much. It would be nice to have a public function that reports the fields in documents. My intention is to make an automatic form, reading the template to fill the fields.

May be there is a better way to do that, and I don't figure how. Any suggestion ?

Thanks again.

christopher-ramirez commented 6 years ago

Hello!

I don't quite understand what you really want to do? What you mean by "an automatic form"? Automatically filing fields is what Secretary already does. In what aspect is your use case different from that?

Looking forward for your comments.

wpregliasco commented 6 years ago

okay, surely I wasn't clear enough. Many of my bureaoucratic work consists in filling the same data again and again in different documents. Then I want to list the fields in all the required documents and make a form asking the minimum data, avoiding duplication of fields. With that content then I can complete all the documents usin secretary. The workflow is: (many templates with repeated fields)-->(make a form asking data needed)-->(fill templates with secretary)

Hope it's clear now. I think it's a good idea. Comments welcome.

christopher-ramirez commented 6 years ago

It is clear now!

Thank for the clarifying this.

enricofer commented 2 years ago

I submit a PR for this: https://github.com/christopher-ramirez/secretary/pull/75