mondeja / mdpo

Markdown files translation using GNU PO files
https://mondeja.github.io/mdpo/
BSD 3-Clause "New" or "Revised" License
25 stars 6 forks source link

Allow MD4C event preprocessing for md2po #103

Closed mondeja closed 3 years ago

mondeja commented 3 years ago

For example, if we want to ignore pymdownx.tabbed titles from being extracted, we could do something like:

import re

from mdpo.md2po import Md2Po
from pymdownx.tabbed import TabbedProcessor

def custom_text(self, block, text):
    if re.match(TabbedProcessor.START, text):
        self.ignore_msgids.append(text)

md2po = Md2Po(..., events={'text': custom_text})
mondeja commented 3 years ago

Added in v0.3.35.