Skip to content

Proposed/working macro option - #192

Open
dingus9 wants to merge 1 commit into
adamzap:masterfrom
dingus9:master
Open

Proposed/working macro option#192
dingus9 wants to merge 1 commit into
adamzap:masterfrom
dingus9:master

Conversation

@dingus9

@dingus9 dingus9 commented Sep 29, 2016

Copy link
Copy Markdown

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

adamzap commented Oct 2, 2016

Copy link
Copy Markdown
Owner

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