0

I have a rst file SWAP.rst and i need to extract some specific data and put in a dictionary.

the file looks like this:

:baseID: SWAP_DF

The current used for the force ...

.. requirement::SWAT_FD_AR_Force.432
   :c_This_is_a: functional
   :c_Release: AR_V2.RC
   :c_Maturity: accepted
   :c_Implementation: implemented

   text text text text
   tables

.. comment:: SDASD.471
   :c_This_is_a: functional
   :c_Release: adm_28.1
   :c_Implementation: implemented

   text tables etc

.. requirement:: SWAT_FD_AR_Force.231
   :c_This_is_a: non-functional
   :c_Release: AP_V1_RD1
   :c_Maturity: accepted
   :c_Implementation: implemented

   text, tables ,etc

And i need to extract all the requirement sections and put in a dictionary using python, docutils

  • If you want a better answer, you will need to explain what exactly you have a problem with, along with example of your *work in progress* code. – marbu Nov 17 '21 at 16:17

1 Answers1

0

You will have to implement Directive classes for comment and requirement directives, so that you can translate the rst document into a doctree, which you can then translate into desired dictionary form.

marbu
  • 1,939
  • 2
  • 16
  • 30