def build_index(journal_list):
  """Create an index.html file for HTML output from journal list.

  Args:
    journal_list: [array of path] Path to the journal files to put in the index.
       Assumes that there is a corresponding .html file for each to link to.
  """
  document_manager = HtmlDocumentManager(title='Journal Summary')
  document_manager.has_key = False
  document_manager.has_global_expand = False

  processor = HtmlIndexRenderer(document_manager)
  for journal in journal_list:
    processor.process(journal)
  processor.terminate()

  tr = document_manager.make_tag_container(
      'tr',
      [document_manager.make_tag_text('th', name)
       for name in processor.output_column_names])
  table = document_manager.make_tag_container(
      'table', [tr], style='font-size:12pt')
  document_manager.wrap_tag(table)

  document_manager.build_to_path('index.html')
def build_table(journal_list, output_dir):
  document_manager = HtmlDocumentManager(title='Journal Summary')
  document_manager.has_key = False
  document_manager.has_global_expand = False

  HtmlIndexTableRenderer.process_all(document_manager, journal_list, output_dir)
  document_manager.build_to_path(os.path.join(output_dir, 'table_index.html'))
def build_index(journal_list, output_dir):
    """Create an index.html file for HTML output from journal list.

  Args:
    journal_list: [array of path] Path to the journal files to put in the index.
       Assumes that there is a corresponding .html file for each to link to.
  """
    document_manager = HtmlDocumentManager(title='Journal Summary')
    document_manager.has_key = False
    document_manager.has_global_expand = False

    processor = HtmlIndexRenderer(document_manager)
    for journal in journal_list:
        processor.process(StreamJournalNavigator.new_from_path(journal))
    processor.terminate()

    tr_tag = document_manager.make_tag_container('tr', [
        document_manager.make_tag_text('th', name)
        for name in processor.output_column_names
    ])
    table = document_manager.make_tag_container('table', [tr_tag],
                                                style='font-size:12pt')
    document_manager.wrap_tag(table)

    document_manager.build_to_path(os.path.join(output_dir, 'index.html'))
def build_table(journal_list, output_dir):
    document_manager = HtmlDocumentManager(title='Journal Summary')
    document_manager.has_key = False
    document_manager.has_global_expand = False

    HtmlIndexTableRenderer.process_all(document_manager, journal_list,
                                       output_dir)
    document_manager.build_to_path(os.path.join(output_dir,
                                                'table_index.html'))
def journal_to_html(input_path):
  """Main program for converting a journal JSON file into HTML.

  This will write a file using in the input_path directory with the
  same basename as the JSON file, but with 'html' extension instead.

  Args:
    input_path: [string] Path the journal file.
  """
  output_path = os.path.basename(os.path.splitext(input_path)[0]) + '.html'

  document_manager = HtmlDocumentManager(
      title='Report for {0}'.format(os.path.basename(input_path)))

  processor = HtmlRenderer(document_manager)
  processor.process(input_path)
  processor.terminate()
  document_manager.wrap_tag(document_manager.new_tag('table'))
  document_manager.build_to_path(output_path)
def journal_to_html(input_path, prune=False):
    """Main program for converting a journal JSON file into HTML.

  This will write a file using in the input_path directory with the
  same basename as the JSON file, but with 'html' extension instead.

  Args:
    input_path: [string] Path the journal file.
  """
    output_path = os.path.basename(os.path.splitext(input_path)[0]) + '.html'

    document_manager = HtmlDocumentManager(
        title='Report for {0}'.format(os.path.basename(input_path)))

    processor = HtmlRenderer(document_manager, prune=prune)
    processor.process(StreamJournalNavigator.new_from_path(input_path))
    processor.terminate()
    document_manager.wrap_tag(document_manager.new_tag('table'))
    document_manager.build_to_path(output_path)