gollum/gollum-lib — pull request #50 by mpalmer (2014-01-05 02:18:26+00:00)
Title: Convert the markup class to use "filter chains"

Refactor out the steps required to turn a marked-up file into a HTML
fragment ready for display into individual classes. The benefit of this is
that users can modify the processing chain for their own needs, without
needing to go subclassing Gollup::Markup. This should be a big win.

It's a conceptually simple change that gets a bit messy, since the
extraction and processing code got its tentacles into a few places.

In essence, each phase of rendering a page is encapsulated in a separate
class with extract/process methods, more-or-less mirroring the existing
structure. I had to take a bit of a gamble between sharing state between
filter steps (via the markup class instance) and redoing some things
multiple times (HTML parsing/assembly), but I felt that was cleaner than the
alternatives, especially since if we store a parsed document, we'd have to
make sure that cache wasn't invalidated by an intermediate step.