From: Felix W. <Fel...@gm...> - 2005-06-28 16:37:07
|
David Goodger wrote: > You miss my point. Transforms may not be *applied* by a Writer, or by > any other component other than the Transformer. But transforms can be > and are *specified* by any component, including a Writer. Yes, I understood that. :-) >> And since the writer-specific transform would need to be applied >> *before* universal.Messages, you could no longer intercept the >> document tree between parsing and writing (as does publish_doctree) >> because the transforms are intermixed. > > Not true. Transforms from all components (reader, parser, writer) are > added to the Transformer's queue when the Publisher is assembled. Yes, of course, but you can no longer do the following: 1. Read, parse, apply transforms of reader, parser, and default transforms. 2. Get the doctree and store it. 3. Write the doctree with *any* writer, applying writer-specific transforms beforehand. because with the newly added transform you would have to apply the writer-specific transforms in step 1 (before the default transform universal.Message); at this step the writer is not known yet, however. >> We need some way to separate reader/parser, default, and writer >> transforms. > > Why do we have to separate them? It's very convenient for 3rd-party applications to call publish_doctree, modify the doctree, and call publish_from_doctree. And it may be necessary to read and parse a document, store it, and write it out later. (E.g. for performance reasons.) That's no longer possible now in a clean manner. It just smells bad if there is no point *between* parsing and writing. Because with the new writer-transform, before applying the transforms the parsing isn't complete (parser-specific transforms haven't been applied yet) and after applying them the writing has already begun (because writer-specific transforms have already been applied). Parsing and writing should be *completely* separate, and that's only possible if we do not mix parser- and writer-specific transforms. As a solution, we could apply transforms in the following order: * Reader-/parser-specific transforms, Decorations, FinalChecks. * Writer-specific transforms, Messages and FilterMessages. So we would have the writer-specific transforms before Message and FilterMessages so that writer transforms can add system_messages, and we'd still have parsing and writing completely separate. What d'you think? -- For private mail please ensure that the header contains 'Felix Wiemann'. "the number of contributors [...] is strongly and inversely correlated with the number of hoops each project makes a contributing user go through." -- ESR |