Metadata-Version: 1.1
Name: tree-extractor
Version: 0.1.6
Summary: Lib to extract html elements by preserving ancestors and cleaning CSS
Home-page: https://github.com/jurismarches/tree_extractor
Author: Jurismarchés
Author-email: contact@jurismarches.com
License: UNKNOWN
Description: tree_extractor
        ==============
        
        .. image:: https://travis-ci.org/jurismarches/tree_extractor.svg?branch=master
            :target: https://travis-ci.org/jurismarches/tree_extractor
        
        Extracts html contents by preserving ancestors and clean CSS
        
        Compatible with Python >= 2.6, <= 3.4
        
        Usage
        -----
        
        .. code-block:: python
        
          from tree_extractor import TreeExtractor
        
          HTML = """
          <html>
            <head>
              <title>Test</title>
            </head>
            <body>
              <div id="header"></div>
              <div id="main">
                <div class="iwantthis">
                  HELLO WORLD
                  <a href="/nope">Do not want</a>
                </div>
              </div>
              <div id="footer"></div>
            </body>
          </html>
          """
          
          CSS = """
          div { border: 1px solid black; }
          div#main { color: blue; }
          div.iwantthis { background-color: red; }
          a { color: green; }
          div#footer { border-top: 2px solid red; }
          """
          
          extractor = TreeExtractor().keep('//div[@class="iwantthis"]').discard('//a')
          html, css = extractor.extract(HTML, CSS)
          
        The result is :
        
        .. code-block:: python
        
          >>> html
          """
          <html>
            <body>
              <div id="main">
                <div class="iwantthis">
                  HELLO WORLD
                </div>
              </div>
            </body>
          </html>"""
          
          >>> css
          """
          div{border:1px solid black;}
          div#main{color:blue;}
          div.iwantthis{background-color:red;}
          """
        
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
