Skip to content

Commit

Permalink
Bump minimum mdpo version required
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed May 5, 2021
1 parent 64c0835 commit 9f7f13a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions mkdocs_mdpo_plugin/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
class MkdocsMdpoTreeProcessor(Treeprocessor):
def run(self, root):
mdpo_plugin = MkdocsBuild().mdpo_plugin
current_build_extensions = (
mdpo_plugin.mkdocs_build_config['markdown_extensions']
)

current_page = mdpo_plugin.current_page
if not hasattr(current_page, '_language'):
return

current_build_extensions = (
mdpo_plugin.mkdocs_build_config['markdown_extensions']
)

def process_translation(node, msgid):
if msgid not in current_page._translated_entries_msgstrs:
if msgid in current_page._po_msgids:
Expand All @@ -30,7 +32,7 @@ def process_translation(node, msgid):

def node_should_be_processed(node):
if 'pymdownx.tasklist' in current_build_extensions and \
node.tag in ['li', 'p'] and len(node.text) > 2 and \
node.tag == 'li' and \
node.text[:3] in ['[ ]', '[x]', '[X]']:
return False
return True
Expand All @@ -57,13 +59,15 @@ def iterate_childs(_root):
class MkdocsMdpoTitlesTreeProcessor(Treeprocessor):
def run(self, root):
mdpo_plugin = MkdocsBuild().mdpo_plugin
current_build_extensions = (
mdpo_plugin.mkdocs_build_config['markdown_extensions']
)

current_page = mdpo_plugin.current_page
if not hasattr(current_page, '_language'):
return

current_build_extensions = (
mdpo_plugin.mkdocs_build_config['markdown_extensions']
)

def process_translation(node, msgid):
if msgid not in current_page._translated_entries_msgstrs:
if msgid in current_page._po_msgids:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers =
[options]
packages = mkdocs_mdpo_plugin
install_requires =
mdpo>=0.3.36
mdpo>=0.3.37
python_requires = >=3.6
include_package_data = True

Expand Down

0 comments on commit 9f7f13a

Please sign in to comment.