Permalink
Browse files

Import base project.

  • Loading branch information...
1 parent f552ada commit efc9408bcd84cc6156f824e89014f79221af1b2f @ryan-roemer committed Dec 7, 2011
View
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Ryan Roemer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -0,0 +1,69 @@
+========================
+ Sphinx Bootstrap Theme
+========================
+
+This repository integrates the Twitter Bootstrap_ CSS / JavaScript framework
+as a Sphinx_ theme_. A live demo_ is available to preview the theme.
+
+.. _Bootstrap: http://twitter.github.com/bootstrap/
+.. _Sphinx: http://sphinx.pocoo.org/
+.. _theme: http://sphinx.pocoo.org/theming.html
+.. _demo: http://ryan-roemer.github.com/sphinx-bootstrap-theme
+
+
+Installation
+============
+To install the theme, download the theme directory and update your
+configuration
+
+1. Create a "_themes" directory in your project source root, and then
+ download the "bootstrap" directory in this repository into it.
+2. Edit your configuration file to point to the bootstrap theme::
+
+ # Activate the theme.
+ sys.path.append(os.path.abspath('_themes'))
+ html_theme_path = ['_themes']
+ html_theme = 'bootstrap'
+
+ # Optional. Use a shorter name to conserve nav. bar space.
+ html_short_title = "Demo"
+
+
+Sphinx Notes
+============
+The theme places the global TOC, local TOC, navigation (prev, next) and
+source links all in the top Bootstrap navigation bar, along with the Sphinx
+search bar on the left side.
+
+The global (site-wide) table of contents is the "Site" navigation dropdown,
+which is a one-level deep rendering of the ``toctree`` for the entire site.
+The local (page-level) table of contents is the "Page" navigation dropdown,
+which is a one-level rendering of the current page's ``toc``. This obviously
+constrains a little bit of Sphinx's extensibility, but seems to be the most
+appropriate UX for the Bootstrap top navigation bar.
+
+Generally speaking, this is a quick and dirty hack to get the basic theme
+going, so there are likely some oversights and lurking issues. Help and
+bug filings for the project are most welcome.
+
+
+Bootstrap Notes
+===============
+The theme uses the following files from Twitter Bootstrap v1.4.0::
+
+ bootstrap-dropdown.js
+ bootstrap-scrollspy.js
+ bootstrap.css
+
+You can drop different versions in your Sphinx "_static" directory to
+override these files.
+
+
+Licenses
+========
+Sphinx Bootstrap Theme is licensed under the MIT_ license.
+
+Twitter Bootstrap is licensed under the Apache_ license.
+
+.. _MIT: https://github.com/ryan-roemer/sphinx-bootstrap-theme/blob/master/LICENSE.txt
+.. _Apache: https://github.com/twitter/bootstrap/blob/master/LICENSE
View
@@ -0,0 +1,7 @@
+{%- if display_toc %}
+ <li class="dropdown" data-dropdown="dropdown">
+ <a href="{{ pathto(master_doc) }}"
+ class="dropdown-toggle">{{ _('Site') }}</a>
+ <span class="globaltoc">{{ toctree(maxdepth=1) }}</span>
+ </li>
+{%- endif %}
View
@@ -0,0 +1,113 @@
+{% extends "basic/layout.html" %}
+{% set script_files = script_files + ['_static/bootstrap-dropdown.js', '_static/bootstrap-scrollspy.js'] %}
+{% set css_files = ['_static/bootstrap.css', '_static/bootstrap-sphinx.css'] + css_files %}
+
+{# Sidebar: Rework into our Boostrap nav section. #}
+{% macro navBar() %}
+ <div class="topbar" data-scrollspy="scrollspy" >
+ <div class="topbar-inner">
+ <div class="container">
+ {% block sidebarlogo %}
+ {% if logo %}
+ <p class="logo"><a href="{{ pathto(master_doc) }}">
+ <img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
+ </a></p>
+ {% endif %}
+ {% endblock %}
+
+ <a class="brand" href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>
+
+ <ul class="nav">
+ {% block sidebartoc %}
+ {% include "globaltoc.html" %}
+ {% include "localtoc.html" %}
+ {% endblock %}
+ {% block sidebarrel %}
+ {% include "relations.html" %}
+ {% endblock %}
+ {% block sidebarsourcelink %}
+ {% include "sourcelink.html" %}
+ {% endblock %}
+ </ul>
+ <ul class="nav secondary-nav">
+ {% block sidebarsearch %}
+ {% include "searchbox.html" %}
+ {% endblock %}
+ </ul>
+ </div>
+ </div>
+ </div>
+{% endmacro %}
+
+{%- block extrahead %}
+<script type="text/javascript">
+(function () {
+ /**
+ * Patch the local TOC list.
+ *
+ * Will mutate the underlying span to have a correct ul for nav.
+ *
+ * @param $refLinks: Array of A tags to include in new dropdown menu.
+ */
+ var patchLocalToc = function ($localSpan) {
+ var $tocList = $("<ul/>").attr('class', "dropdown-menu"),
+ $refLinks = $localSpan.find("> ul > li > ul > li > a.internal");
+
+ // Attach all internal links in order to the new list.
+ $refLinks.each(function (index, link) {
+ $tocList.append($("<li/>").append($(link)));
+ });
+
+ // Wipe out old list and patch in new one.
+ return $localSpan.empty("ul").append($tocList);
+ };
+
+ $(document).ready(function () {
+ // Patch the global and local TOC's to be bootstrap-compliant.
+ $("span.globaltoc ul").attr('class', "dropdown-menu");
+ patchLocalToc($("span.localtoc"));
+
+ // Activate.
+ $('#topbar').dropdown();
+ });
+}());
+</script>
+{% endblock %}
+
+{% block header %}{{ navBar() }}{% endblock %}
+
+{# Silence the sidebar's, relbar's #}
+{% block sidebar1 %}{% endblock %}
+{% block sidebar2 %}{% endblock %}
+{% block relbar1 %}{% endblock %}
+{% block relbar2 %}{% endblock %}
+
+{%- block content %}
+<div class="container">
+ {% block body %} {% endblock %}
+</div>
+{%- endblock %}
+
+{%- block footer %}
+<footer class="footer">
+ <div class="container">
+ <p class="pull-right"><a href="#">Back to top</a></p>
+ <p>
+ {%- if show_copyright %}
+ {%- if hasdoc('copyright') %}
+ {% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}<br/>
+ {%- else %}
+ {% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}<br/>
+ {%- endif %}
+ {%- endif %}
+ {%- if last_updated %}
+ {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}<br/>
+ {%- endif %}
+ {%- if show_sphinx %}
+ {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}<br/>
+ {%- endif %}
+ </p>
+ </div>
+</footer>
+{%- endblock %}
+
View
@@ -0,0 +1,7 @@
+{%- if display_toc %}
+ <li class="dropdown" data-dropdown="dropdown">
+ <a href="#"
+ class="dropdown-toggle">{{ _('Page') }}</a>
+ <span class="localtoc">{{ toc }}</span>
+ </li>
+{%- endif %}
View
@@ -0,0 +1,8 @@
+{%- if prev %}
+ <li><a href="{{ prev.link|e }}"
+ title="{{ _('previous chapter') }}">{{ "&laquo;"|safe }} {{ prev.title }}</a></li>
+{%- endif %}
+{%- if next %}
+ <li><a href="{{ next.link|e }}"
+ title="{{ _('next chapter') }}">{{ next.title }} {{ "&raquo;"|safe }}</a></li>
+{%- endif %}
View
@@ -0,0 +1,7 @@
+{%- if pagename != "search" %}
+<form class="pull-left" action="{{ pathto('search') }}" method="get">
+ <input type="text" name="q" placeholder="Search" />
+ <input type="hidden" name="check_keywords" value="yes" />
+ <input type="hidden" name="area" value="default" />
+</form>
+{%- endif %}
@@ -0,0 +1,4 @@
+{%- if show_source and has_source and sourcename %}
+ <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
+ rel="nofollow">{{ _('Source') }}</a></li>
+{%- endif %}
@@ -0,0 +1,55 @@
+/* ============================================================
+ * bootstrap-dropdown.js v1.4.0
+ * http://twitter.github.com/bootstrap/javascript.html#dropdown
+ * ============================================================
+ * Copyright 2011 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================================================ */
+
+
+!function( $ ){
+
+ "use strict"
+
+ /* DROPDOWN PLUGIN DEFINITION
+ * ========================== */
+
+ $.fn.dropdown = function ( selector ) {
+ return this.each(function () {
+ $(this).delegate(selector || d, 'click', function (e) {
+ var li = $(this).parent('li')
+ , isActive = li.hasClass('open')
+
+ clearMenus()
+ !isActive && li.toggleClass('open')
+ return false
+ })
+ })
+ }
+
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
+ * =================================== */
+
+ var d = 'a.menu, .dropdown-toggle'
+
+ function clearMenus() {
+ $(d).parent('li').removeClass('open')
+ }
+
+ $(function () {
+ $('html').bind("click", clearMenus)
+ $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
+ })
+
+}( window.jQuery || window.ender );
Oops, something went wrong.

0 comments on commit efc9408

Please sign in to comment.