Skip to content
This repository was archived by the owner on Nov 13, 2019. It is now read-only.

christabor/code_reflector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Status Build Status MIT Badge Donation badge

codeReflector

A suite of tools to parse and transform web formats, for web applications and automation.

Components

CSS Reflector

Takes HTML and converts it to corresponding CSS. Though, it doesn't truly "convert". It parses the HTML and extracts the ids and classes, outputting them to blank selectors.

Example:

Using

from code_reflector import css_reflector as cssref

reflector = cssref.CSSReflector(newlines_and_spaces=True)
reflector.process('myhtmlfile.html').make_stylesheet(output='output.css')
<div id="foo">
    <div id="bar">
        <div id="bam" class="foo foo2"></div>
    </div>
</div>

becomes

#foo {}
#foo #bar {}
#foo #bar #bam.foo.foo2 {}

or, if nested is set to False,

#foo #bar #bam.foo.foo2 {}

HTML Reflector

Takes CSS and converts it to corresponding HTML. Similar to Emmett, but fully OSS, and programmable (and handles spaces for nested selectors). Also designed to work in conjunction with other Reflector components.

Example:

Using

from code_reflector import html_reflector as htmlref

reflector = htmlref.HTMLReflector(newlines_and_spaces=True)
reflector.process('mycssfile.css').extract().make_html(output='output.html')
.foo.bar#bar

becomes

<div class="foo bar" id="bar"></div>

Requirements

Requires Python 2.7+ Packages: see requirements.txt for more.

Installation

python setup.py install

Tests

Test coverage provided by nose. Run tests via python nosetests tests/

About

A suite of python tools to parse and transform between various web files like css and html.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages