docstr: Return the support matrix table for the specified container
  in RST simple table form.
docstr_tok: ["Return","the","support","matrix","table","for","the","specified","container","in","RST","simple","table","form","."]
code: def table_as_str(
      self, container: str, rel_prefix: str
  ) -> typing.List[str]:
      """Return the support matrix table for the specified container
      in RST simple table form.
      """
  
      # This is a two-pass implementation. The first pass iterates
      # over the data and collects the maximum dimensions for the table:
      # - number of columns, keeping in mind there is a stub column with row "headings"
      # - for each column, the maximum string length, all rows are padded with spaces to
      #   this length
      # - within each row, the maximum number of lines--specifically for bulleted lists
      #
      self.set_table_dims(container, rel_prefix)
      to_ret = []
  
      # Make the stub row headings.
      fields = self.table_config[container]
      colwidth = fields["maxwidth"]
      to_ret.append("=" * colwidth + "  ")
      to_ret.append("Container Release".ljust(colwidth) + "  ")
      to_ret.append("=" * colwidth + "  ")
  
      for k, v in fields.items():
          if k == "maxwidth":
              continue
          # Print the stub row heading.
          bold_stub = "**{}**".format(k)
          to_ret.append(bold_stub.ljust(colwidth) + "  ")
  
          # If this row has multiple lines, add the blank-padded lines.
          stub_line_count = k.count("\n")
          for _ in range(v["maxlines"] - stub_line_count):
              to_ret.append(" " * colwidth + "  ")
  
          if "span" in v.keys() and v["span"] is True:
              to_ret.append("-" * colwidth + "--")
  
      to_ret.append("=" * colwidth + "  ")
      # End stub row headings.
  
      # Print a column for each release.
      year_data = {
          k: v
          for k, v in self.data[container].items()
          if k.startswith(rel_prefix)
      }
      for idx, release in enumerate(sorted(year_data, reverse=True)):
          data = year_data.get(release)
          colwidth = data["maxwidth"]
          relhead = "Release " + release
  
          # Print the release, this is not part of the fields dictionary.
          to_ret[0] += "=" * colwidth + "  "
          to_ret[1] += relhead.ljust(colwidth) + "  "
          to_ret[2] += "=" * colwidth + "  "
  
          line_no = 3
          for k, v in fields.items():
              if k == "maxwidth":
                  continue
  
              if "field" in v.keys():
                  val = data[v["field"]]
                  for line in val.split("\n"):
                      to_ret[line_no] += line.ljust(colwidth)
                      if len(year_data) - 1 == idx:
                          to_ret[line_no] += "\n"
                      else:
                          to_ret[line_no] += "  "
                      line_no += 1
  
                  for _ in range(v["maxlines"] - val.count("\n")):
                      to_ret[line_no] += " " * colwidth
                      if len(year_data) - 1 == idx:
                          to_ret[line_no] += "\n"
                      else:
                          to_ret[line_no] += "  "
                      line_no += 1
  
              if "span" in v.keys():
                  to_ret[line_no] += " " * colwidth
                  line_no += 1
                  to_ret[line_no] += "-" * colwidth
                  line_no += 1
  
                  # If this isn't the last column, add two spaces
                  # or dashes.
                  if len(year_data) - 1 != idx:
                      to_ret[line_no - 2] += "  "
                      to_ret[line_no - 1] += "--"
  
          to_ret[line_no] += "=" * colwidth + "  "
  
      for idx, line in enumerate(to_ret):
          to_ret[idx] = "   " + line + "\n"
  
      table_heading = rel_prefix + ".xx Container Images"
  
      # In reverse order
      to_ret.insert(0, "\n")
      to_ret.insert(0, "   :align: left\n")
      to_ret.insert(0, ".. table::\n")
      to_ret.insert(0, "\n")
      to_ret.insert(0, "~" * len(table_heading) + "\n")
      to_ret.insert(0, table_heading + "\n")
      to_ret.insert(0, "\n")
  
      # Final blank line
      to_ret.append("\n")
  
      return to_ret
  
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 5 for calling the Smx2Rst obj's underlying member method code with example usage: obj.table_as_str(container, rel_prefix) and returns: to_ret