landslide icon indicating copy to clipboard operation
landslide copied to clipboard

Auto load macros from the themes directory

Open BestFriendChris opened this issue 14 years ago • 4 comments

Due to the relatively tight coupling between css/html and what the macros are producing, I think allowing people to add new macros inside of their themes makes sense.

I propose adding a folder (called macros) to the existing themes directories, moving all of the existing macros to the default theme, and writing code to autoload from these files.

If we think this is a good idea, I'd be willing to help out with this as well. My python is really rusty, so I'm not sure how much help I'd be in the autoloading code, but everything else I'm sure I'd be able to add value with.

Thoughts?

BestFriendChris avatar May 08 '11 20:05 BestFriendChris

I'm not sure macros should be tied to the theme concept. IMHO theming is much more about presentation than effective feature, and macros provide features (or at least, processing)…

Definitely a tough question.

n1k0 avatar May 18 '11 17:05 n1k0

The problem is that sometimes a macro has an impact on layout. Take the presenter view as an example. That required additions to the HTML, CSS, and JS.

Another example: I put my résumé in a landslide slideshow (http://bestfriendchris.github.com/resume). I'd like to add a macro that has first level slides be laid out vertically while sub-slides be laid out horizontally. I don't really believe this belongs in stock landslide, but I'd like to include it in my own project. This will definitely require HTML, CSS, & JS changes...

BestFriendChris avatar May 18 '11 18:05 BestFriendChris

Hmmm you highlight a point I think I missed while designing landslide as it is now: the distinction between a /project/ and a /theme/… I'll have to think a bit more about this

n1k0 avatar May 18 '11 21:05 n1k0

As a side note, what do you think about the possibility of importing macros through the config.cfg file, eg:

[landslide]
source = slides/
macros = macros.MyMacro
         macros.OtherMacro

So you could have a project structure like this:

project/
    slides/
        0_intro.md
        1_conclusion.md
    config.cfg
    macros.py 

With of course some kind of import function smart enough to resolve the macro class paths a bit like how Django does.

This could overcome part of the the problem you're raising here… Thoughts?

n1k0 avatar May 18 '11 21:05 n1k0