class HtmlOutput: """ Generates HTML from documentation model """ def __init__(self): pass def generate_output(self, parsed_items): """Returns generated HTML strin""" return self.__get_html_begin() + \ self.__get_html_middle(parsed_items) + \ self.__get_html_end() def __get_html_begin(self): return '\n\n\n\n\n\n' def __get_html_end(self): return '\n' def __get_html_middle(self, parsed_items): output = '' root_item = parsed_items[0] #output += '

{}

\n'.format(root_item['title']) #output += '

{}

\n'.format(root_item['title']) output += "Schema for Quay Enterprise" output += '\n' return output def __get_required_field(self, parsed_item): return 'required' if parsed_item['required'] else '' def __get_html_item(self, parsed_item, is_root): item = '
  • \n' item += '
    {}
    \n'.format(parsed_item['name']) item += '
    [{}]
    \n'.format(parsed_item['type']) item += '
    {}
    \n'.format(self.__get_required_field(parsed_item)) item += '
    \n' if not is_root else '
    \n' item += '
    {}
    \n'.format(parsed_item['title']) item += ': ' if parsed_item['title'] != '' and parsed_item['description'] != '' else '' item += '
    {}
    \n'.format(parsed_item['description']) item += '
    enum: {}
    \n'.format(parsed_item['enum']) if parsed_item['enum'] != '' else '' item += '
    Min Items: {}
    \n'.format(parsed_item['minItems']) if parsed_item['type'] == "array" and parsed_item['minItems'] != "None" else '' item += '
    Unique Items: {}
    \n'.format(parsed_item['uniqueItems']) if parsed_item['type'] == "array" and parsed_item['uniqueItems'] else '' item += '
    Pattern: {}
    \n'.format(parsed_item['pattern']) if parsed_item['pattern'] != 'None' and parsed_item['pattern'] != '' else '' item += '\n'.format(parsed_item['x-reference'],parsed_item['x-reference']) if parsed_item['x-reference'] != '' else '' item += '
    Example: {}
    \n'.format(parsed_item['x-example']) if parsed_item['x-example'] != '' else '' item += '
    \n' item += '
  • \n' return item