Browse Source

Sphinx: Set tags from RTD SPHINX_TAGS env variable

Up until now I mistakenly thought that ReadTheDocs' tags
were the same as Sphinx tags, and would be passed to the
build. It turns out that aren't, so our `.. only:: i18n`
logic did not work.

Instead, we now use RTD environment variables to pass
comma-separated tags to Sphinx.
Rémi Verschelde 6 years ago
parent
commit
2a957dfc7e
1 changed files with 8 additions and 0 deletions
  1. 8 0
      conf.py

+ 8 - 0
conf.py

@@ -32,11 +32,19 @@ version = 'latest'
 # The full version, including alpha/beta/rc tags
 release = 'latest'
 
+# Parse Sphinx tags passed from RTD via environment
+env_tags = os.getenv('SPHINX_TAGS', [])
+for tag in env_tags.split(','):
+   print("Adding Sphinx tag: %s" % tag.strip())
+   tags.add(tag.strip())
+
+# Language / i18n
 language = 'en'
 is_i18n = tags.has('i18n')
 
 exclude_patterns = ['_build']
 
+# GDScript syntax highlighting
 from gdscript import GDScriptLexer
 from sphinx.highlighting import lexers
 lexers['gdscript'] = GDScriptLexer()