-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d172407
commit cf52ab8
Showing
9 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Page d'accueil (french version) | ||
|
||
!!! tip | ||
Titre implicite dérivé du type d'avertissement, peut être remplacé en définissant `admonition_translations` | ||
|
||
!!!tip | ||
Pareil sans espaces | ||
|
||
!!! warning | ||
Titre implicite dérivé du type d'avertissement, peut être remplacé en définissant `admonition_translations` | ||
|
||
!!! warning "Heey" | ||
Titre explicite, n'est pas traduit par `admonition_translations` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Home page | ||
|
||
!!! tip | ||
Implicit title derived from admonition type, can be overriden by setting `admonition_translations` | ||
|
||
!!!tip | ||
Same without space | ||
|
||
!!! warning | ||
Implicit title derived from admonition type, can be overriden by setting `admonition_translations` | ||
|
||
!!! warning "Heey" | ||
Explicit title, isn't translated by `admonition_translations` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import re | ||
from pathlib import Path | ||
|
||
from mkdocs.commands.build import build | ||
from mkdocs.config.base import load_config | ||
|
||
def test_plugin_no_use_directory_urls_default_language_only(): | ||
mkdocs_config = load_config( | ||
"tests/mkdocs.yml", | ||
theme={"name": "material"}, | ||
docs_dir="admonitions/", | ||
plugins={ | ||
"i18n": { | ||
"languages": [ | ||
{ | ||
"locale": "en", | ||
"name": "english", | ||
"default": True, | ||
}, | ||
{ | ||
"locale": "fr", | ||
"name": "français", | ||
"build": True, | ||
"admonition_translations": { | ||
"tip": "Conseil", | ||
"warning": "Avertissement", | ||
} | ||
}, | ||
], | ||
}, | ||
}, | ||
markdown_extensions=["admonition"], | ||
) | ||
build(mkdocs_config) | ||
site_dir = mkdocs_config["site_dir"] | ||
generate_site = [f.relative_to(site_dir) for f in Path(site_dir).glob("**/*.html")] | ||
|
||
with open(site_dir+'/index.html') as f: | ||
admonition_titles = re.findall(r"<p class=[\"']admonition-title[\"']>([^<]*)", f.read()) | ||
assert(admonition_titles == ['Tip', 'Tip', 'Warning', 'Heey']) | ||
|
||
with open(site_dir+'/fr/index.html') as f: | ||
admonition_titles = re.findall(r"<p class=[\"']admonition-title[\"']>([^<]*)", f.read()) | ||
assert(admonition_titles == ['Conseil', 'Conseil', 'Avertissement', 'Heey']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters