예제 #1
0
    def preprocessor_criticmarkup(self, source, accept):
        """Stip out multi-markdown critic marks.  Accept changes by default."""
        from pymdownx.critic import CriticViewPreprocessor, CriticStash, CRITIC_KEY

        text = ''
        mode = 'accept' if accept else 'reject'
        critic_stash = CriticStash(CRITIC_KEY)
        critic = CriticViewPreprocessor(critic_stash)
        critic.config = {'mode': mode}
        text = '\n'.join(critic.run(source.split('\n')))

        return text
    def preprocessor_criticmarkup(self, source, accept):
        """Stip out multi-markdown critic marks.  Accept changes by default."""
        from pymdownx.critic import CriticViewPreprocessor, CriticStash, CRITIC_KEY

        text = ''
        mode = 'accept' if accept else 'reject'
        critic_stash = CriticStash(CRITIC_KEY)
        critic = CriticViewPreprocessor(critic_stash)
        critic.config = {'mode': mode}
        text = '\n'.join(critic.run(source.split('\n')))

        return text
예제 #3
0
    def preprocessor_critic(self, source):
        """
        Strip out multi-markdown critic marks.

        Accept changes by default.
        """
        from pymdownx.critic import CriticViewPreprocessor, CriticStash, CRITIC_KEY

        text = ''
        mode = 'accept' if self.settings.get(
            "strip_critic_marks", "accept") == "accept" else 'reject'
        critic_stash = CriticStash(CRITIC_KEY)
        critic = CriticViewPreprocessor(critic_stash)
        critic.config = {'mode': mode}
        text = '\n'.join(critic.run(source.split('\n')))

        return text
예제 #4
0
    def dump(self, source, accept, view=False):
        """Process critic marks and return the file."""

        text = ''
        if view:
            mode = 'view'
        elif accept:
            mode = 'accept'
        else:
            mode = 'reject'

        critic_stash = CriticStash(CRITIC_KEY)
        critic = CriticViewPreprocessor(critic_stash)
        critic.config = {'mode': mode}
        text = '\n'.join(critic.run(source.split('\n')))
        if view:
            critic_post = CriticsPostprocessor(critic_stash)
            text = critic_post.run(text)

        return text
예제 #5
0
    def dump(self, source, accept, view=False):
        """Process critic marks and return the file."""

        text = ''
        if view:
            mode = 'view'
        elif accept:
            mode = 'accept'
        else:
            mode = 'reject'

        critic_stash = CriticStash(CRITIC_KEY)
        critic = CriticViewPreprocessor(critic_stash)
        critic.config = {'mode': mode}
        text = '\n'.join(critic.run(source.split('\n')))
        if view:
            critic_post = CriticsPostprocessor(critic_stash)
            text = critic_post.run(text)

        return text