Exemplo n.º 1
0
 def test_remove_script_tags(self):
     html = '''
                 <h1>Title</h1>
                 <script type="text/javascript">
                 </script>
            '''
     res = html_index_content(html)
     assert res == "Title"
Exemplo n.º 2
0
 def test_process_whitespaces(self):
     html = '''
                 <h1>Title</h1>
                 <br />
                 <p>This is a paragraph.</p>
             '''
     res = html_index_content(html)
     assert res == "Title This is a paragraph."
Exemplo n.º 3
0
 def test_process_whitespaces(self):
     html = '''
                 <h1>Title</h1>
                 <br />
                 <p>This is a paragraph.</p>
             '''
     res = html_index_content(html)
     assert res == "Title This is a paragraph."
Exemplo n.º 4
0
 def test_remove_script_tags(self):
     html = '''
                 <h1>Title</h1>
                 <script type="text/javascript">
                 </script>
            '''
     res = html_index_content(html)
     assert res == "Title"
Exemplo n.º 5
0
 def test_unescape(self):
     html = '''
                 <h1>Title</h1>
                 <script type="text/javascript">
                 </script>
                 <footer>
                     <a href="./" class="button_accent">
                         &nbsp;&nbsp;&nbsp;Back to blog
                     </a>
                 </footer>
                 <code>
                     print 1&lt;3
                 </code>
             '''
     res = html_index_content(html)
     assert res == "Title Back to blog print 1<3"
Exemplo n.º 6
0
 def test_unescape(self):
     html = '''
                 <h1>Title</h1>
                 <script type="text/javascript">
                 </script>
                 <footer>
                     <a href="./" class="button_accent">
                         &nbsp;&nbsp;&nbsp;Back to blog
                     </a>
                 </footer>
                 <code>
                     print 1&lt;3
                 </code>
             '''
     res = html_index_content(html)
     assert res == "Title Back to blog print 1<3"
Exemplo n.º 7
0
 def _doc_file_as_dict(self, path, name, doc_dir):
     last_commit = self.repo.get_last_commit("HEAD", path)
     if not last_commit:
         return
     sd = SphinxDocs(project_name=self.project.name)
     data = {
         'type': 'docs',
         'description': '',
         'author': last_commit.author.name,
         'time': last_commit.time.strftime('%Y-%m-%dT%H:%M:%S'),
         'project_id': self.project.id,
         'project_name': self.project.name,
         'doc_name': name,
         'doc_dir': doc_dir,
         'url': sd.get_url_from_path(path)
     }
     blob = self.repo.get_file('HEAD', path)
     src = blob.data or ''
     if path.endswith('.html'):
         data['content'] = html_index_content(src)
     else:
         data['content'] = src
     return data