achekalin Reply #1, 2 years, 7 months ago
I spend some time trying to understand if I can do some nice typography characters replacement (by creating some plugin or something) but have no luck yet.
What I need is to (say) replace dashes, surrounded by spaces (" - ") to em-dashes (" — " - not sure the browser will post that right way). This can be done ina couple of ways: 1) once after page content change, or 2) by change the full page result HTML (right before it outputs to browser).
First way it the best as it save us CPU cycles on every page generation, but what we should do is to let user to edit the page's content, then to process it with our replacement(s), and to store result in some extra field (or to extra table). Then change code that create pages (by putting content into template) so the code will take our new cache field (or do extra request to our new cache table). This require me to modify core code, something that's not that good idea, I'd prefer to do such a change in a external piece of code (snippet or whatever).
Second way, to my great sorrow, can be done the same way, by modifying core output code.
So the question: may there be any way I can intercept site page output (right before page will be send to the user) to have it changed in the way I want and do such intercept in a way (plugin?) that won't be destroyed after next minor modx update (say from 1.0.0 to 1.0.1 or so)? Or it will be wiser to modify modx core code and never mind on updates?
What I need is to (say) replace dashes, surrounded by spaces (" - ") to em-dashes (" — " - not sure the browser will post that right way). This can be done ina couple of ways: 1) once after page content change, or 2) by change the full page result HTML (right before it outputs to browser).
First way it the best as it save us CPU cycles on every page generation, but what we should do is to let user to edit the page's content, then to process it with our replacement(s), and to store result in some extra field (or to extra table). Then change code that create pages (by putting content into template) so the code will take our new cache field (or do extra request to our new cache table). This require me to modify core code, something that's not that good idea, I'd prefer to do such a change in a external piece of code (snippet or whatever).
Second way, to my great sorrow, can be done the same way, by modifying core output code.
So the question: may there be any way I can intercept site page output (right before page will be send to the user) to have it changed in the way I want and do such intercept in a way (plugin?) that won't be destroyed after next minor modx update (say from 1.0.0 to 1.0.1 or so)? Or it will be wiser to modify modx core code and never mind on updates?
.