Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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