bro

command module
v0.0.0-...-a02fabe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 13 Imported by: 0

README

Bro

A toy browser engine written in Go, inspired by Robinson.

Also contains:

  • a CSS Lexer / Parser: bro/css
  • a HTML Lexer / Parser: bro/dom

Available CSS propreties:

  • background-color
  • height
  • width
  • margin-left, margin-right, margin-top, margin-bottom
  • padding-left, padding-right, padding-top, padding-bottom
  • border-color
  • border-left-width, border-right-width, border-top-width, border-bottom-width

Example usage

input.html

<div class="a">
    <div class="b">
        <div class="c">
            <div class="d">
                <div class="e">
                    <div class="f">
                        <div class="g">
                            <div class="h"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

input.css

.a { background-color: #FFFFFF; padding: 12px;}
.b { background-color: #DDDDDD; padding: 12px;}
.c { background-color: #BBBBBB; padding: 12px;}
.d { background-color: #999; padding: 12px;}
.e { background-color: #777; padding: 12px;}
.f { background-color: #555; padding: 12px;}
.g { background-color: #333; padding: 12px;}
.h { background-color: #111; padding: 12px;}

Command

./bro -html input.html -css input.css -o output.png

output.png

Example output

TODO

  • Ignore HTML comments and white spaces when building style tree
  • Implement CSS star selector
  • Add text rendering

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package layout represents the layout tree of the HTML renderer.
Package layout represents the layout tree of the HTML renderer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL