emit-document, defemitter, :data op, multimethods

* add emit-document function
* add defemitter macro
* add :data op
* refactor to use multimethods in some places