first sketch of picodoc-write-doc function.