Example #1
0
def show_sbtab():
    '''
    displays a given SBtab file in html
    '''
    try:
        sbtab = session.sbtabs[int(request.args(0))]
    except:
        return 'There is something wrong with this SBtab file. It cannot be loaded properly.'
    return misc.sbtab_to_html(sbtab, session.definition_file)
    try:
        return misc.sbtab_to_html(sbtab, session.definition_file)
    except:
        return 'There is something wrong with this SBtab file. It cannot be loaded properly.'
Example #2
0
def write_html(sbtab, name, template, links, pageheader, definitions_file, show_table_text=True):
    '''
    calls the sbtab_to_html function and writes the HTML to disk
    '''
    html = misc.sbtab_to_html(sbtab, mode='standalone',template=template, put_links = links, title_string=pageheader, show_header_row=False, show_table_name=True, show_table_text=show_table_text, definitions_file = definitions_file)
    h = open(name, 'w')
    h.write(html)
    h.close()
Example #3
0
def write_html(sbtab, name):
    '''
    calls the sbtab_to_html function and writes the HTML to disk
    '''
    html = misc.sbtab_to_html(sbtab, mode='standalone')
    h = open(name, 'w')
    h.write(html)
    h.close()    
Example #4
0
 def test_single_tab_conversion(self):
     '''
     test if normal SBtab tables can be converted to valid HTML files
     '''
     for i, sbtab in enumerate(self.sbtabs):
         html_string = misc.sbtab_to_html(sbtab, self.table_names[i], 'standalone')
         self.assertEqual(html_string[0:5], '<html')
         self.assertEqual(html_string[-7:], '</html>')
         self.assertIn('<h2>%s</h2>' % (sbtab.filename), html_string)
         self.assertIn('!!SBtab', html_string)
Example #5
0
    def test_sbtab_to_html(self):
        '''
        test if SBtab tables and documents can be converted to an HTML view
        '''
        self.assertFalse(misc.sbtab_to_html(self.sbtabs[0].to_str()))
        self.assertFalse(misc.sbtab_to_html(self.sbtabs[0], mode='TrashMode'))

        for sbtab in self.sbtabs:
            sbtab_html = misc.sbtab_to_html(sbtab, mode='standalone')
            self.assertEqual(str, type(sbtab_html))
            self.assertTrue(sbtab_html.startswith('<html'))
            self.assertTrue(sbtab_html.endswith('</html>'))
            self.assertIn('<h2>%s</h2>' % sbtab.filename, sbtab_html)

        for doc in self.docs:
            sbtab_html = misc.sbtab_to_html(doc, mode='standalone')
            self.assertEqual(str, type(sbtab_html))
            self.assertTrue(sbtab_html.startswith('<html'))
            self.assertTrue(sbtab_html.endswith('</html>'))
            self.assertIn('<h2>%s</h2>' % doc.filename, sbtab_html)
Example #6
0
 def test_multiple_tab_conversion(self):
     '''
     test if SBtab documents can be converted to valid but singular HTML files
     '''
     for i, sbtab in enumerate(self.sbtab_docs):
         html_string = misc.sbtab_to_html(sbtab, self.doc_names[i], 'standalone')
         self.assertEqual(html_string[0:5], '<html')
         self.assertEqual(html_string[-7:], '</html>')
         self.assertIn('<h2>%s</h2>' % (sbtab.filename), html_string)
         self.assertIn('!!SBtab', html_string)
         self.assertEqual(html_string.count('!!SBtab'), len(sbtab.sbtabs))
Example #7
0
    def test_sbtab_to_html(self):
        '''
        test if SBtab tables and documents can be converted to an HTML view
        '''
        self.assertFalse(misc.sbtab_to_html(self.sbtabs[0].to_str()))
        self.assertFalse(misc.sbtab_to_html(self.sbtabs[0], mode='TrashMode'))
        
        for sbtab in self.sbtabs:
            sbtab_html = misc.sbtab_to_html(sbtab, mode='standalone')
            self.assertEqual(str, type(sbtab_html))
            self.assertTrue(sbtab_html.startswith('<html'))
            self.assertTrue(sbtab_html.endswith('</html>'))
            self.assertIn('<h2>%s</h2>' % sbtab.filename, sbtab_html)

        for doc in self.docs:
            sbtab_html = misc.sbtab_to_html(doc, mode='standalone')
            self.assertEqual(str, type(sbtab_html))
            self.assertTrue(sbtab_html.startswith('<html'))
            self.assertTrue(sbtab_html.endswith('</html>'))
            self.assertIn('<h2>%s</h2>' % doc.filename, sbtab_html)
Example #8
0
def show_sbtab_def():
    '''
    displays a given SBtab definition file in html
    '''
    try:
        sbtab_def = session.definition_file
    except:
        return 'There is something wrong with this SBtab file. It cannot be loaded properly. Please reload session (Troubleshooting page).'

    try:
        return misc.sbtab_to_html(sbtab_def)
    except:
        return 'There is something wrong with this SBtab file. It cannot be loaded properly.'