This also refactors writer_preprocess_page to use the attributes object, which is more standard, and cleaner.