-
Notifications
You must be signed in to change notification settings - Fork 6
TreeSS implementation
Since the May 2017 workshop revealed general support for a tree-styling convention based on CSS, we should explore more about how this can be implemented with minimal burden on the developers of various tree-viz programs.
This includes more detail on how the early NexSS spec can be expanded to include useful phylogenetic concepts in selectors and property values, e.g. {NODE_ID}:clade-children {...}
, edge-width: (support * 0.5)px;
. Also exploration of common CSS parsers (and generators of same like ANTLR.
When implementing TreeSS, it's easiest to use an existing CSS parser for your preferred language. These typically provide lexing and parsing of modern CSS, exposing a rule-set (or equivalent) that your program . What remains is to walk this rule set, check its selectors against the current tree elements, and style them according to the listed properties and values.
-
Python
- tinycss (used in ETE proof-of-concept)
- cssutils
-
JavaScript
- ?
-
R
- selectr
TODO: Do any of these "do more" to resolve selectors, automate property modifications, etc.?
TODO: Do these provide syntax-error reporting? or do they silently ignore unrecognized/unparseable stuff?
TODO: What about caching of matching elements, etc.? Do any parsers provide this?
TOOD: Incorporate all of the above into a simple comparison grid here!
ANTLR is a powerful parser generator with runtime support for several popular languages. It includes a pretty comprehensive CSS grammar that might be useful if we need to add new keywords or elements for TreeCSS.
But generally speaking, we should try to use existing CSS parsers (above) instead. Most of our work will involve interpreting parsed TreeCSS and applying styles in the idiom of each runtime host (tree viewer). Note that ANTLR doesn't currently support some of our target languages, notably R.
E.g. R has a few that are quite limited, but might be extended.
TODO: Include (or link to) a quick glossary of CSS terms (e.g. selector, rule, ruleset, cascade) and simple definitions.
TODO: Outline types ("reading", "writing") and levels ("core", "full") of support for TreeSS)