proxy.golang.org : gitlab.com/metakeule/goh4
Package goh4 constructs html element trees (something like DOM), html templates and integrates them with css rules. All of them are done by using types, not strings. This makes reuse and shortcuts easy. It is inspired by http://godoc.org/github.com/daaku/go.h It is easy to extend goh4 and build upon it and you may bring in some html and css strings as well. There are some helper functions to generate elements for you. For instance gives you an anchor element. Here is how A() is defined and how you may define your own shortcuts. A() calls NewElement() with a typed Tag (created from a string) and a flag that indicates that it's an inline element. All flags are defined as constants and may be combined with the bitwise or | or given as seperate parameters. Then A() sets up the element by passing the optional Stringer to the Set() method. This allows you do some neat things, for instance Then you may get all the nice methods of element You may define your own Matcher and pass it to All() and Any(). Template is an element that can Assign() anything that can be inside an element to any element within the tree, that has the given Id(). Template may also add css to your head element. In this case you need to use the Doc() pseudo element, that holds the root of the document. And you need a head obviously. Element and Template are structs you can inherit from them, e.g. If you want type safe reusable css, you can use Css. and then you might apply it to your elements. don't forget to put your css into the template (we don't put fontsize into it, since it is only a building block) this results in the following (no auto indentation at the moment, sorry):
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/gitlab.com/metakeule/goh4
License: BSD-3-Clause
Latest release: 3 months ago
Namespace: gitlab.com/metakeule
Stars: 0 on gitlab.com
Forks: 0 on gitlab.com
See more repository details: repos.ecosyste.ms
Last synced: 3 months ago