Repository: mkdocs/mkdocs

Issue:
Version to 0.17.0
See discussion in #1166.


Discussion:

Resolving patch:
diff --git a/mkdocs/contrib/legacy_search/__init__.py b/mkdocs/contrib/legacy_search/__init__.py
--- a/mkdocs/contrib/legacy_search/__init__.py
+++ b/mkdocs/contrib/legacy_search/__init__.py
@@ -17,11 +17,13 @@ class SearchPlugin(BasePlugin):
 
     def on_config(self, config, **kwargs):
         "Add plugin templates and scripts to config."
-        path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
-        config['theme'].dirs.append(path)
-        config['theme'].static_templates.add('search.html')
-        config['extra_javascript'].append('search/require.js')
-        config['extra_javascript'].append('search/search.js')
+        if 'include_search_page' in config['theme'] and config['theme']['include_search_page']:
+            config['theme'].static_templates.add('search.html')
+        if not ('search_index_only' in config['theme'] and config['theme']['search_index_only']):
+            path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
+            config['theme'].dirs.append(path)
+            config['extra_javascript'].append('search/require.js')
+            config['extra_javascript'].append('search/search.js')
         return config
 
     def on_pre_build(self, config, **kwargs):


Test patch:
diff --git a/mkdocs/tests/config/config_tests.py b/mkdocs/tests/config/config_tests.py
--- a/mkdocs/tests/config/config_tests.py
+++ b/mkdocs/tests/config/config_tests.py
@@ -124,11 +124,11 @@ def test_theme(self):
             {
                 'dirs': [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir],
                 'static_templates': ['404.html', 'sitemap.xml'],
-                'vars': {}
+                'vars': {'include_search_page': False, 'search_index_only': False}
             }, {
                 'dirs': [os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir],
                 'static_templates': ['404.html', 'sitemap.xml'],
-                'vars': {}
+                'vars': {'include_search_page': True, 'search_index_only': False}
             }, {
                 'dirs': [mytheme, mkdocs_templates_dir],
                 'static_templates': ['sitemap.xml'],
@@ -136,11 +136,11 @@ def test_theme(self):
             }, {
                 'dirs': [custom, os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir],
                 'static_templates': ['404.html', 'sitemap.xml'],
-                'vars': {}
+                'vars': {'include_search_page': True, 'search_index_only': False}
             }, {
                 'dirs': [os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir],
                 'static_templates': ['404.html', 'sitemap.xml'],
-                'vars': {}
+                'vars': {'include_search_page': True, 'search_index_only': False}
             }, {
                 'dirs': [mytheme, mkdocs_templates_dir],
                 'static_templates': ['sitemap.xml'],
@@ -148,11 +148,16 @@ def test_theme(self):
             }, {
                 'dirs': [custom, os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir],
                 'static_templates': ['404.html', 'sitemap.xml'],
-                'vars': {}
+                'vars': {'include_search_page': True, 'search_index_only': False}
             }, {
                 'dirs': [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir],
                 'static_templates': ['404.html', 'sitemap.xml', 'foo.html'],
-                'vars': {'show_sidebar': False, 'some_var': 'bar'}
+                'vars': {
+                    'show_sidebar': False,
+                    'some_var': 'bar',
+                    'include_search_page': False,
+                    'search_index_only': False
+                }
             }
         )
 
diff --git a/mkdocs/tests/theme_tests.py b/mkdocs/tests/theme_tests.py
--- a/mkdocs/tests/theme_tests.py
+++ b/mkdocs/tests/theme_tests.py
@@ -28,7 +28,7 @@ def test_simple_theme(self):
             [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir]
         )
         self.assertEqual(theme.static_templates, set(['404.html', 'sitemap.xml']))
-        self.assertEqual(get_vars(theme), {})
+        self.assertEqual(get_vars(theme), {'include_search_page': False, 'search_index_only': False})
 
     def test_custom_dir(self):
         custom = tempfile.mkdtemp()