Skip to content

Read comment blocks from XML and CTI files when converting to YAML #23

@bryanwweber

Description

@bryanwweber

Abstract

XML and CTI input files may contain comments that describe the content of the file. It would be useful to try to include these comments in the YAML file after conversion.

Motivation

Many XML and CTI input files contain comments (using <!-- --> in XML and # in CTI) that describe the purpose of the file. Often these comments are at the top of the file. It would be nice to try to automatically copy these comments into the description field of the YAML file when the corresponding input file is converted.

For comments deeper in the file (e.g., above a reaction), it is not always clear with which entry the comment should be associated, so handling these becomes more complicated. Perhaps a warning could be issued to inform users that any custom comment messages should be copied manually to the YAML file?

Possible Solutions

It should be possible to get comments from the XML ElementTree in ctml2yaml.py. On the other hand, it isn't possible to get # comments from the CTI files using the ast module, so some more creative alternative might need to be explored.

References

Discussed here: Cantera/cantera#768 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions