Function mola::parse_yaml(const std::string&, const YAMLParseOptions&)

Function Documentation

std::string mola::parse_yaml(const std::string &text, const YAMLParseOptions &opts = YAMLParseOptions())

Pre-process a raw YAML string, expanding $include{}, $(), and ${} expressions according to opts.

The three substitution passes are always run in the order listed in YAMLParseOptions (includes → command runs → variables), regardless of the order in which the expressions appear in the text. Lines that begin with a YAML comment character (#) are skipped for variable expansion.

Parameters:
  • text – Raw YAML text to process.

  • opts – Controls which substitutions are active and supplies custom variables / the include base path.

Throws:

<tt>std::exception</tt> – if a required variable is undefined, a shell command exits with a non-zero status, or a referenced include file cannot be found.

Returns:

Fully substituted YAML text (still a plain string; call mrpt::containers::yaml::FromText() to parse it).