diff --git a/mkdocs.yaml b/mkdocs.yaml index b0939e74..5e43e483 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -10,4 +10,4 @@ pages: - ['topics/django-extra-views-compatibility.md', 'Topics / Django Extra Views Compatilibity'] - ['topics/release-notes.md', 'Topics / Release Notes'] -theme: 'spacelab' +theme: 'bootstrap' diff --git a/mkdocs/__init__.pyc b/mkdocs/__init__.pyc deleted file mode 100644 index 9c0c890c..00000000 Binary files a/mkdocs/__init__.pyc and /dev/null differ diff --git a/mkdocs/config.py b/mkdocs/config.py index 3cef967c..6e7cc61f 100644 --- a/mkdocs/config.py +++ b/mkdocs/config.py @@ -41,9 +41,4 @@ def load_config(filename='mkdocs.yaml', options=None): build_path = build_dir.replace(os.path.pathsep, '/') config['base_url'] = 'file://%s' % build_path - # Note that --serve may only be specified as a command line option, - # and not as a config file setting. - if options.get('serve'): - config['base_url'] = 'http://%s' % config['dev_addr'] - return config diff --git a/mkdocs/config.pyc b/mkdocs/config.pyc deleted file mode 100644 index 5bf1686d..00000000 Binary files a/mkdocs/config.pyc and /dev/null differ diff --git a/mkdocs/mkdocs b/mkdocs/mkdocs index 707368de..a3944d55 100755 --- a/mkdocs/mkdocs +++ b/mkdocs/mkdocs @@ -4,7 +4,6 @@ import mkdocs import shutil import sys -import tempfile def arg_to_option(arg): @@ -17,22 +16,21 @@ def arg_to_option(arg): return (arg, True) -def main(options=None): +def main(cmd, options=None): """ Build the documentation, and optionally start the devserver. """ - if 'serve' in options: - tempdir = tempfile.mkdtemp() - options['build_dir'] = tempdir - - config = mkdocs.load_config(options=options) - mkdocs.build(config) - - if 'serve' in options: + if cmd == 'serve': + config = mkdocs.load_config(options=options) mkdocs.serve(config, options=options) - shutil.rmtree(tempdir) + elif cmd == 'build': + config = mkdocs.load_config(options=options) + mkdocs.build(config) + else: + print 'mkdocs [build|serve] {options}' if __name__ == '__main__': - args = [arg_to_option(arg) for arg in sys.argv[1:] if arg.startswith('--')] - main(options=dict(args)) + cmd = sys.argv[1] if len(sys.argv) >= 2 else None + args = [arg_to_option(arg) for arg in sys.argv[2:] if arg.startswith('--')] + main(cmd, options=dict(args)) diff --git a/mkdocs/serve.py b/mkdocs/serve.py index 2c7adfcb..d8443d52 100644 --- a/mkdocs/serve.py +++ b/mkdocs/serve.py @@ -6,6 +6,8 @@ import os import posixpath import SimpleHTTPServer import SocketServer +import sys +import tempfile import urllib @@ -56,11 +58,25 @@ class FixedDirectoryHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): path = os.path.join(path, word) return path + def log_message(self, format, *args): + sys.stderr.write("[%s] %s\n" % + (self.log_date_time_string(), + format%args)) + def serve(config, options=None): """ Start the devserver, and rebuild the docs whenever any changes take effect. """ + # Create a temporary build directory, and set some options to serve it + tempdir = tempfile.mkdtemp() + options['build_dir'] = tempdir + options['base_url'] = 'http://%s' % config['dev_addr'] + + # Perform the initial build + config = mkdocs.load_config(options=options) + mkdocs.build(config) + # Note: We pass any command-line options through so that we # can re-apply them if the config file is reloaded. event_handler = BuildEventHandler(options) @@ -82,5 +98,8 @@ def serve(config, options=None): print "Running at: http://%s:%s/" % (host, port) server.serve_forever() + + # Clean up observer.stop() observer.join() + shutil.rmtree(tempdir) diff --git a/mkdocs/serve.pyc b/mkdocs/serve.pyc deleted file mode 100644 index bd068a21..00000000 Binary files a/mkdocs/serve.pyc and /dev/null differ diff --git a/mkdocs/themes/bootstrap/css/base.css b/mkdocs/themes/bootstrap/css/base.css index 6ce6e78b..1ff2bbd6 100644 --- a/mkdocs/themes/bootstrap/css/base.css +++ b/mkdocs/themes/bootstrap/css/base.css @@ -14,49 +14,6 @@ div.source-links { float: right; } -div.navbar a.navbar-brand, -div.navbar a.navbar-brand:hover, -div.navbar a.navbar-brand:focus { - color: #fff; -} - -/* - * Main navigation - * - * Turn the `.navbar` at the top of the docs purple. - */ - -.navbar { - text-shadow: 0 -1px 0 rgba(0,0,0,.15); - background-color: #563d7c; - border-color: #463265; - box-shadow: 0 1px 0 rgba(255,255,255,.1); -} -.navbar .navbar-collapse { - border-color: #463265; -} -.navbar .navbar-brand { - color: #fff; -} -.navbar .navbar-nav > li > a { - color: #cdbfe3; -} -.navbar .navbar-nav > li > a:hover { - color: #fff; -} -.navbar .navbar-nav > .active > a, -.navbar .navbar-nav > .active > a:hover { - color: #fff; - background-color: #463265; -} -.navbar .navbar-toggle { - border-color: #563d7c; -} -.navbar .navbar-toggle:hover { - background-color: #463265; - border-color: #463265; -} - /* * Side navigation * @@ -69,36 +26,35 @@ div.navbar a.navbar-brand:focus { position: static; } +.bs-sidebar.well { + padding: 0; +} + /* First level of nav */ .bs-sidenav { margin-top: 30px; margin-bottom: 30px; padding-top: 10px; padding-bottom: 10px; - text-shadow: 0 1px 0 #fff; - background-color: #f7f5fa; border-radius: 5px; } /* All levels of nav */ .bs-sidebar .nav > li > a { display: block; - color: #716b7a; padding: 5px 20px; } .bs-sidebar .nav > li > a:hover, .bs-sidebar .nav > li > a:focus { text-decoration: none; - background-color: #e5e3e9; - border-right: 1px solid #dbd8e0; + border-right: 1px solid; } .bs-sidebar .nav > .active > a, .bs-sidebar .nav > .active:hover > a, .bs-sidebar .nav > .active:focus > a { font-weight: bold; - color: #563d7c; background-color: transparent; - border-right: 1px solid #563d7c; + border-right: 1px solid; } /* Nav: second level (shown on .active) */ diff --git a/mkdocs/themes/bootstrap/toc.html b/mkdocs/themes/bootstrap/toc.html index a9e7ff5b..bb8fdcd7 100644 --- a/mkdocs/themes/bootstrap/toc.html +++ b/mkdocs/themes/bootstrap/toc.html @@ -1,4 +1,4 @@ -