docstr: Write the RST files that have the support matrix tables for
  each container.
  
  The implementation is to iterate over the containers from
  the `table_config.yaml` file and create one file for each container.
  
  Parameters
  ----------
  path : str
      The output path for the RST table snippets.
      The directory is created if it does not exist.
docstr_tok: ["Write","the","RST","files","that","have","the","support","matrix","tables","for","each","container",".","The","implementation","is","to","iterate","over","the","containers","from","the","`","table_config.yaml","`","file","and","create","one","file","for","each","container",".","Parameters","--","--","--","--","--","path",":","str","The","output","path","for","the","RST","table","snippets",".","The","directory","is","created","if","it","does","not","exist","."]
code: def to_rst(self, path: str):
      """Write the RST files that have the support matrix tables for
      each container.
  
      The implementation is to iterate over the containers from
      the `table_config.yaml` file and create one file for each container.
  
      Parameters
      ----------
      path : str
          The output path for the RST table snippets.
          The directory is created if it does not exist.
      """
  
      outdir = Path(path)
      if not outdir.exists():
          logger.info("Creating output directory: %s", str(outdir))
          outdir.mkdir(parents=True, exist_ok=True)
          logger.info("   ...done.")
  
      for container in self.table_config.keys():
          years = [
              self.release_pattern.search(x).group(1)
              for x in self.data[container].keys()
          ]
          years = sorted(set(years), reverse=True)
  
          fname = container.replace("/", "-")
          outpath = outdir / (fname + ".rst")
          logger.info("Creating RST table snippet: %s", str(outpath))
          with open(outpath, "w") as f:
              for year in years:
                  table = self.table_as_str(container, year)
                  for line in table:
                      f.write(line)
              logger.info("   ...done.")
  
file_path: Merlin/docs/smx2rst.py
imports: import argparse
  import json
  import logging
  import os
  import re
  import sys
  import typing
  from pathlib import Path
  import yaml
  from mergedeep import merge
label_desc: Use image node_id 4 for calling the Smx2Rst obj's underlying member method code with example usage: obj.to_rst(path) without return types