From 6355ec149704641ac9dab3aaa87af63e4a895d2c Mon Sep 17 00:00:00 2001 From: Anthony Johnson Date: Mon, 10 Jul 2017 21:06:01 -0700 Subject: [PATCH] Remove YAML unicode tags from Mkdocs config In the case of a unicode string without a unicode character, YAML adds a tag to ensure the text is read as unicode, ie: In [1]: import yaml In [2]: yaml.dump(u'surprise!') Out[2]: "!!python/unicode 'surprise!'\n" This forces only literals are output to the YAML config, by using `safe_dump` instead of `dump` --- readthedocs/doc_builder/backends/mkdocs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/doc_builder/backends/mkdocs.py b/readthedocs/doc_builder/backends/mkdocs.py index fb4471b2f0d..97fa45e59fd 100644 --- a/readthedocs/doc_builder/backends/mkdocs.py +++ b/readthedocs/doc_builder/backends/mkdocs.py @@ -100,7 +100,7 @@ def append_conf(self, **__): if 'theme_dir' not in user_config and self.use_theme: user_config['theme_dir'] = TEMPLATE_DIR - yaml.dump( + yaml.safe_dump( user_config, open(os.path.join(self.root_path, 'mkdocs.yml'), 'w') ) @@ -187,7 +187,7 @@ def build(self): ) if user_config['theme_dir'] == TEMPLATE_DIR: del user_config['theme_dir'] - yaml.dump( + yaml.safe_dump( user_config, open(os.path.join(self.root_path, 'mkdocs.yml'), 'w') )