Created
February 26, 2013 12:58
-
-
Save denisdefreyne/5038234 to your computer and use it in GitHub Desktop.
Customisable content types for nanoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Text < Nanoc::Content | |
end | |
class Binary < Nanoc::Content | |
end | |
class DOM < Nanoc::Content | |
end | |
class DOMParser < Nanoc::Filter | |
input Nanoc::Content::Text | |
output Nanoc::Content::DOM | |
def run(content) | |
parse(content) | |
end | |
end | |
class DOMMutator < Nanoc::Filter | |
input Nanoc::Content::DOM | |
output Nanoc::Content::DOM | |
def run(dom) | |
do_stuff_with(dom) | |
end | |
end | |
class DOMSerializer < Nanoc::Filter | |
input Nanoc::Content::DOM | |
output Nanoc::Content::Text | |
def run(dom) | |
dom.to_s | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment