I’m building a Middleman extension for making sites that act like digital books.
I’d like some helper methods in this extension to access some data or methods stored in the parent extension’s instance.
I know that a new instance of a MyExtension
class is created upon activation, but I can’t seem to figure out a good way to get a handle on it during runtime. Any suggestions on how to call some of its instance methods within a helper method?
Specifically, I’m trying to create a Book
extension to organize book-y things like chapters, frontmatter/backmatter, etc. and I’d like to write some next_chapter
and prev_chapter
helper methods, which would ideally be able to get a full chapter list from the extension itself (keeping this logic out of my templates).
Thanks,
Eric