Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed/working macro option #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

dingus9
Copy link

@dingus9 dingus9 commented Sep 29, 2016

Proposing this for issue #44.

Basically I just execfile the path the user passes in on the command line or defines in the config file.

I believe this to be an acceptable solution. My editor reordered the imports... I can undo that if it's an issue, but I'm tired and want to sleep tonight ;)

Macro files can live anywhere, I put mine beside my presentation.md in macro.py for example

macro.py:

import re

from landslide.macro import Macro


class CalloutMacro(Macro):
    """Adds toggleable notes to slides"""

    def process(self, content, source=None):
        classes = []
        new_content = re.sub(r'<p>\.callout:\s?(.*?)</p>',
                             r'<p class="callout">\1</p>', content)

        if content != new_content:
            classes.append(u'has_callout')

        return new_content, classes

@adamzap
Copy link
Owner

adamzap commented Oct 2, 2016

Thanks for the pull request!

I like your approach here, but I'm in the middle of a full rewrite of Landslide. I'll be happy to integrate this idea (and a much better macro/plugin system) soon after I'm done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants