stand-alone universal function for text compilation