0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-17 09:52:29 +01:00

add templates for doc generation

This commit is contained in:
Jacob Thornton 2012-01-23 14:14:16 -08:00
parent 1209a3756c
commit f764aee4b9
85 changed files with 15151 additions and 1567 deletions

View File

@ -6,6 +6,10 @@ LESS_COMPESSOR ?= `which lessc`
UGLIFY_JS ?= `which uglifyjs`
WATCHR ?= `which watchr`
#
# Build less files
#
build:
@@if test ! -z ${LESS_COMPESSOR}; then \
sed -e 's/@VERSION/'"v${VERSION}"'/' -e 's/@DATE/'"`date`"'/' <${BOOTSTRAP_LESS} >${BOOTSTRAP_LESS}.tmp; \
@ -18,24 +22,9 @@ build:
echo "You can install it by running: npm install less -g"; \
fi
uglify:
@@if test ! -z ${UGLIFY_JS}; then \
mkdir -p js/min; \
uglifyjs -o js/min/bootstrap-alerts.js js/bootstrap-alert.js;\
uglifyjs -o js/min/bootstrap-buttons.js js/bootstrap-button.js;\
uglifyjs -o js/min/bootstrap-carousel.js js/bootstrap-carousel.js;\
uglifyjs -o js/min/bootstrap-collapse.js js/bootstrap-collapse.js;\
uglifyjs -o js/min/bootstrap-dropdown.js js/bootstrap-dropdown.js;\
uglifyjs -o js/min/bootstrap-modal.js js/bootstrap-modal.js;\
uglifyjs -o js/min/bootstrap-popover.js js/bootstrap-popover.js;\
uglifyjs -o js/min/bootstrap-scrollspy.js js/bootstrap-scrollspy.js;\
uglifyjs -o js/min/bootstrap-tabs.js js/bootstrap-tab.js;\
uglifyjs -o js/min/bootstrap-transitions.js js/bootstrap-transition.js;\
uglifyjs -o js/min/bootstrap-tooltip.js js/bootstrap-tooltip.js;\
else \
echo "You must have the UGLIFYJS minifier installed in order to minify Bootstrap's js."; \
echo "You can install it by running: npm install uglify-js -g"; \
fi
#
# Watch less files
#
watch:
@@if test ! -z ${WATCHR}; then \
@ -46,4 +35,12 @@ watch:
echo "You can install it by running: gem install watchr"; \
fi
.PHONY: build watch
#
# Build docs from templates
#
docs:
@ node docs/build
.PHONY: build watch docs

2
bootstrap.css vendored
View File

@ -6,7 +6,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
* Date: Sun Jan 22 20:50:28 PST 2012
* Date: Mon Jan 23 14:12:25 PST 2012
*/
html, body {
margin: 0;

View File

@ -117,37 +117,66 @@ $(function(){
})
// JS for javascript demos
$(function () {
// tooltip demo
$('.tooltip-demo.well').tooltip({
selector: "a[rel=tooltip]"
})
$('.tooltip-test').tooltip()
// popover demo
$("a[rel=popover]")
.popover()
.click(function(e) {
e.preventDefault()
})
// button state demo
$('#fat-btn')
.click(function () {
var btn = $(this)
btn.button('loading')
setTimeout(function () {
btn.button('reset')
}, 3000)
})
// carousel demo
$('#myCarousel').carousel()
})
// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
// by the talented Ben Vinegar
!function($) {
$.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
var url = opts.url;
$.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
var url = opts.url;
return {
send: function(_, completeCallback) {
var name = 'jQuery_iframe_' + jQuery.now(),
iframe, form;
return {
send: function(_, completeCallback) {
var name = 'jQuery_iframe_' + jQuery.now()
, iframe, form
iframe = $('<iframe>')
.attr('name', name)
.appendTo('head');
iframe = $('<iframe>')
.attr('name', name)
.appendTo('head')
form = $('<form>')
.attr('method', opts.type) // GET or POST
.attr('action', url)
.attr('target', name);
form = $('<form>')
.attr('method', opts.type) // GET or POST
.attr('action', url)
.attr('target', name)
$.each(opts.params, function(k, v) {
$('<input>')
.attr('type', 'hidden')
.attr('name', k)
.attr('value', v)
.appendTo(form);
});
$.each(opts.params, function(k, v) {
$('<input>')
.attr('type', 'hidden')
.attr('name', k)
.attr('value', v)
.appendTo(form)
});
form.appendTo('body').submit();
}
};
});
form.appendTo('body').submit()
}
}
})
}(jQuery);

View File

@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@ -18,10 +18,11 @@
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" type="image/x-icon" href="assets/ico/favicon.ico">
<link rel="apple-touch-icon" href="assets/ico/bootstrap-apple-57x57.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/ico/bootstrap-apple-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/ico/bootstrap-apple-114x114.png">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
<body>
@ -33,8 +34,8 @@
<div class="container">
<a class="brand" href="./index.html">Bootstrap</a>
<ul class="nav">
<li><a href="./index.html">Overview</a></li>
<li class="dropdown">
<li class=""><a href="./index.html">Overview</a></li>
<li class="dropdown ">
<a href="./scaffolding.html" class="dropdown-toggle" data-toggle="dropdown">
Scaffolding
<b class="caret"></b>
@ -58,7 +59,7 @@
<li><a href="./base-css.html#icons">Icons by Glyphicons</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./components.html" class="dropdown-toggle" data-toggle="dropdown">
Components
<b class="caret"></b>
@ -75,7 +76,7 @@
<li><a href="./components.html#progress">Progress bars</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./javascript.html" class="dropdown-toggle" data-toggle="dropdown">
Javascript plugins
<b class="caret"></b>
@ -95,7 +96,7 @@
<li><a href="./javascript.html#typeahead">Typeahead</a></li>
</ul>
</li>
<li>
<li class="">
<a href="./less.html">
Using LESS
</a>
@ -107,12 +108,12 @@
<div class="container">
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Base CSS</h1>
<p class="lead">On top of the scaffolding, basic HTML elements are styled and enhanced with extensible classes to provide a fresh, consistent look and feel.</p>
</header>
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Base CSS</h1>
<p class="lead">On top of the scaffolding, basic HTML elements are styled and enhanced with extensible classes to provide a fresh, consistent look and feel.</p>
</header>
<!-- Typography
@ -1534,9 +1535,6 @@
</div>
</div>
</section>
<!-- Footer
================================================== -->
<footer class="footer">
@ -1545,20 +1543,27 @@
<p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</footer>
</div><!-- /container -->
<!-- Le javascript -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script src="assets/js/jquery.tablesorter.js"></script>
<!-- <script src="http://code.jquery.com/jquery-1.7.min.js"></script> -->
<script src="../js/tests/vendor/jquery.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="assets/js/application.js"></script>
<script src="../js/bootstrap-transition.js"></script>
<script src="../js/bootstrap-alert.js"></script>
<script src="../js/bootstrap-modal.js"></script>
<script src="../js/bootstrap-dropdown.js"></script>
<script>
$(function () {
$(".tablesorter-example").tablesorter({ sortList: [[1,0]] });
$('.dropdown-toggle').dropdown();
})
</script>
<script src="../js/bootstrap-scrollspy.js"></script>
<script src="../js/bootstrap-tab.js"></script>
<script src="../js/bootstrap-tooltip.js"></script>
<script src="../js/bootstrap-popover.js"></script>
<script src="../js/bootstrap-button.js"></script>
<script src="../js/bootstrap-collapse.js"></script>
<script src="../js/bootstrap-carousel.js"></script>
<script src="../js/bootstrap-typeahead.js"></script>
<script src="assets/js/application.js"></script>
</body>
</html>

27
docs/build/index.js vendored Normal file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env node
var hogan = require('hogan.js')
, fs = require('fs')
var layout, pages
// compile layout template
layout = fs.readFileSync(__dirname + '/../templates/layout.mustache', 'utf-8')
layout = hogan.compile(layout)
// retrieve pages
pages = fs.readdirSync(__dirname + '/../templates/pages')
// iterate over pages
pages.forEach(function (name) {
var page = fs.readFileSync(__dirname + '/../templates/pages/' + name, 'utf-8')
, context = {}
context[name.replace(/\.mustache$/, '')] = 'active'
page = hogan.compile(page)
page = layout.render(context, {
body: page
})
fs.writeFileSync(__dirname + '/../' + name.replace(/mustache$/, 'html'), page, 'utf-8')
})

1
docs/build/node_modules/.bin/hulk generated vendored Symbolic link
View File

@ -0,0 +1 @@
../hogan.js/bin/hulk

1
docs/build/node_modules/hogan.js/.git_ignore generated vendored Normal file
View File

@ -0,0 +1 @@
node_modules

3
docs/build/node_modules/hogan.js/.gitmodules generated vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "test/spec"]
path = test/spec
url = https://github.com/mustache/spec.git

177
docs/build/node_modules/hogan.js/LICENSE generated vendored Normal file
View File

@ -0,0 +1,177 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

62
docs/build/node_modules/hogan.js/Makefile generated vendored Normal file
View File

@ -0,0 +1,62 @@
REPO = git@github.com:twitter/hogan.js.git
BUILD := build
VERSION = ${shell node -e 'var s = JSON.parse(require("fs").readFileSync("package.json").toString()).version; console.log(s.substring(0, s.indexOf("-")));'}
#
# Run command line tests
#
test:
@ node test/index.js
#
# Run Mustache spec tests
#
spec:
@ node test/spec.js
#
# Run benchmark
#
benchmark:
@ node benchmark/console/index.js
clean:
@ rm -rf dist/*
#
# Make a new version of Hogan from the current dev version.
#
release: clean
@ echo "Creating a new version of Hogan."
@ mkdir -p dist/nodejs
@ cp -R lib dist/nodejs/lib
@ node tools/release.js
@ mkdir -p web/builds/$(VERSION)
@ cp dist/*.* web/builds/$(VERSION)/.
#
# Make the gh-pages website
#
# This target builds the hogan.js github website using hogan.js.
#
# cd into build/gh-pages to check in the new site.
#
GH_PAGES = $(BUILD)/gh-pages
web: | pages
@cp -R web/* $(GH_PAGES)
@@ node tools/web_templates.js
@echo
@echo "Website built in $(GH_PAGES)."
#
# Checkout the gh-pages branch.
#
pages: | $(BUILD)
@if [ ! -d "$(GH_PAGES)" ]; then \
git clone -b gh-pages $(REPO) $(GH_PAGES); \
rm -rf $(GH_PAGES)/*; \
fi;
@mkdir -p $(GH_PAGES)/images
$(BUILD):
mkdir -p $(BUILD)
.PHONY: test spec benchmark web release

93
docs/build/node_modules/hogan.js/README.md generated vendored Normal file
View File

@ -0,0 +1,93 @@
## Hogan.js - A mustache compiler.
[Hogan.js](http://twitter.github.com/hogan.js/) is a compiler for the
[Mustache](http://mustache.github.com/) templating language. For information
on Mustache, see the [manpage](http://mustache.github.com/mustache.5.html) and
the [spec](https://github.com/mustache/spec).
## Basics
Hogan compiles templates to HoganTemplate objects, which have a render method.
```js
var data = {
screenName: "dhg",
};
var template = Hogan.compile("Follow @{{screenName}}.");
var output = template.render(data);
// prints "Follow @dhg."
console.log(output);
```
## Features
Hogan is fast--try it on your workload.
Hogan has separate scanning, parsing and code generation phases. This way it's
possible to add new features without touching the scanner at all, and many
different code generation techniques can be tried without changing the parser.
Hogan exposes scan and parse methods. These can be useful for
pre-processing templates on the server.
```js
var text = "{{^check}}{{i18n}}No{{/i18n}}{{/check}}";
text += "{{#check}}{{i18n}}Yes{{/i18n}}{{/check}}";
var tree = Hogan.parse(Hogan.scan(text));
// outputs "# check"
console.log(tree[0].tag + " " + tree[0].name);
// outputs "Yes"
console.log(tree[1].nodes[0].nodes[0]);
```
It's also possible to use HoganTemplate objects without the Hogan compiler
present. That means you can pre-compile your templates on the server, and
avoid shipping the compiler. However, the optional lambda features from the
Mustache spec do require the compiler to be present.
## Why Hogan.js?
Why another templating library?
Hogan.js was written to meet three templating library requirements: good
performance, standalone template objects, and a parser API.
## Issues
Have a bug? Please create an issue here on GitHub!
https://github.com/twitter/hogan.js/issues
## Versioning
For transparency and insight into our release cycle, releases will be numbered with the follow format:
`<major>.<minor>.<patch>`
And constructed with the following guidelines:
* Breaking backwards compatibility bumps the major
* New additions without breaking backwards compatibility bumps the minor
* Bug fixes and misc changes bump the patch
For more information on semantic versioning, please visit http://semver.org/.
## Authors
**Robert Sayre**
+ http://github.com/sayrer
**Jacob Thornton**
+ http://github.com/fat
## License
Copyright 2011 Twitter, Inc.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

93
docs/build/node_modules/hogan.js/bin/hulk generated vendored Executable file
View File

@ -0,0 +1,93 @@
#!/usr/bin/env node
/*
* 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.
*/
var hogan = require('../lib/hogan.js'),
path = require('path'),
fs = require('fs');
var specials = ['/', '.', '*', '+', '?', '|','(', ')', '[', ']', '{', '}', '\\'],
specialsRegExp = new RegExp('(\\' + specials.join('|\\') + ')', 'g'),
templates;
// Escape special regexp characters
function esc(text) {
return text.replace(specialsRegExp, '\\$1');
}
// Check for dirs and correct ext (<3 for windows)
function extractFiles(args) {
var usage = 'USAGE: hulk ./templates/*.mustaches\n' +
'NOTE: hulk supports the "*" wildcard and allows you to target specific extensions too',
files = [];
if (!args.length) {
console.log(usage);
process.exit(-1);
}
args.forEach(function (arg) {
if (/\*/.test(arg)) {
arg = arg.split('*');
return files = files.concat(
fs.readdirSync(arg[0] || '.')
.map(function (f) {
return new RegExp(esc(arg[1]) + '$').test(f) && path.join(arg[0], f);
})
.filter(function (f) {
return f;
})
);
}
files.push(arg);
})
return files;
}
// Remove utf-8 byte order mark, http://en.wikipedia.org/wiki/Byte_order_mark
function removeByteOrderMark(text) {
if (text.charCodeAt(0) === 0xfeff) {
return text.substring(1);
}
return text;
}
// Write a template foreach file that matches template extension
templates = extractFiles(process.argv.slice(2))
.map(function (file) {
var openedFile = fs.readFileSync(file, 'utf-8'), name;
if (!openedFile) return;
name = file.replace(/\..*$/, '');
openedFile = removeByteOrderMark(openedFile.trim());
return 'templates.' + name + ' = new Hogan.Template(' + hogan.compile(openedFile, { asString: 1 }) + ');';
})
.filter(function (t) {
return t;
});
// Output templates
if (!templates.length) return;
console.log('var templates = {};');
console.log(templates.join('\n'));

348
docs/build/node_modules/hogan.js/lib/compiler.js generated vendored Normal file
View File

@ -0,0 +1,348 @@
/*
* 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 (Hogan) {
// Setup regex assignments
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/,
rQuot = /\"/g,
rNewline = /\n/g,
rCr = /\r/g,
rSlash = /\\/g,
tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
Hogan.scan = function scan(text, delimiters) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
tag = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart, next; j < tokens.length; j++) {
if (!tokens[j].tag) {
if ((next = tokens[j+1]) && next.tag == '>') {
// set indent to token value
next.indent = tokens[j].toString()
}
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'});
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag,
closeIndex = text.indexOf(close, index),
delimiters = trim(
text.substring(text.indexOf('=', index) + 1, closeIndex)
).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
if (delimiters) {
delimiters = delimiters.split(' ');
otag = delimiters[0];
ctag = delimiters[1];
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text.charAt(i) == '\n') {
filterLine(seenTag);
} else {
buf += text.charAt(i);
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
tag = tagTypes[text.charAt(i + 1)];
tagType = tag ? text.charAt(i + 1) : '_v';
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
seenTag = i;
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
if (tagType == '{') {
if (ctag == '}}') {
i++;
} else {
cleanTripleStache(tokens[tokens.length - 1]);
}
}
} else {
buf += text.charAt(i);
}
}
}
filterLine(seenTag, true);
return tokens;
}
function cleanTripleStache(token) {
if (token.n.substr(token.n.length - 1) === '}') {
token.n = token.n.substring(0, token.n.length - 1);
}
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
function tagChange(tag, text, index) {
if (text.charAt(index) != tag.charAt(0)) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text.charAt(index + i) != tag.charAt(i)) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length === 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function writeCode(tree) {
return 'i = i || "";var b = i + "";var _ = this;' + walk(tree) + 'return b;';
}
Hogan.generate = function (code, text, options) {
if (options.asString) {
return 'function(c,p,i){' + code + ';}';
}
return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan);
}
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r');
}
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i]);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text('"' + esc(tree[i]) + '"');
}
}
return code;
}
function section(nodes, id, method, start, end, tags) {
return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
'c,p,0,' + start + ',' + end + ', "' + tags + '")){' +
'b += _.rs(c,p,' +
'function(c,p){ var b = "";' +
walk(nodes) +
'return b;});c.pop();}' +
'else{b += _.b; _.b = ""};';
}
function invertedSection(nodes, id, method) {
return 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
walk(nodes) +
'};';
}
function partial(tok) {
return 'b += _.rp("' + esc(tok.n) + '",c,p,"' + (tok.indent || '') + '");';
}
function tripleStache(id, method) {
return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
}
function variable(id, method) {
return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return 'b += ' + id + ';';
}
Hogan.parse = function(tokens, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
Hogan.cache = {};
Hogan.compile = function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options = options || {};
var key = text + '||' + !!options.asString;
var t = this.cache[key];
if (t) {
return t;
}
t = this.generate(writeCode(this.parse(this.scan(text, options.delimiters), options)), text, options);
return this.cache[key] = t;
};
})(typeof exports !== 'undefined' ? exports : Hogan);

20
docs/build/node_modules/hogan.js/lib/hogan.js generated vendored Normal file
View File

@ -0,0 +1,20 @@
/*
* 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.
*/
// This file is for use with Node.js. See dist/ for browser files.
var Hogan = require('./compiler');
Hogan.Template = require('./template').Template;
module.exports = Hogan;

233
docs/build/node_modules/hogan.js/lib/template.js generated vendored Normal file
View File

@ -0,0 +1,233 @@
/*
* 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.
*/
var Hogan = {};
(function (Hogan) {
Hogan.Template = function constructor(renderFunc, text, compiler) {
if (renderFunc) {
this.r = renderFunc;
}
this.c = compiler;
this.text = text || '';
}
Hogan.Template.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials, indent) {
return this.ri([context], partials || {}, indent);
},
// render internal -- a hook for overrides that catches partials too
ri: function (context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
if (this.c && typeof partial == 'string') {
partial = this.c.compile(partial);
}
return partial.ri(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var buf = '',
tail = context[context.length - 1];
if (!isArray(tail)) {
return buf = section(context, partials);
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (typeof val == 'function') {
val = this.ls(val, ctx, partials, inverted, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var compiler = this.c;
var t = val.call(cx, text, function(t) {
return compiler.compile(t, {delimiters: tags}).render(cx, partials);
});
var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, inverted, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = null;
if (!inverted && this.c && val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
t = val.call(cx);
if (typeof t == 'function') {
if (inverted) {
return true;
} else if (this.c) {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
var result = val.call(cx);
if (typeof result == 'function') {
result = result.call(cx);
}
result = result.toString();
if (this.c && ~result.indexOf("{{")) {
return this.c.compile(result).render(cx, partials);
}
return result;
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function hoganEscape(str) {
str = String((str === null || str === undefined) ? '' : str);
return hChars.test(str) ?
str
.replace(rAmp,'&amp;')
.replace(rLt,'&lt;')
.replace(rGt,'&gt;')
.replace(rApos,'&#39;')
.replace(rQuot, '&quot;') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
})(typeof exports !== 'undefined' ? exports : Hogan);

20
docs/build/node_modules/hogan.js/package.json generated vendored Normal file
View File

@ -0,0 +1,20 @@
{
"name": "hogan.js"
, "description": "A mustache compiler."
, "version": "1.0.5-dev"
, "keywords": ["mustache", "template"]
, "main": "./lib/hogan.js"
, "homepage": "http://twitter.github.com/hogan.js/"
, "author": "Twitter Inc."
, "repository": {
"type": "git"
, "url": "https://github.com/twitter/hogan.js.git"
}
, "licenses": [
{ "type": "Apache-2.0"
, "url": "http://www.apache.org/licenses/LICENSE-2.0"
}
]
, "devDependencies": { "uglify-js": "*" }
, "bin" : { "hulk" : "./bin/hulk" }
}

8
docs/build/node_modules/hogan.js/test/html/list.html generated vendored Normal file
View File

@ -0,0 +1,8 @@
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>

13
docs/build/node_modules/hogan.js/test/index.html generated vendored Normal file
View File

@ -0,0 +1,13 @@
<html>
<head>
<title>test</title>
<script src="https://raw.github.com/douglascrockford/JSON-js/master/json2.js"></script>
</head>
<body>
<code id="console"></code>
<script>var Hogan = {};</script>
<script src="../lib/template.js"></script>
<script src="../lib/compiler.js"></script>
<script src="./index.js"></script>
</body>
</html>

848
docs/build/node_modules/hogan.js/test/index.js generated vendored Normal file
View File

@ -0,0 +1,848 @@
/*
* 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.
*/
var Hogan = Hogan || require('../lib/hogan')
, doc = this["document"]
function testScanTextNoTags() {
var text = "<h2>hi</h2>";
var tokens = Hogan.scan(text);
is(tokens.length, 1, "One token");
is(tokens[0]+'', text, "text is equal to first token");
}
function testScanOneTag() {
var text = "{{hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 1, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
}
function testScanMultipleTags() {
var text = "asdf{{hmm}}asdf2{{hmm2}}asdf3";
var tokens = Hogan.scan(text);
is(tokens.length, 5, "3 text tokens, 2 tag tokens.");
is(tokens[0]+'', "asdf", "first token is text");
is(tokens[1].n, "hmm", "second token is tag");
is(tokens[1].tag, "_v", "second token is a variable");
is(tokens[2]+'', "asdf2", "third token is text");
is(tokens[3].n, "hmm2", "fourth token is tag");
is(tokens[3].tag, "_v", "fourth token is a variable");
is(tokens[4]+'', "asdf3", "Fifth token is text");
}
function testScanSectionOpen() {
var text = "{{#hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 1, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
is(tokens[0].tag, "#", "First token is a section.");
}
function testScanSectionClose() {
var text = "{{/hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 1, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
is(tokens[0].tag, "/", "First token is a section.");
}
function testScanSection() {
var text = "{{#hmm}}{{/hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 2, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
is(tokens[0].tag, "#", "First token is a section.");
is(tokens[1].n, "hmm", "Second token content is variable name.");
is(tokens[1].tag, "/", "Second token is a section.");
}
function testScanSectionInContent() {
var text = "abc{{#hmm}}def{{/hmm}}ghi";
var tokens = Hogan.scan(text);
is(tokens.length, 5, "3 text tokens, 2 tag tokens.");
is(tokens[0]+'', "abc", "first token is text");
is(tokens[1].n, "hmm", "second token is tag");
is(tokens[1].tag, "#", "second token is a variable");
is(tokens[2]+'', "def", "third token is text");
is(tokens[3].n, "hmm", "fourth token is tag");
is(tokens[3].tag, "/", "fourth token is a variable");
is(tokens[4]+'', "ghi", "Fifth token is text");
}
function testScanNegativeSection() {
var text = "{{^hmm}}{{/hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 2, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
is(tokens[0].tag, "^", "First token is a negative section.");
is(tokens[1].n, "hmm", "First token content is variable name.");
is(tokens[1].tag, "/", "Second token is a section.");
}
function testScanPartial() {
var text = "{{>hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 1, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
is(tokens[0].tag, ">", "First token is a partial.");
}
function testScanBackwardPartial() {
var text = "{{<hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 1, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
is(tokens[0].tag, "<", "First token is a backward partial.");
}
function testScanAmpersandNoEscapeTag() {
var text = "{{&hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 1, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
is(tokens[0].tag, "&", "First token is an ampersand no-escape.");
}
function testScanTripleStache() {
var text = "{{{hmm}}}";
var tokens = Hogan.scan(text);
is(tokens.length, 1, "One token");
is(tokens[0].n, "hmm", "First token content is variable name.");
is(tokens[0].tag, "{", "First token is a triple-stache.");
}
function testScanSectionWithTripleStacheInside() {
var text = "a{{#yo}}b{{{hmm}}}c{{/yo}}d";
var tokens = Hogan.scan(text);
is(tokens.length, 7, "One token");
is(tokens[0]+'', "a", "First token content is correct text.");
is(tokens[1].n, "yo", "Second token content is correct text.");
is(tokens[1].tag, "#", "Second token is a section.");
is(tokens[2]+'', "b", "Third token content is correct text.");
is(tokens[3].n, "hmm", "Fourth token content is correct text.");
is(tokens[3].tag, "{", "Fourth token is a triple stache.");
is(tokens[4]+'', "c", "Fifth token content is correct text.");
is(tokens[5].n, "yo", "Sixth token content is correct text.");
is(tokens[5].tag, "/", "Sixth token is a close.");
is(tokens[6]+'', "d", "Seventh token content is correct text.");
}
function testScanSetDelimiter() {
var text = "a{{=<% %>=}}b";
var tokens = Hogan.scan(text);
is(tokens.length, 2, "change delimiter doesn't appear as token.");
is(tokens[0]+'', "a", "text before change delimiter is processed.");
is(tokens[1]+'', "b", "text after change delimiter is processed.");
}
function testScanResetDelimiter() {
var text = "a{{=<% %>=}}b<%hmm%>c<%={{ }}=%>d{{hmm}}";
var tokens = Hogan.scan(text);
is(tokens.length, 6, "8 tokens, delimiter changes don't count.");
is(tokens[0]+'', "a", "first token is correct.");
is(tokens[1]+'', "b", "third token is correct.");
is(tokens[2].tag, "_v", "third token is correct tag.");
is(tokens[2].n, "hmm", "third token is correct name.");
is(tokens[3]+'', "c", "fifth token is correct.");
is(tokens[4]+'', "d", "seventh token is correct.");
is(tokens[5].tag, "_v", "eighth token is correct tag.");
is(tokens[5].n, "hmm", "eighth token is correct name.");
}
function testSingleCharDelimiter() {
var text = '({{foo}} {{=[ ]=}}[text])';
var tokens = Hogan.scan(text);
var t = Hogan.compile(text);
s = t.render({foo: "bar", text: 'It worked!'});
is(s, '(bar It worked!)', "Hogan substitution worked after custom delimiters.");
}
function testSetDelimiterWithWhitespace() {
var text = "{{= | | =}}|foo|";
var t = Hogan.compile(text);
s = t.render({foo: "bar"});
is(s, 'bar', "custom delimiters with whitespace works.")
}
function testParseBasic() {
var text = "test";
var tree = Hogan.parse(Hogan.scan(text));
is(tree.length, 1, "one parse node");
is(tree[0]+'', "test", "text is correct");
}
function testParseVariables() {
var text = "test{{foo}}test!{{bar}}test!!{{baz}}test!!!";
var tree = Hogan.parse(Hogan.scan(text));
is(tree.length, 7, "one parse node");
is(tree[0]+'', "test", "first text is correct");
is(tree[2]+'', "test!", "second text is correct")
is(tree[4]+'', "test!!", "third text is correct")
is(tree[6]+'', "test!!!", "last text is correct")
is(tree[1].n, "foo", "first var is correct");
is(tree[3].n, "bar", "second var is correct");
is(tree[5].n, "baz", "third var is correct");
}
function testParseSection() {
var text = "a{{#foo}}b{{/foo}}c";
var tree = Hogan.parse(Hogan.scan(text));
is(tree.length, 3, "three nodes at base");
is(tree[0]+'', "a", "correct text in first node");
is(tree[1].hasOwnProperty('nodes'), true, "second node is a section");
is(tree[1].tag, '#', "second node is a section");
is(tree[1].n, "foo", "correct name for section");
is(tree[1].nodes[0]+'', "b", "correct text in section");
is(tree[2]+'', "c", "correct text in last node");
}
function testParseIndexes() {
var text = "abc{{#foo}}asdf{{bar}}asdf{{/foo}}def";
var tree = Hogan.parse(Hogan.scan(text));
is(text.substring(tree[1].i, tree[1].end), "asdf{{bar}}asdf", "section text indexes are correct");
}
function testParseNegativeSection() {
var text = "a{{^foo}}b{{/foo}}c";
var tree = Hogan.parse(Hogan.scan(text));
is(tree.length, 3, "three nodes at base");
is(tree[0]+'', "a", "correct text in first node");
is(tree[1].hasOwnProperty('nodes'), true, "second node is a section");
is(tree[1].tag, '^', "second node is a negative section");
is(tree[1].n, "foo", "correct name for section");
is(tree[1].nodes[0]+'', "b", "correct text in section");
is(tree[2]+'', "c", "correct text in last node");
}
function testParseNestedSections() {
var text = "{{#bar}}{{#foo}}c{{/foo}}{{/bar}}"
var tree = Hogan.parse(Hogan.scan(text));
is(tree.length, 1, "one node at base");
is(tree[0].tag, "#", "open section is first node");
is(tree[0].n, "bar", "first section name is 'bar'");
is(tree[0].nodes.length, 1, "first section contains one node.");
is(tree[0].nodes[0].n, "foo", "correct name for nested section");
is(tree[0].nodes[0].nodes[0]+'', "c", "correct text in nested section");
}
function testMissingClosingTag() {
var text = "a{{#foo}}bc";
var msg = '';
try {
var tree = Hogan.parse(Hogan.scan(text));
} catch (e) {
msg = e.message;
}
is(msg, "missing closing tag: foo", "Error is generated");
}
function testBadNesting() {
var text = "a{{#foo}}{{#bar}}b{{/foo}}{{/bar}}c";
var msg = '';
try {
var tree = Hogan.parse(Hogan.scan(text));
} catch (e) {
msg = e.message;
}
is(msg, "Nesting error: bar vs. foo", "Error is generated");
}
function testBasicOutput() {
var text = "test";
var t = Hogan.compile(text);
is(t.render(), text, "template renders one text node");
}
function testBasicOutputAsString() {
var text = "test";
var textFunc = Hogan.compile(text, true);
is(textFunc, "function(context, partials){this.buffer.push('test');};", "template renders correct text function.");
}
function testOneVariable() {
var text = "test {{foo}} test";
var t = Hogan.compile(text);
var s = t.render({foo:'bar'});
is(s, "test bar test", "basic variable substitution works.");
}
function testOneVariableAsString() {
var text = "test {{foo}} test";
var funcText = Hogan.compile(text, true);
is(funcText, "function(context, partials){this.buffer.push('test ');\nthis.buffer.push(this.find('foo', context));\nthis.buffer.push(' test');};",
"Function text is correct with variable substitution.");
}
function testRenderWithWhitespace() {
var text = "{{ string }}";
var t = Hogan.compile(text);
is(t.render({string: "---" }), "---", "tags with whitespace render correctly.");
}
function testRenderWithWhitespaceAroundTripleStache() {
var text = " {{{string}}}\n";
var t = Hogan.compile(text);
is(t.render({string: "---" }), " ---\n", "triple stache surrounded by whitespace render correctly.");
}
function testRenderWithWhitespaceAroundAmpersand() {
var text = " {{& string }}\n";
var t = Hogan.compile(text);
is(t.render({string: "---" }), " ---\n", "ampersand surrounded by whitespace render correctly.");
}
function testMultipleVariables() {
var text = "test {{foo}} test {{bar}} test {{baz}} test {{foo}} test";
var t = Hogan.compile(text);
var s = t.render({foo:'42', bar: '43', baz: '44'});
is(s, "test 42 test 43 test 44 test 42 test", "all variables render correctly.");
}
function testNumberValues() {
var text = "integer: {{foo}} float: {{bar}} negative: {{baz}}";
var t = Hogan.compile(text);
var s = t.render({foo: 42, bar: 42.42, baz: -42});
is(s, "integer: 42 float: 42.42 negative: -42", "numbers render correctly");
}
function testObjectRender() {
var text = "object: {{foo}}";
var t = Hogan.compile(text);
var s = t.render({foo: {}});
is(s, "object: [object Object]", "objects render default toString.");
}
function testObjectToStringRender() {
var text = "object: {{foo}}";
var t = Hogan.compile(text);
var s = t.render({foo: {toString: function(){ return "yo!"}}});
is(s, "object: yo!", "objects render supplied toString.");
}
function testArrayRender() {
var text = "array: {{foo}}";
var t = Hogan.compile(text);
var s = t.render({foo: ["a","b","c"]});
is(s, "array: a,b,c", "arrays render default toString.");
}
function testEscaping() {
var text = "{{foo}}";
var t = Hogan.compile(text);
var s = t.render();
var s = t.render({foo: "< > <div> \' \" &"});
is(s, "&lt; &gt; &lt;div&gt; &#39; &quot; &amp;", "input correctly escaped.");
var ec ={ "'": "&#39;", '"': "&quot;", "<": "&lt;", ">": "&gt;", "&": "&amp;"}
for (var char in ec) {
var s = t.render({foo: char + " just me"});
is(s, ec[char] + " just me", "input correctly escaped.");
}
}
function testMustacheInjection() {
var text = "{{foo}}";
var t = Hogan.compile(text);
s = t.render({foo:"{{{<42}}}"})
is(s, "{{{&lt;42}}}", "Can't inject mustache");
}
function testTripleStache() {
var text = "{{{foo}}}";
var t = Hogan.compile(text);
var s = t.render({foo: "< > <div> \' \" &"});
is(s, "< > <div> \' \" &", "input correctly not-escaped.");
}
function testAmpNoEscaping() {
var text = "{{&foo}}";
var t = Hogan.compile(text);
var s = t.render({foo: "< > <div> \' \" &"});
is(s, "< > <div> \' \" &", "input correctly not-escaped.");
}
function testPartial() {
var partialText = "this is text from the partial--the magic number {{foo}} is from a variable";
var p = Hogan.compile(partialText);
var text = "This template contains a partial ({{>testPartial}})."
var t = Hogan.compile(text);
var s = t.render({foo: 42}, {testPartial: p});
is(s, "This template contains a partial (this is text from the partial--the magic number 42 is from a variable).", "partials work");
}
function testNestedPartials() {
var partialText = "this is text from the partial--the magic number {{foo}} is from a variable";
var p = Hogan.compile(partialText);
var partialText2 = "This template contains a partial ({{>testPartial}})."
var p2 = Hogan.compile(partialText2);
var text = "This template contains a partial that contains a partial [{{>testPartial2}}]."
var t = Hogan.compile(text);
var s = t.render({foo: 42}, {testPartial: p, testPartial2: p2});
is(s, "This template contains a partial that contains a partial [This template contains a partial (this is text from the partial--the magic number 42 is from a variable).].", "nested partials work");
}
function testNegativeSection() {
var text = "This template {{^foo}}BOO {{/foo}}contains an inverted section."
var t = Hogan.compile(text);
var s = t.render();
is(s, "This template BOO contains an inverted section.", "inverted sections with no context work");
s = t.render({foo:[]});
is(s, "This template BOO contains an inverted section.", "inverted sections with empty list context work");
s = t.render({ foo:false });
is(s, "This template BOO contains an inverted section.", "inverted sections with false context work");
s = t.render({foo:''});
is(s, "This template contains an inverted section.", "inverted sections with empty string context work");
s = t.render({foo:true});
is(s, "This template contains an inverted section.", "inverted sections with true context work");
s = t.render({foo: function() { return false; }});
is(s, "This template BOO contains an inverted section.", "inverted sections with false returning method in context work");
}
function testSectionElision() {
var text = "This template {{#foo}}BOO {{/foo}}contains a section."
var t = Hogan.compile(text);
var s = t.render();
is(s, "This template contains a section.", "sections with no context work");
s = t.render({foo:[]});
is(s, "This template contains a section.", "sections with empty list context work");
s = t.render({foo:false});
is(s, "This template contains a section.", "sections with false context work");
}
function testSectionObjectContext() {
var text = "This template {{#foo}}{{bar}} {{/foo}}contains a section."
var t = Hogan.compile(text);
var s = t.render({foo:{bar:42}});
is(s, "This template 42 contains a section.", "sections with object context work");
}
function testSectionArrayContext() {
var text = "This template {{#foo}}{{bar}} {{/foo}}contains a section."
var t = Hogan.compile(text);
var s = t.render({foo:[{bar:42}, {bar:43}, {bar:44}]});
is(s, "This template 42 43 44 contains a section.", "sections with object ctx and array values work");
}
function testFalsyVariableNoRender() {
var text = "I ({{cannot}}) be seen!";
var t = Hogan.compile(text);
var s = t.render();
is(s, "I () be seen!", "missing value doesn't render.");
}
function testSectionExtensions() {
var text = "Test {{_//|__foo}}bar{{/foo}}";
var options = {sectionTags:[{o:'_//|__foo', c:'foo'}]};
var tree = Hogan.parse(Hogan.scan(text), options);
is(tree[1].tag, "#", "_//|__foo node transformed to section");
is(tree[1].n, "_//|__foo", "_//|__foo node transformed to section");
var t = Hogan.compile(text, options );
var s = t.render({'_//|__foo':true});
is(s, "Test bar", "Custom sections work");
}
function testMisnestedSectionExtensions() {
var text = "Test {{__foo}}bar{{/bar}}";
var options = {sectionTags:[{o:'__foo', c:'foo'}, {o:'__bar', c:'bar'}]};
var msg = '';
try {
var tree = Hogan.parse(Hogan.scan(text), options);
} catch (e) {
msg = e.message;
}
is(msg, "Nesting error: __foo vs. bar", "Error is generated");
}
function testNestedSection() {
var text = "{{#foo}}{{#bar}}{{baz}}{{/bar}}{{/foo}}";
var t = Hogan.compile(text);
var s = t.render({foo: 42, bar: 42, baz:42});
is(s, "42", "can reach up context stack");
}
function testDottedNames() {
var text = '"{{person.name}}" == "{{#person}}{{name}}{{/person}}"';
var t = Hogan.compile(text);
var s = t.render({person:{name:'Joe'}});
is(s, '"Joe" == "Joe"', "dotted names work");
}
function testImplicitIterator() {
var text = '{{#stuff}} {{.}} {{/stuff}}';
var t = Hogan.compile(text);
var s = t.render({stuff:[42,43,44]});
is(s, " 42 43 44 ", "implicit iterators work");
}
function testPartialsAndDelimiters() {
var text = '{{>include}}*\n{{= | | =}}\n*|>include|';
var partialText = ' .{{value}}. ';
var partial = Hogan.compile(partialText);
var t = Hogan.compile(text);
var s = t.render({value:"yes"}, {'include':partial});
is(s, " .yes. *\n* .yes. ", "partials work around delimiters");
}
function testStringPartials() {
var text = "foo{{>mypartial}}baz";
var partialText = " bar ";
var t = Hogan.compile(text);
var s = t.render({}, {'mypartial': partialText});
is(s, "foo bar baz", "string partial works.");
}
function testMissingPartials() {
var text = "foo{{>mypartial}} bar";
var t = Hogan.compile(text);
var s = t.render({});
is(s, "foo bar", "missing partial works.");
}
function testIndentedStandaloneComment() {
var text = 'Begin.\n {{! Indented Comment Block! }}\nEnd.';
var t = Hogan.compile(text);
var s = t.render();
is(s, 'Begin.\nEnd.', "Standalone comment blocks are removed.");
}
function testNewLineBetweenDelimiterChanges() {
var data = { section: true, data: 'I got interpolated.' };
var text = '\n{{#section}}\n {{data}}\n |data|\n{{/section}}x\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|';
var t = Hogan.compile(text);
var s = t.render(data);
is(s, '\n I got interpolated.\n |data|\nx\n\n {{data}}\n I got interpolated.\n', 'render correct')
}
function testMustacheJSApostrophe() {
var text = '{{apos}}{{control}}';
var t = Hogan.compile(text);
var s = t.render({'apos':"'", 'control':"X"});
is(s, '&#39;X', 'Apostrophe is escaped.');
}
function testMustacheJSArrayOfImplicitPartials() {
var text = 'Here is some stuff!\n{{#numbers}}\n{{>partial}}\n{{/numbers}}\n';
var partialText = '{{.}}\n';
var t = Hogan.compile(text);
var s = t.render({numbers:[1,2,3,4]}, {partial: partialText});
is(s, 'Here is some stuff!\n1\n2\n3\n4\n', 'Partials with implicit iterators work.');
}
function testMustacheJSArrayOfPartials() {
var text = 'Here is some stuff!\n{{#numbers}}\n{{>partial}}\n{{/numbers}}\n';
var partialText = '{{i}}\n';
var t = Hogan.compile(text);
var s = t.render({numbers:[{i:1},{i:2},{i:3},{i:4}]}, {partial: partialText});
is(s, 'Here is some stuff!\n1\n2\n3\n4\n', 'Partials with arrays work.');
}
function testMustacheJSArrayOfStrings() {
var text = '{{#strings}}{{.}} {{/strings}}';
var t = Hogan.compile(text);
var s = t.render({strings:['foo', 'bar', 'baz']});
is(s, 'foo bar baz ', 'array of strings works with implicit iterators.');
}
function testMustacheJSUndefinedString() {
var text = 'foo{{bar}}baz';
var t = Hogan.compile(text);
var s = t.render({bar:undefined});
is(s, 'foobaz', 'undefined value does not render.');
}
function testMustacheJSTripleStacheAltDelimiter() {
var text = '{{=<% %>=}}<% foo %> {{foo}} <%{bar}%> {{{bar}}}';
var t = Hogan.compile(text);
var s = t.render({foo:'yeah', bar:'hmm'});
is(s, 'yeah {{foo}} hmm {{{bar}}}', 'triple stache inside alternate delimiter works.');
}
/* shootout benchmark tests */
function testShootOutString() {
var text = "Hello World!";
var expected = "Hello World!"
var t = Hogan.compile(text)
var s = t.render({})
is(s, expected, "Shootout String compiled correctly");
}
function testShootOutReplace() {
var text = "Hello {{name}}! You have {{count}} new messages.";
var expected = "Hello Mick! You have 30 new messages.";
var t = Hogan.compile(text)
var s = t.render({ name: "Mick", count: 30 })
is(s, expected, "Shootout Replace compiled correctly");
}
function testShootOutArray() {
var text = "{{#names}}{{name}}{{/names}}";
var expected = "MoeLarryCurlyShemp";
var t = Hogan.compile(text);
var s = t.render({ names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}] })
is(s, expected, "Shootout Array compiled correctly");
}
function testShootOutObject() {
var text = "{{#person}}{{name}}{{age}}{{/person}}";
var expected = "Larry45";
var t = Hogan.compile(text)
var s = t.render({ person: { name: "Larry", age: 45 } })
is(s, expected, "Shootout Object compiled correctly");
}
function testShootOutPartial() {
var text = "{{#peeps}}{{>replace}}{{/peeps}}";
var t = Hogan.compile(text);
var partial = Hogan.compile(" Hello {{name}}! You have {{count}} new messages.");
var s = t.render({ peeps: [{name: "Moe", count: 15}, {name: "Larry", count: 5}, {name: "Curly", count: 2}] }, { replace: partial });
var expected = " Hello Moe! You have 15 new messages. Hello Larry! You have 5 new messages. Hello Curly! You have 2 new messages.";
is(s, expected, "Shootout Partial compiled correctly");
}
function testShootOutRecurse() {
var text = "{{name}}{{#kids}}{{>recursion}}{{/kids}}";
var t = Hogan.compile(text);
var partial = Hogan.compile("{{name}}{{#kids}}{{>recursion}}{{/kids}}");
var s = t.render({
name: '1',
kids: [
{
name: '1.1',
kids: [
{ name: '1.1.1', kids: [] }
]
}
]
}, { recursion: partial });
var expected = "11.11.1.1";
is(s, expected, "Shootout Recurse compiled correctly");
}
function testShootOutFilter() {
var text = "{{#filter}}foo {{bar}}{{/filter}}";
var t = Hogan.compile(text);
var s = t.render({
filter: function() {
return function(text, render) {
return render(text).toUpperCase();
}
},
bar: "bar"
});
var expected = "FOO BAR"
is(s, expected, "Shootout Filter compiled correctly");
}
function testShootOutComplex() {
var text =
"<h1>{{header}}</h1>" +
"{{#hasItems}}" +
"<ul>" +
"{{#items}}" +
"{{#current}}" +
"<li><strong>{{name}}</strong></li>" +
"{{/current}}" +
"{{^current}}" +
"<li><a href=\"{{url}}\">{{name}}</a></li>" +
"{{/current}}" +
"{{/items}}" +
"</ul>" +
"{{/hasItems}}" +
"{{^hasItems}}" +
"<p>The list is empty.</p>" +
"{{/hasItems}}";
var expected = "<h1>Colors</h1><ul><li><strong>red</strong></li><li><a href=\"#Green\">green</a></li><li><a href=\"#Blue\">blue</a></li></ul>";
var t = Hogan.compile(text)
var s = t.render({
header: function() {
return "Colors";
},
items: [
{name: "red", current: true, url: "#Red"},
{name: "green", current: false, url: "#Green"},
{name: "blue", current: false, url: "#Blue"}
],
hasItems: function() {
return this.items.length !== 0;
},
empty: function() {
return this.items.length === 0;
}
})
is(s, expected, "Shootout Complex compiled correctly");
}
function testRenderOutput() {
if (doc) return
var fs = require('fs');
var inPath = 'test/templates';
var outPath = 'test/html';
fs.readdirSync(inPath).forEach(function (file) {
var i = fs.readFileSync([inPath, file].join('/'), 'utf-8');
var t = Hogan.compile(i);
var r = t.render({});
var o = fs.readFileSync([outPath, file].join('/').replace(/mustache$/, 'html')).toString();
is(r === o, true, file + ' should correctly render html')
})
}
function testDefaultRenderImpl() {
var ht = new Hogan.Template();
is(ht.render() === '', true, 'default renderImpl returns an array.');
}
function appendText(el, text) {
var textNode = document.createTextNode(text);
el.appendChild(textNode);
el.appendChild(document.createElement('br'));
}
if (!this["output"]) {
var output = function (s) {
return doc ? appendText(doc.getElementById('console'), s) : console.log(s);
};
}
var passed = 0;
var failed = 0;
function is(got, expected, msg) {
if (got === expected) {
output("OK: " + msg);
++passed;
} else {
output("FAIL: " + msg);
output("Expected |" + expected + "|");
output(" Got |" + got + "|");
++failed;
}
}
function complete() {
output("\nTests Complete");
output("--------------");
output("Passed: " + passed);
output("Failed: " + failed);
output("\n");
}
function runTests() {
output("Tests Starting");
output("--------------");
testScanTextNoTags();
testScanOneTag();
testScanMultipleTags();
testScanSectionOpen();
testScanSectionClose();
testScanSection();
testScanSectionInContent();
testScanNegativeSection();
testScanPartial();
testScanBackwardPartial();
testScanAmpersandNoEscapeTag();
testScanTripleStache();
testScanSectionWithTripleStacheInside();
testScanSetDelimiter();
testScanResetDelimiter();
testSetDelimiterWithWhitespace();
testSingleCharDelimiter();
testParseBasic();
testParseVariables();
testParseSection();
testParseIndexes();
testParseNegativeSection();
testParseNestedSections();
testMissingClosingTag();
testBadNesting();
testBasicOutput();
//testBasicOutputAsString();
testOneVariable();
//testOneVariableAsString();
testMultipleVariables();
testNumberValues();
testObjectRender();
testObjectToStringRender();
testArrayRender();
testEscaping();
testMustacheInjection();
testTripleStache();
testAmpNoEscaping();
testPartial();
testNestedPartials();
testNegativeSection();
testSectionElision();
testSectionObjectContext();
testSectionArrayContext();
testRenderWithWhitespace();
testRenderWithWhitespaceAroundTripleStache();
testRenderWithWhitespaceAroundAmpersand();
testFalsyVariableNoRender();
testRenderOutput();
testDefaultRenderImpl();
testSectionExtensions();
testMisnestedSectionExtensions();
testNestedSection();
testShootOutString();
testShootOutReplace();
testShootOutArray();
testShootOutObject();
testShootOutPartial();
testShootOutRecurse();
testShootOutFilter();
testShootOutComplex();
testDottedNames();
testImplicitIterator();
testPartialsAndDelimiters();
testStringPartials();
testMissingPartials();
testIndentedStandaloneComment();
testNewLineBetweenDelimiterChanges();
testMustacheJSApostrophe();
testMustacheJSArrayOfImplicitPartials();
testMustacheJSArrayOfPartials();
testMustacheJSArrayOfStrings();
testMustacheJSUndefinedString();
testMustacheJSTripleStacheAltDelimiter();
complete();
}
if (doc) {
window.onload = runTests;
} else {
runTests();
}

90
docs/build/node_modules/hogan.js/test/mustache.js generated vendored Normal file
View File

@ -0,0 +1,90 @@
/*
* 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.
*/
var doc = this['document'];
var fs = require('fs');
var passed = 0;
var failed = 0;
if (!this['output']) {
var output = function (string) {
return doc ? doc.write(string + '<br/>') : console.log(string);
};
}
var Hogan = require(__dirname + '/../lib/hogan');
var template = fs.readFileSync(__dirname + '/../lib/template.js').toString();
var compiler = fs.readFileSync(__dirname + '/../lib/compiler.js').toString();
var mustache_wrapper = fs.readFileSync(__dirname + '/../wrappers/mustache.js.mustache').toString();
// Create a Mustache.js emulator from the distribution template
var engines = (new Function(Hogan.compile(mustache_wrapper).render({template: template, compiler: compiler}) +
'; return {Hogan: Hogan, Mustache: Mustache};'))();
var Mustache = engines.Mustache;
var Hogan2 = engines.Hogan;
// sanity check
is(Mustache.hasOwnProperty('to_html'), true, 'Mustache has to_html method.');
// Check for Mustache.js partial resolution behavior.
var context = {
foo: 'bar',
mypartial: {
baz: 'qux'
}
}
var text = 'abc {{foo}} def {{>mypartial}} ghi';
var partialText = '{{baz}}';
var s = Mustache.to_html(text, context, {'mypartial': partialText});
is(s, 'abc bar def qux ghi', 'Correct emulation of Mustache.js partial-name-in-context resolution.');
// Now check to see that the Hogan resolution is unaffected.
var t = Hogan2.compile(text);
s = t.render(context, {'mypartial': partialText});
is(s, 'abc bar def ghi', 'Hogan behavior not changed by Mustache.js emulation.');
// Check for sendFun behavior
var buf = "";
function send(s) {
buf += "-FOO " + s + " FOO-";
}
var s = Mustache.to_html(text, context, {'mypartial': partialText}, send);
is(buf, '-FOO abc bar def qux ghi FOO-', 'Correct emulation of Mustache.js sendFun.');
function is(got, expected, msg) {
if (got === expected) {
output("OK: " + msg);
++passed;
} else {
output("FAIL: " + msg);
output("Expected |" + expected + "|");
output(" Got |" + got + "|");
++failed;
}
}
function complete() {
output("\nTests Complete");
output("--------------");
output("Passed: " + passed);
output("Failed: " + failed);
output("\n");
}
complete();

77
docs/build/node_modules/hogan.js/test/spec.js generated vendored Normal file
View File

@ -0,0 +1,77 @@
/*
* 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.
*/
var Hogan = Hogan || require('../lib/hogan');
var doc = this["document"];
var fs = require('fs');
var passed = 0;
var failed = 0;
if (!this["output"]) {
var output = function (string) {
return doc ? doc.write(string + '<br/>') : console.log(string);
};
}
function runTest(tests) {
tests.forEach(function(test) {
var partials = {};
for (var i in test.partials) {
partials[i] = Hogan.compile(test.partials[i]);
}
var t = Hogan.compile(test.template);
if (test.data.lambda) {
var func = (new Function ('return ' + test.data.lambda.js)());
test.data.lambda = function() { return func; };
}
var s = t.render(test.data, partials);
is(s, test.expected, test.name + ': ' + test.desc);
});
}
var testDir = './test/spec/specs';
var files = fs.readdirSync(testDir)
.filter(function(f) { return f.indexOf('.json') > 0; })
.map(function(f) { return testDir + '/' + f});
for (var i = 0; i < files.length; i++) {
var test = JSON.parse(fs.readFileSync(files[i]).toString());
runTest(test.tests);
}
function is(got, expected, msg) {
if (got === expected) {
output("OK: " + msg);
++passed;
} else {
output("FAIL: " + msg);
output("Expected |" + expected + "|");
output(" Got |" + got + "|");
++failed;
}
}
function complete() {
output("\nTests Complete");
output("--------------");
output("Passed: " + passed);
output("Failed: " + failed);
output("\n");
}
complete();

31
docs/build/node_modules/hogan.js/test/spec/Changes generated vendored Normal file
View File

@ -0,0 +1,31 @@
2011-03-20: v1.1.2
Added tests for standalone tags at string boundaries.
Added tests for rendering lambda returns after delimiter changes.
2011-03-20: v1.0.3
Added tests for standalone tags at string boundaries.
Added tests for rendering lambda returns after delimiter changes.
2011-03-05: v1.1.1
Added tests for indented inline sections.
Added tests for Windows-style newlines.
2011-03-05: v1.0.2
Added tests for indented inline sections.
Added tests for Windows-style newlines.
2011-03-04: v1.1.0
Implicit iterators.
A single period (`.`) may now be used as a name in Interpolation tags,
which represents the top of stack (cast as a String).
Dotted names.
Names containing one or more periods should be resolved as chained
properties; naïvely, this is like nesting section tags, but with some
built-in scoping protections.
2011-03-02: v1.0.1
Clarifying a point in the README about version compliance.
Adding high-level documentation to each spec file.
2011-02-28: v1.0.0
Initial Release

65
docs/build/node_modules/hogan.js/test/spec/README.md generated vendored Normal file
View File

@ -0,0 +1,65 @@
The repository at https://github.com/mustache/spec is the formal standard for
Mustache. It defines both normal usage and edge-case behavior for libraries
parsing the Mustache templating language (or a superset thereof).
The specification is developed as a series of YAML files, under the `specs`
directory.
Versioning
----------
This specification is being [semantically versioned](http://semver.org).
Roughly described, major version changes will always represent backwards
incompatible changes, minor version changes will always represent new language
features and will be backwards compatible, and patch ('tiny') version changes
will always be bug fixes. For the purposes of semantic versioning, the public
API is the contents of the `specs` directory and the algorithm for testing
against it.
Mustache implementations SHOULD report the most recent version of the spec
(major and minor version numbers). If an implementation has support for any
optional modules, they SHOULD indicate so with a remark attached to the
version number (e.g. "vX.Y, including lambdas" or "v.X.Y+λ"). It is
RECOMMENDED that implementations not supporting at least v1.0.0 of this spec
refer to themselves as "Mustache-like", or "Mustache-inspired".
Alternate Formats
-----------------
Since YAML is a reasonably complex format that not every language has good
tools for working with, we also provide JSON versions of the specs on a
best-effort basis.
These should be identical to the YAML specifications, but if you find the need
to regenerate them, they can be trivially rebuilt by invoking `rake build`.
It is also worth noting that some specifications (notably, the lambda module)
rely on YAML "tags" to denote special types of data (e.g. source code). Since
JSON offers no way to denote this, a special key ("`__tag__`") is injected
with the name of the tag as its value. See `TESTING.md` for more information
about handling tagged data.
Optional Modules
----------------
Specification files beginning with a tilde (`~`) describe optional modules.
At present, the only module being described as optional is regarding support
for lambdas. As a guideline, a module may be a candidate for optionality
when:
* It does not affect the core syntax of the language.
* It does not significantly affect the output of rendered templates.
* It concerns implementation language features or data types that are not
common to or core in every targeted language.
* The lack of support by an implementation does not diminish the usage of
Mustache in the target language.
As an example, the lambda module is primarily concerned with the handling of a
particular data type (code). This is a type of data that may be difficult to
support in some languages, and users of those languages will not see the lack
as an 'inconsistency' between implementations.
Support for specific pragmas or syntax extensions, however, are best managed
outside this core specification, as adjunct specifications.
Implementors are strongly encouraged to support any and all modules they are
reasonably capable of supporting.

27
docs/build/node_modules/hogan.js/test/spec/Rakefile generated vendored Normal file
View File

@ -0,0 +1,27 @@
require 'json'
require 'yaml'
# Our custom YAML tags must retain their magic.
%w[ code ].each do |tag|
YAML::add_builtin_type(tag) { |_,val| val.merge(:__tag__ => tag) }
end
desc 'Build all alternate versions of the specs.'
multitask :build => [ 'build:json' ]
namespace :build do
note = 'Do not edit this file; changes belong in the appropriate YAML file.'
desc 'Build JSON versions of the specs.'
task :json do
rm(Dir['specs/*.json'], :verbose => false)
Dir.glob('specs/*.yml').each do |filename|
json_file = filename.gsub('.yml', '.json')
File.open(json_file, 'w') do |file|
doc = YAML.load_file(filename)
file << doc.merge(:__ATTN__ => note).to_json()
end
end
end
end

46
docs/build/node_modules/hogan.js/test/spec/TESTING.md generated vendored Normal file
View File

@ -0,0 +1,46 @@
Testing your Mustache implementation against this specification should be
relatively simple. If you have a readily available testing framework on your
platform, your task may be even simpler.
In general, the process for each `.yml` file is as follows:
1. Use a YAML parser to load the file.
2. For each test in the 'tests' array:
1. Ensure that each element of the 'partials' hash (if it exists) is
stored in a place where the interpreter will look for it.
2. If your implementation will not support lambdas, feel free to skip over
the optional '~lambdas.yml' file.
2.1. If your implementation will support lambdas, ensure that each member of
'data' tagged with '!code' is properly processed into a language-
specific lambda reference.
* e.g. Given this YAML data hash:
`{ x: !code { ruby: 'proc { "x" }', perl: 'sub { "x" }' } }`
a Ruby-based Mustache implementation would process it such that it
was equivalent to this Ruby hash:
`{ 'x' => proc { "x" } }`
* If your implementation language does not currently have lambda
examples in the spec, feel free to implement them and send a pull
request.
* The JSON version of the spec represents these tagged values as a hash
with a '`__tag__`' key of 'code'.
3. Render the template (stored in the 'template' key) with the given 'data'
hash.
4. Compare the results of your rendering against the 'expected' value; any
differences should be reported, along with any useful debugging
information.
* Of note, the 'desc' key contains a rough one-line description of the
behavior being tested -- this is most useful in conjunction with the
file name and test 'name'.

View File

@ -0,0 +1 @@
{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Comment tags represent content that should never appear in the resulting\noutput.\n\nThe tag's content may contain any substring (including newlines) EXCEPT the\nclosing delimiter.\n\nComment tags SHOULD be treated as standalone when appropriate.\n","tests":[{"name":"Inline","data":{},"expected":"1234567890","template":"12345{{! Comment Block! }}67890","desc":"Comment blocks should be removed from the template."},{"name":"Multiline","data":{},"expected":"1234567890\n","template":"12345{{!\n This is a\n multi-line comment...\n}}67890\n","desc":"Multiline comments should be permitted."},{"name":"Standalone","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n{{! Comment Block! }}\nEnd.\n","desc":"All standalone comment lines should be removed."},{"name":"Indented Standalone","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n {{! Indented Comment Block! }}\nEnd.\n","desc":"All standalone comment lines should be removed."},{"name":"Standalone Line Endings","data":{},"expected":"|\r\n|","template":"|\r\n{{! Standalone Comment }}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previous Line","data":{},"expected":"!","template":" {{! I'm Still Standalone }}\n!","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{},"expected":"!\n","template":"!\n {{! I'm Still Standalone }}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Multiline Standalone","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n{{!\nSomething's going on here...\n}}\nEnd.\n","desc":"All standalone comment lines should be removed."},{"name":"Indented Multiline Standalone","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n {{!\n Something's going on here...\n }}\nEnd.\n","desc":"All standalone comment lines should be removed."},{"name":"Indented Inline","data":{},"expected":" 12 \n","template":" 12 {{! 34 }}\n","desc":"Inline comments should not strip whitespace"},{"name":"Surrounding Whitespace","data":{},"expected":"12345 67890","template":"12345 {{! Comment Block! }} 67890","desc":"Comment removal should preserve surrounding whitespace."}]}

View File

@ -0,0 +1,103 @@
overview: |
Comment tags represent content that should never appear in the resulting
output.
The tag's content may contain any substring (including newlines) EXCEPT the
closing delimiter.
Comment tags SHOULD be treated as standalone when appropriate.
tests:
- name: Inline
desc: Comment blocks should be removed from the template.
data: { }
template: '12345{{! Comment Block! }}67890'
expected: '1234567890'
- name: Multiline
desc: Multiline comments should be permitted.
data: { }
template: |
12345{{!
This is a
multi-line comment...
}}67890
expected: |
1234567890
- name: Standalone
desc: All standalone comment lines should be removed.
data: { }
template: |
Begin.
{{! Comment Block! }}
End.
expected: |
Begin.
End.
- name: Indented Standalone
desc: All standalone comment lines should be removed.
data: { }
template: |
Begin.
{{! Indented Comment Block! }}
End.
expected: |
Begin.
End.
- name: Standalone Line Endings
desc: '"\r\n" should be considered a newline for standalone tags.'
data: { }
template: "|\r\n{{! Standalone Comment }}\r\n|"
expected: "|\r\n|"
- name: Standalone Without Previous Line
desc: Standalone tags should not require a newline to precede them.
data: { }
template: " {{! I'm Still Standalone }}\n!"
expected: "!"
- name: Standalone Without Newline
desc: Standalone tags should not require a newline to follow them.
data: { }
template: "!\n {{! I'm Still Standalone }}"
expected: "!\n"
- name: Multiline Standalone
desc: All standalone comment lines should be removed.
data: { }
template: |
Begin.
{{!
Something's going on here...
}}
End.
expected: |
Begin.
End.
- name: Indented Multiline Standalone
desc: All standalone comment lines should be removed.
data: { }
template: |
Begin.
{{!
Something's going on here...
}}
End.
expected: |
Begin.
End.
- name: Indented Inline
desc: Inline comments should not strip whitespace
data: { }
template: " 12 {{! 34 }}\n"
expected: " 12 \n"
- name: Surrounding Whitespace
desc: Comment removal should preserve surrounding whitespace.
data: { }
template: '12345 {{! Comment Block! }} 67890'
expected: '12345 67890'

View File

@ -0,0 +1 @@
{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Set Delimiter tags are used to change the tag delimiters for all content\nfollowing the tag in the current compilation unit.\n\nThe tag's content MUST be any two non-whitespace sequences (separated by\nwhitespace) EXCEPT an equals sign ('=') followed by the current closing\ndelimiter.\n\nSet Delimiter tags SHOULD be treated as standalone when appropriate.\n","tests":[{"name":"Pair Behavior","data":{"text":"Hey!"},"expected":"(Hey!)","template":"{{=<% %>=}}(<%text%>)","desc":"The equals sign (used on both sides) should permit delimiter changes."},{"name":"Special Characters","data":{"text":"It worked!"},"expected":"(It worked!)","template":"({{=[ ]=}}[text])","desc":"Characters with special meaning regexen should be valid delimiters."},{"name":"Sections","data":{"section":true,"data":"I got interpolated."},"expected":"[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n","template":"[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n","desc":"Delimiters set outside sections should persist."},{"name":"Inverted Sections","data":{"section":false,"data":"I got interpolated."},"expected":"[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n","template":"[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n","desc":"Delimiters set outside inverted sections should persist."},{"name":"Partial Inheritence","data":{"value":"yes"},"expected":"[ .yes. ]\n[ .yes. ]\n","template":"[ {{>include}} ]\n{{= | | =}}\n[ |>include| ]\n","desc":"Delimiters set in a parent template should not affect a partial.","partials":{"include":".{{value}}."}},{"name":"Post-Partial Behavior","data":{"value":"yes"},"expected":"[ .yes. .yes. ]\n[ .yes. .|value|. ]\n","template":"[ {{>include}} ]\n[ .{{value}}. .|value|. ]\n","desc":"Delimiters set in a partial should not affect the parent template.","partials":{"include":".{{value}}. {{= | | =}} .|value|."}},{"name":"Surrounding Whitespace","data":{},"expected":"| |","template":"| {{=@ @=}} |","desc":"Surrounding whitespace should be left untouched."},{"name":"Outlying Whitespace (Inline)","data":{},"expected":" | \n","template":" | {{=@ @=}}\n","desc":"Whitespace should be left untouched."},{"name":"Standalone Tag","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n{{=@ @=}}\nEnd.\n","desc":"Standalone lines should be removed from the template."},{"name":"Indented Standalone Tag","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n {{=@ @=}}\nEnd.\n","desc":"Indented standalone lines should be removed from the template."},{"name":"Standalone Line Endings","data":{},"expected":"|\r\n|","template":"|\r\n{{= @ @ =}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previous Line","data":{},"expected":"=","template":" {{=@ @=}}\n=","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{},"expected":"=\n","template":"=\n {{=@ @=}}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Pair with Padding","data":{},"expected":"||","template":"|{{= @ @ =}}|","desc":"Superfluous in-tag whitespace should be ignored."}]}

View File

@ -0,0 +1,158 @@
overview: |
Set Delimiter tags are used to change the tag delimiters for all content
following the tag in the current compilation unit.
The tag's content MUST be any two non-whitespace sequences (separated by
whitespace) EXCEPT an equals sign ('=') followed by the current closing
delimiter.
Set Delimiter tags SHOULD be treated as standalone when appropriate.
tests:
- name: Pair Behavior
desc: The equals sign (used on both sides) should permit delimiter changes.
data: { text: 'Hey!' }
template: '{{=<% %>=}}(<%text%>)'
expected: '(Hey!)'
- name: Special Characters
desc: Characters with special meaning regexen should be valid delimiters.
data: { text: 'It worked!' }
template: '({{=[ ]=}}[text])'
expected: '(It worked!)'
- name: Sections
desc: Delimiters set outside sections should persist.
data: { section: true, data: 'I got interpolated.' }
template: |
[
{{#section}}
{{data}}
|data|
{{/section}}
{{= | | =}}
|#section|
{{data}}
|data|
|/section|
]
expected: |
[
I got interpolated.
|data|
{{data}}
I got interpolated.
]
- name: Inverted Sections
desc: Delimiters set outside inverted sections should persist.
data: { section: false, data: 'I got interpolated.' }
template: |
[
{{^section}}
{{data}}
|data|
{{/section}}
{{= | | =}}
|^section|
{{data}}
|data|
|/section|
]
expected: |
[
I got interpolated.
|data|
{{data}}
I got interpolated.
]
- name: Partial Inheritence
desc: Delimiters set in a parent template should not affect a partial.
data: { value: 'yes' }
partials:
include: '.{{value}}.'
template: |
[ {{>include}} ]
{{= | | =}}
[ |>include| ]
expected: |
[ .yes. ]
[ .yes. ]
- name: Post-Partial Behavior
desc: Delimiters set in a partial should not affect the parent template.
data: { value: 'yes' }
partials:
include: '.{{value}}. {{= | | =}} .|value|.'
template: |
[ {{>include}} ]
[ .{{value}}. .|value|. ]
expected: |
[ .yes. .yes. ]
[ .yes. .|value|. ]
# Whitespace Sensitivity
- name: Surrounding Whitespace
desc: Surrounding whitespace should be left untouched.
data: { }
template: '| {{=@ @=}} |'
expected: '| |'
- name: Outlying Whitespace (Inline)
desc: Whitespace should be left untouched.
data: { }
template: " | {{=@ @=}}\n"
expected: " | \n"
- name: Standalone Tag
desc: Standalone lines should be removed from the template.
data: { }
template: |
Begin.
{{=@ @=}}
End.
expected: |
Begin.
End.
- name: Indented Standalone Tag
desc: Indented standalone lines should be removed from the template.
data: { }
template: |
Begin.
{{=@ @=}}
End.
expected: |
Begin.
End.
- name: Standalone Line Endings
desc: '"\r\n" should be considered a newline for standalone tags.'
data: { }
template: "|\r\n{{= @ @ =}}\r\n|"
expected: "|\r\n|"
- name: Standalone Without Previous Line
desc: Standalone tags should not require a newline to precede them.
data: { }
template: " {{=@ @=}}\n="
expected: "="
- name: Standalone Without Newline
desc: Standalone tags should not require a newline to follow them.
data: { }
template: "=\n {{=@ @=}}"
expected: "=\n"
# Whitespace Insensitivity
- name: Pair with Padding
desc: Superfluous in-tag whitespace should be ignored.
data: { }
template: '|{{= @ @ =}}|'
expected: '||'

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,230 @@
overview: |
Interpolation tags are used to integrate dynamic content into the template.
The tag's content MUST be a non-whitespace character sequence NOT containing
the current closing delimiter.
This tag's content names the data to replace the tag. A single period (`.`)
indicates that the item currently sitting atop the context stack should be
used; otherwise, name resolution is as follows:
1) Split the name on periods; the first part is the name to resolve, any
remaining parts should be retained.
2) Walk the context stack from top to bottom, finding the first context
that is a) a hash containing the name as a key OR b) an object responding
to a method with the given name.
3) If the context is a hash, the data is the value associated with the
name.
4) If the context is an object, the data is the value returned by the
method with the given name.
5) If any name parts were retained in step 1, each should be resolved
against a context stack containing only the result from the former
resolution. If any part fails resolution, the result should be considered
falsey, and should interpolate as the empty string.
Data should be coerced into a string (and escaped, if appropriate) before
interpolation.
The Interpolation tags MUST NOT be treated as standalone.
tests:
- name: No Interpolation
desc: Mustache-free templates should render as-is.
data: { }
template: |
Hello from {Mustache}!
expected: |
Hello from {Mustache}!
- name: Basic Interpolation
desc: Unadorned tags should interpolate content into the template.
data: { subject: "world" }
template: |
Hello, {{subject}}!
expected: |
Hello, world!
- name: HTML Escaping
desc: Basic interpolation should be HTML escaped.
data: { forbidden: '& " < >' }
template: |
These characters should be HTML escaped: {{forbidden}}
expected: |
These characters should be HTML escaped: &amp; &quot; &lt; &gt;
- name: Triple Mustache
desc: Triple mustaches should interpolate without HTML escaping.
data: { forbidden: '& " < >' }
template: |
These characters should not be HTML escaped: {{{forbidden}}}
expected: |
These characters should not be HTML escaped: & " < >
- name: Ampersand
desc: Ampersand should interpolate without HTML escaping.
data: { forbidden: '& " < >' }
template: |
These characters should not be HTML escaped: {{&forbidden}}
expected: |
These characters should not be HTML escaped: & " < >
- name: Basic Integer Interpolation
desc: Integers should interpolate seamlessly.
data: { mph: 85 }
template: '"{{mph}} miles an hour!"'
expected: '"85 miles an hour!"'
- name: Triple Mustache Integer Interpolation
desc: Integers should interpolate seamlessly.
data: { mph: 85 }
template: '"{{{mph}}} miles an hour!"'
expected: '"85 miles an hour!"'
- name: Ampersand Integer Interpolation
desc: Integers should interpolate seamlessly.
data: { mph: 85 }
template: '"{{&mph}} miles an hour!"'
expected: '"85 miles an hour!"'
- name: Basic Decimal Interpolation
desc: Decimals should interpolate seamlessly with proper significance.
data: { power: 1.210 }
template: '"{{power}} jiggawatts!"'
expected: '"1.21 jiggawatts!"'
- name: Triple Mustache Decimal Interpolation
desc: Decimals should interpolate seamlessly with proper significance.
data: { power: 1.210 }
template: '"{{{power}}} jiggawatts!"'
expected: '"1.21 jiggawatts!"'
- name: Ampersand Decimal Interpolation
desc: Decimals should interpolate seamlessly with proper significance.
data: { power: 1.210 }
template: '"{{&power}} jiggawatts!"'
expected: '"1.21 jiggawatts!"'
# Context Misses
- name: Basic Context Miss Interpolation
desc: Failed context lookups should default to empty strings.
data: { }
template: "I ({{cannot}}) be seen!"
expected: "I () be seen!"
- name: Triple Mustache Context Miss Interpolation
desc: Failed context lookups should default to empty strings.
data: { }
template: "I ({{{cannot}}}) be seen!"
expected: "I () be seen!"
- name: Ampersand Context Miss Interpolation
desc: Failed context lookups should default to empty strings.
data: { }
template: "I ({{&cannot}}) be seen!"
expected: "I () be seen!"
# Dotted Names
- name: Dotted Names - Basic Interpolation
desc: Dotted names should be considered a form of shorthand for sections.
data: { person: { name: 'Joe' } }
template: '"{{person.name}}" == "{{#person}}{{name}}{{/person}}"'
expected: '"Joe" == "Joe"'
- name: Dotted Names - Triple Mustache Interpolation
desc: Dotted names should be considered a form of shorthand for sections.
data: { person: { name: 'Joe' } }
template: '"{{{person.name}}}" == "{{#person}}{{{name}}}{{/person}}"'
expected: '"Joe" == "Joe"'
- name: Dotted Names - Ampersand Interpolation
desc: Dotted names should be considered a form of shorthand for sections.
data: { person: { name: 'Joe' } }
template: '"{{&person.name}}" == "{{#person}}{{&name}}{{/person}}"'
expected: '"Joe" == "Joe"'
- name: Dotted Names - Arbitrary Depth
desc: Dotted names should be functional to any level of nesting.
data:
a: { b: { c: { d: { e: { name: 'Phil' } } } } }
template: '"{{a.b.c.d.e.name}}" == "Phil"'
expected: '"Phil" == "Phil"'
- name: Dotted Names - Broken Chains
desc: Any falsey value prior to the last part of the name should yield ''.
data:
a: { }
template: '"{{a.b.c}}" == ""'
expected: '"" == ""'
- name: Dotted Names - Broken Chain Resolution
desc: Each part of a dotted name should resolve only against its parent.
data:
a: { b: { } }
c: { name: 'Jim' }
template: '"{{a.b.c.name}}" == ""'
expected: '"" == ""'
- name: Dotted Names - Initial Resolution
desc: The first part of a dotted name should resolve as any other name.
data:
a: { b: { c: { d: { e: { name: 'Phil' } } } } }
b: { c: { d: { e: { name: 'Wrong' } } } }
template: '"{{#a}}{{b.c.d.e.name}}{{/a}}" == "Phil"'
expected: '"Phil" == "Phil"'
# Whitespace Sensitivity
- name: Interpolation - Surrounding Whitespace
desc: Interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: '| {{string}} |'
expected: '| --- |'
- name: Triple Mustache - Surrounding Whitespace
desc: Interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: '| {{{string}}} |'
expected: '| --- |'
- name: Ampersand - Surrounding Whitespace
desc: Interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: '| {{&string}} |'
expected: '| --- |'
- name: Interpolation - Standalone
desc: Standalone interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: " {{string}}\n"
expected: " ---\n"
- name: Triple Mustache - Standalone
desc: Standalone interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: " {{{string}}}\n"
expected: " ---\n"
- name: Ampersand - Standalone
desc: Standalone interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: " {{&string}}\n"
expected: " ---\n"
# Whitespace Insensitivity
- name: Interpolation With Padding
desc: Superfluous in-tag whitespace should be ignored.
data: { string: "---" }
template: '|{{ string }}|'
expected: '|---|'
- name: Triple Mustache With Padding
desc: Superfluous in-tag whitespace should be ignored.
data: { string: "---" }
template: '|{{{ string }}}|'
expected: '|---|'
- name: Ampersand With Padding
desc: Superfluous in-tag whitespace should be ignored.
data: { string: "---" }
template: '|{{& string }}|'
expected: '|---|'

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,193 @@
overview: |
Inverted Section tags and End Section tags are used in combination to wrap a
section of the template.
These tags' content MUST be a non-whitespace character sequence NOT
containing the current closing delimiter; each Inverted Section tag MUST be
followed by an End Section tag with the same content within the same
section.
This tag's content names the data to replace the tag. Name resolution is as
follows:
1) Split the name on periods; the first part is the name to resolve, any
remaining parts should be retained.
2) Walk the context stack from top to bottom, finding the first context
that is a) a hash containing the name as a key OR b) an object responding
to a method with the given name.
3) If the context is a hash, the data is the value associated with the
name.
4) If the context is an object and the method with the given name has an
arity of 1, the method SHOULD be called with a String containing the
unprocessed contents of the sections; the data is the value returned.
5) Otherwise, the data is the value returned by calling the method with
the given name.
6) If any name parts were retained in step 1, each should be resolved
against a context stack containing only the result from the former
resolution. If any part fails resolution, the result should be considered
falsey, and should interpolate as the empty string.
If the data is not of a list type, it is coerced into a list as follows: if
the data is truthy (e.g. `!!data == true`), use a single-element list
containing the data, otherwise use an empty list.
This section MUST NOT be rendered unless the data list is empty.
Inverted Section and End Section tags SHOULD be treated as standalone when
appropriate.
tests:
- name: Falsey
desc: Falsey sections should have their contents rendered.
data: { boolean: false }
template: '"{{^boolean}}This should be rendered.{{/boolean}}"'
expected: '"This should be rendered."'
- name: Truthy
desc: Truthy sections should have their contents omitted.
data: { boolean: true }
template: '"{{^boolean}}This should not be rendered.{{/boolean}}"'
expected: '""'
- name: Context
desc: Objects and hashes should behave like truthy values.
data: { context: { name: 'Joe' } }
template: '"{{^context}}Hi {{name}}.{{/context}}"'
expected: '""'
- name: List
desc: Lists should behave like truthy values.
data: { list: [ { n: 1 }, { n: 2 }, { n: 3 } ] }
template: '"{{^list}}{{n}}{{/list}}"'
expected: '""'
- name: Empty List
desc: Empty lists should behave like falsey values.
data: { list: [ ] }
template: '"{{^list}}Yay lists!{{/list}}"'
expected: '"Yay lists!"'
- name: Doubled
desc: Multiple inverted sections per template should be permitted.
data: { bool: false, two: 'second' }
template: |
{{^bool}}
* first
{{/bool}}
* {{two}}
{{^bool}}
* third
{{/bool}}
expected: |
* first
* second
* third
- name: Nested (Falsey)
desc: Nested falsey sections should have their contents rendered.
data: { bool: false }
template: "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |"
expected: "| A B C D E |"
- name: Nested (Truthy)
desc: Nested truthy sections should be omitted.
data: { bool: true }
template: "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |"
expected: "| A E |"
- name: Context Misses
desc: Failed context lookups should be considered falsey.
data: { }
template: "[{{^missing}}Cannot find key 'missing'!{{/missing}}]"
expected: "[Cannot find key 'missing'!]"
# Dotted Names
- name: Dotted Names - Truthy
desc: Dotted names should be valid for Inverted Section tags.
data: { a: { b: { c: true } } }
template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == ""'
expected: '"" == ""'
- name: Dotted Names - Falsey
desc: Dotted names should be valid for Inverted Section tags.
data: { a: { b: { c: false } } }
template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == "Not Here"'
expected: '"Not Here" == "Not Here"'
- name: Dotted Names - Broken Chains
desc: Dotted names that cannot be resolved should be considered falsey.
data: { a: { } }
template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == "Not Here"'
expected: '"Not Here" == "Not Here"'
# Whitespace Sensitivity
- name: Surrounding Whitespace
desc: Inverted sections should not alter surrounding whitespace.
data: { boolean: false }
template: " | {{^boolean}}\t|\t{{/boolean}} | \n"
expected: " | \t|\t | \n"
- name: Internal Whitespace
desc: Inverted should not alter internal whitespace.
data: { boolean: false }
template: " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n"
expected: " | \n | \n"
- name: Indented Inline Sections
desc: Single-line sections should not alter surrounding whitespace.
data: { boolean: false }
template: " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n"
expected: " NO\n WAY\n"
- name: Standalone Lines
desc: Standalone lines should be removed from the template.
data: { boolean: false }
template: |
| This Is
{{^boolean}}
|
{{/boolean}}
| A Line
expected: |
| This Is
|
| A Line
- name: Standalone Indented Lines
desc: Standalone indented lines should be removed from the template.
data: { boolean: false }
template: |
| This Is
{{^boolean}}
|
{{/boolean}}
| A Line
expected: |
| This Is
|
| A Line
- name: Standalone Line Endings
desc: '"\r\n" should be considered a newline for standalone tags.'
data: { boolean: false }
template: "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|"
expected: "|\r\n|"
- name: Standalone Without Previous Line
desc: Standalone tags should not require a newline to precede them.
data: { boolean: false }
template: " {{^boolean}}\n^{{/boolean}}\n/"
expected: "^\n/"
- name: Standalone Without Newline
desc: Standalone tags should not require a newline to follow them.
data: { boolean: false }
template: "^{{^boolean}}\n/\n {{/boolean}}"
expected: "^\n/\n"
# Whitespace Insensitivity
- name: Padding
desc: Superfluous in-tag whitespace should be ignored.
data: { boolean: false }
template: '|{{^ boolean }}={{/ boolean }}|'
expected: '|=|'

View File

@ -0,0 +1 @@
{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Partial tags are used to expand an external template into the current\ntemplate.\n\nThe tag's content MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter.\n\nThis tag's content names the partial to inject. Set Delimiter tags MUST NOT\naffect the parsing of a partial. The partial MUST be rendered against the\ncontext stack local to the tag. If the named partial cannot be found, the\nempty string SHOULD be used instead, as in interpolations.\n\nPartial tags SHOULD be treated as standalone when appropriate. If this tag\nis used standalone, any whitespace preceding the tag should treated as\nindentation, and prepended to each line of the partial before rendering.\n","tests":[{"name":"Basic Behavior","data":{},"expected":"\"from partial\"","template":"\"{{>text}}\"","desc":"The greater-than operator should expand to the named partial.","partials":{"text":"from partial"}},{"name":"Failed Lookup","data":{},"expected":"\"\"","template":"\"{{>text}}\"","desc":"The empty string should be used when the named partial is not found.","partials":{}},{"name":"Context","data":{"text":"content"},"expected":"\"*content*\"","template":"\"{{>partial}}\"","desc":"The greater-than operator should operate within the current context.","partials":{"partial":"*{{text}}*"}},{"name":"Recursion","data":{"content":"X","nodes":[{"content":"Y","nodes":[]}]},"expected":"X<Y<>>","template":"{{>node}}","desc":"The greater-than operator should properly recurse.","partials":{"node":"{{content}}<{{#nodes}}{{>node}}{{/nodes}}>"}},{"name":"Surrounding Whitespace","data":{},"expected":"| \t|\t |","template":"| {{>partial}} |","desc":"The greater-than operator should not alter surrounding whitespace.","partials":{"partial":"\t|\t"}},{"name":"Inline Indentation","data":{"data":"|"},"expected":" | >\n>\n","template":" {{data}} {{> partial}}\n","desc":"Whitespace should be left untouched.","partials":{"partial":">\n>"}},{"name":"Standalone Line Endings","data":{},"expected":"|\r\n>|","template":"|\r\n{{>partial}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags.","partials":{"partial":">"}},{"name":"Standalone Without Previous Line","data":{},"expected":" >\n >>","template":" {{>partial}}\n>","desc":"Standalone tags should not require a newline to precede them.","partials":{"partial":">\n>"}},{"name":"Standalone Without Newline","data":{},"expected":">\n >\n >","template":">\n {{>partial}}","desc":"Standalone tags should not require a newline to follow them.","partials":{"partial":">\n>"}},{"name":"Standalone Indentation","data":{"content":"<\n->"},"expected":"\\\n |\n <\n->\n |\n/\n","template":"\\\n {{>partial}}\n/\n","desc":"Each line of the partial should be indented before rendering.","partials":{"partial":"|\n{{{content}}}\n|\n"}},{"name":"Padding Whitespace","data":{"boolean":true},"expected":"|[]|","template":"|{{> partial }}|","desc":"Superfluous in-tag whitespace should be ignored.","partials":{"partial":"[]"}}]}

View File

@ -0,0 +1,109 @@
overview: |
Partial tags are used to expand an external template into the current
template.
The tag's content MUST be a non-whitespace character sequence NOT containing
the current closing delimiter.
This tag's content names the partial to inject. Set Delimiter tags MUST NOT
affect the parsing of a partial. The partial MUST be rendered against the
context stack local to the tag. If the named partial cannot be found, the
empty string SHOULD be used instead, as in interpolations.
Partial tags SHOULD be treated as standalone when appropriate. If this tag
is used standalone, any whitespace preceding the tag should treated as
indentation, and prepended to each line of the partial before rendering.
tests:
- name: Basic Behavior
desc: The greater-than operator should expand to the named partial.
data: { }
template: '"{{>text}}"'
partials: { text: 'from partial' }
expected: '"from partial"'
- name: Failed Lookup
desc: The empty string should be used when the named partial is not found.
data: { }
template: '"{{>text}}"'
partials: { }
expected: '""'
- name: Context
desc: The greater-than operator should operate within the current context.
data: { text: 'content' }
template: '"{{>partial}}"'
partials: { partial: '*{{text}}*' }
expected: '"*content*"'
- name: Recursion
desc: The greater-than operator should properly recurse.
data: { content: "X", nodes: [ { content: "Y", nodes: [] } ] }
template: '{{>node}}'
partials: { node: '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>' }
expected: 'X<Y<>>'
# Whitespace Sensitivity
- name: Surrounding Whitespace
desc: The greater-than operator should not alter surrounding whitespace.
data: { }
template: '| {{>partial}} |'
partials: { partial: "\t|\t" }
expected: "| \t|\t |"
- name: Inline Indentation
desc: Whitespace should be left untouched.
data: { data: '|' }
template: " {{data}} {{> partial}}\n"
partials: { partial: ">\n>" }
expected: " | >\n>\n"
- name: Standalone Line Endings
desc: '"\r\n" should be considered a newline for standalone tags.'
data: { }
template: "|\r\n{{>partial}}\r\n|"
partials: { partial: ">" }
expected: "|\r\n>|"
- name: Standalone Without Previous Line
desc: Standalone tags should not require a newline to precede them.
data: { }
template: " {{>partial}}\n>"
partials: { partial: ">\n>"}
expected: " >\n >>"
- name: Standalone Without Newline
desc: Standalone tags should not require a newline to follow them.
data: { }
template: ">\n {{>partial}}"
partials: { partial: ">\n>" }
expected: ">\n >\n >"
- name: Standalone Indentation
desc: Each line of the partial should be indented before rendering.
data: { content: "<\n->" }
template: |
\
{{>partial}}
/
partials:
partial: |
|
{{{content}}}
|
expected: |
\
|
<
->
|
/
# Whitespace Insensitivity
- name: Padding Whitespace
desc: Superfluous in-tag whitespace should be ignored.
data: { boolean: true }
template: "|{{> partial }}|"
partials: { partial: "[]" }
expected: '|[]|'

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,256 @@
overview: |
Section tags and End Section tags are used in combination to wrap a section
of the template for iteration
These tags' content MUST be a non-whitespace character sequence NOT
containing the current closing delimiter; each Section tag MUST be followed
by an End Section tag with the same content within the same section.
This tag's content names the data to replace the tag. Name resolution is as
follows:
1) Split the name on periods; the first part is the name to resolve, any
remaining parts should be retained.
2) Walk the context stack from top to bottom, finding the first context
that is a) a hash containing the name as a key OR b) an object responding
to a method with the given name.
3) If the context is a hash, the data is the value associated with the
name.
4) If the context is an object and the method with the given name has an
arity of 1, the method SHOULD be called with a String containing the
unprocessed contents of the sections; the data is the value returned.
5) Otherwise, the data is the value returned by calling the method with
the given name.
6) If any name parts were retained in step 1, each should be resolved
against a context stack containing only the result from the former
resolution. If any part fails resolution, the result should be considered
falsey, and should interpolate as the empty string.
If the data is not of a list type, it is coerced into a list as follows: if
the data is truthy (e.g. `!!data == true`), use a single-element list
containing the data, otherwise use an empty list.
For each element in the data list, the element MUST be pushed onto the
context stack, the section MUST be rendered, and the element MUST be popped
off the context stack.
Section and End Section tags SHOULD be treated as standalone when
appropriate.
tests:
- name: Truthy
desc: Truthy sections should have their contents rendered.
data: { boolean: true }
template: '"{{#boolean}}This should be rendered.{{/boolean}}"'
expected: '"This should be rendered."'
- name: Falsey
desc: Falsey sections should have their contents omitted.
data: { boolean: false }
template: '"{{#boolean}}This should not be rendered.{{/boolean}}"'
expected: '""'
- name: Context
desc: Objects and hashes should be pushed onto the context stack.
data: { context: { name: 'Joe' } }
template: '"{{#context}}Hi {{name}}.{{/context}}"'
expected: '"Hi Joe."'
- name: Deeply Nested Contexts
desc: All elements on the context stack should be accessible.
data:
a: { one: 1 }
b: { two: 2 }
c: { three: 3 }
d: { four: 4 }
e: { five: 5 }
template: |
{{#a}}
{{one}}
{{#b}}
{{one}}{{two}}{{one}}
{{#c}}
{{one}}{{two}}{{three}}{{two}}{{one}}
{{#d}}
{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}
{{#e}}
{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}
{{/e}}
{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}
{{/d}}
{{one}}{{two}}{{three}}{{two}}{{one}}
{{/c}}
{{one}}{{two}}{{one}}
{{/b}}
{{one}}
{{/a}}
expected: |
1
121
12321
1234321
123454321
1234321
12321
121
1
- name: List
desc: Lists should be iterated; list items should visit the context stack.
data: { list: [ { item: 1 }, { item: 2 }, { item: 3 } ] }
template: '"{{#list}}{{item}}{{/list}}"'
expected: '"123"'
- name: Empty List
desc: Empty lists should behave like falsey values.
data: { list: [ ] }
template: '"{{#list}}Yay lists!{{/list}}"'
expected: '""'
- name: Doubled
desc: Multiple sections per template should be permitted.
data: { bool: true, two: 'second' }
template: |
{{#bool}}
* first
{{/bool}}
* {{two}}
{{#bool}}
* third
{{/bool}}
expected: |
* first
* second
* third
- name: Nested (Truthy)
desc: Nested truthy sections should have their contents rendered.
data: { bool: true }
template: "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |"
expected: "| A B C D E |"
- name: Nested (Falsey)
desc: Nested falsey sections should be omitted.
data: { bool: false }
template: "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |"
expected: "| A E |"
- name: Context Misses
desc: Failed context lookups should be considered falsey.
data: { }
template: "[{{#missing}}Found key 'missing'!{{/missing}}]"
expected: "[]"
# Implicit Iterators
- name: Implicit Iterator - String
desc: Implicit iterators should directly interpolate strings.
data:
list: [ 'a', 'b', 'c', 'd', 'e' ]
template: '"{{#list}}({{.}}){{/list}}"'
expected: '"(a)(b)(c)(d)(e)"'
- name: Implicit Iterator - Integer
desc: Implicit iterators should cast integers to strings and interpolate.
data:
list: [ 1, 2, 3, 4, 5 ]
template: '"{{#list}}({{.}}){{/list}}"'
expected: '"(1)(2)(3)(4)(5)"'
- name: Implicit Iterator - Decimal
desc: Implicit iterators should cast decimals to strings and interpolate.
data:
list: [ 1.10, 2.20, 3.30, 4.40, 5.50 ]
template: '"{{#list}}({{.}}){{/list}}"'
expected: '"(1.1)(2.2)(3.3)(4.4)(5.5)"'
# Dotted Names
- name: Dotted Names - Truthy
desc: Dotted names should be valid for Section tags.
data: { a: { b: { c: true } } }
template: '"{{#a.b.c}}Here{{/a.b.c}}" == "Here"'
expected: '"Here" == "Here"'
- name: Dotted Names - Falsey
desc: Dotted names should be valid for Section tags.
data: { a: { b: { c: false } } }
template: '"{{#a.b.c}}Here{{/a.b.c}}" == ""'
expected: '"" == ""'
- name: Dotted Names - Broken Chains
desc: Dotted names that cannot be resolved should be considered falsey.
data: { a: { } }
template: '"{{#a.b.c}}Here{{/a.b.c}}" == ""'
expected: '"" == ""'
# Whitespace Sensitivity
- name: Surrounding Whitespace
desc: Sections should not alter surrounding whitespace.
data: { boolean: true }
template: " | {{#boolean}}\t|\t{{/boolean}} | \n"
expected: " | \t|\t | \n"
- name: Internal Whitespace
desc: Sections should not alter internal whitespace.
data: { boolean: true }
template: " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n"
expected: " | \n | \n"
- name: Indented Inline Sections
desc: Single-line sections should not alter surrounding whitespace.
data: { boolean: true }
template: " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n"
expected: " YES\n GOOD\n"
- name: Standalone Lines
desc: Standalone lines should be removed from the template.
data: { boolean: true }
template: |
| This Is
{{#boolean}}
|
{{/boolean}}
| A Line
expected: |
| This Is
|
| A Line
- name: Indented Standalone Lines
desc: Indented standalone lines should be removed from the template.
data: { boolean: true }
template: |
| This Is
{{#boolean}}
|
{{/boolean}}
| A Line
expected: |
| This Is
|
| A Line
- name: Standalone Line Endings
desc: '"\r\n" should be considered a newline for standalone tags.'
data: { boolean: true }
template: "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|"
expected: "|\r\n|"
- name: Standalone Without Previous Line
desc: Standalone tags should not require a newline to precede them.
data: { boolean: true }
template: " {{#boolean}}\n#{{/boolean}}\n/"
expected: "#\n/"
- name: Standalone Without Newline
desc: Standalone tags should not require a newline to follow them.
data: { boolean: true }
template: "#{{#boolean}}\n/\n {{/boolean}}"
expected: "#\n/\n"
# Whitespace Insensitivity
- name: Padding
desc: Superfluous in-tag whitespace should be ignored.
data: { boolean: true }
template: '|{{# boolean }}={{/ boolean }}|'
expected: '|=|'

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,149 @@
overview: |
Lambdas are a special-cased data type for use in interpolations and
sections.
When used as the data value for an Interpolation tag, the lambda MUST be
treatable as an arity 0 function, and invoked as such. The returned value
MUST be rendered against the default delimiters, then interpolated in place
of the lambda.
When used as the data value for a Section tag, the lambda MUST be treatable
as an arity 1 function, and invoked as such (passing a String containing the
unprocessed section contents). The returned value MUST be rendered against
the current delimiters, then interpolated in place of the section.
tests:
- name: Interpolation
desc: A lambda's return value should be interpolated.
data:
lambda: !code
ruby: 'proc { "world" }'
perl: 'sub { "world" }'
js: 'function() { return "world" }'
php: 'return "world";'
python: 'lambda: "world"'
clojure: '(fn [] "world")'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
- name: Interpolation - Expansion
desc: A lambda's return value should be parsed.
data:
planet: "world"
lambda: !code
ruby: 'proc { "{{planet}}" }'
perl: 'sub { "{{planet}}" }'
js: 'function() { return "{{planet}}" }'
php: 'return "{{planet}}";'
python: 'lambda: "{{planet}}"'
clojure: '(fn [] "{{planet}}")'
template: "Hello, {{lambda}}!"
expected: "Hello, world!"
- name: Interpolation - Alternate Delimiters
desc: A lambda's return value should parse with the default delimiters.
data:
planet: "world"
lambda: !code
ruby: 'proc { "|planet| => {{planet}}" }'
perl: 'sub { "|planet| => {{planet}}" }'
js: 'function() { return "|planet| => {{planet}}" }'
php: 'return "|planet| => {{planet}}";'
python: 'lambda: "|planet| => {{planet}}"'
clojure: '(fn [] "|planet| => {{planet}}")'
template: "{{= | | =}}\nHello, (|&lambda|)!"
expected: "Hello, (|planet| => world)!"
- name: Interpolation - Multiple Calls
desc: Interpolated lambdas should not be cached.
data:
lambda: !code
ruby: 'proc { $calls ||= 0; $calls += 1 }'
perl: 'sub { no strict; $calls += 1 }'
js: 'function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }'
php: 'global $calls; return ++$calls;'
python: 'lambda: globals().update(calls=globals().get("calls",0)+1) or calls'
clojure: '(def g (atom 0)) (fn [] (swap! g inc))'
template: '{{lambda}} == {{{lambda}}} == {{lambda}}'
expected: '1 == 2 == 3'
- name: Escaping
desc: Lambda results should be appropriately escaped.
data:
lambda: !code
ruby: 'proc { ">" }'
perl: 'sub { ">" }'
js: 'function() { return ">" }'
php: 'return ">";'
python: 'lambda: ">"'
clojure: '(fn [] ">")'
template: "<{{lambda}}{{{lambda}}}"
expected: "<&gt;>"
- name: Section
desc: Lambdas used for sections should receive the raw section string.
data:
x: 'Error!'
lambda: !code
ruby: 'proc { |text| text == "{{x}}" ? "yes" : "no" }'
perl: 'sub { $_[0] eq "{{x}}" ? "yes" : "no" }'
js: 'function(txt) { return (txt == "{{x}}" ? "yes" : "no") }'
php: 'return ($text == "{{x}}") ? "yes" : "no";'
python: 'lambda text: text == "{{x}}" and "yes" or "no"'
clojure: '(fn [text] (if (= text "{{x}}") "yes" "no"))'
template: "<{{#lambda}}{{x}}{{/lambda}}>"
expected: "<yes>"
- name: Section - Expansion
desc: Lambdas used for sections should have their results parsed.
data:
planet: "Earth"
lambda: !code
ruby: 'proc { |text| "#{text}{{planet}}#{text}" }'
perl: 'sub { $_[0] . "{{planet}}" . $_[0] }'
js: 'function(txt) { return txt + "{{planet}}" + txt }'
php: 'return $text . "{{planet}}" . $text;'
python: 'lambda text: "%s{{planet}}%s" % (text, text)'
clojure: '(fn [text] (str text "{{planet}}" text))'
template: "<{{#lambda}}-{{/lambda}}>"
expected: "<-Earth->"
- name: Section - Alternate Delimiters
desc: Lambdas used for sections should parse with the current delimiters.
data:
planet: "Earth"
lambda: !code
ruby: 'proc { |text| "#{text}{{planet}} => |planet|#{text}" }'
perl: 'sub { $_[0] . "{{planet}} => |planet|" . $_[0] }'
js: 'function(txt) { return txt + "{{planet}} => |planet|" + txt }'
php: 'return $text . "{{planet}} => |planet|" . $text;'
python: 'lambda text: "%s{{planet}} => |planet|%s" % (text, text)'
clojure: '(fn [text] (str text "{{planet}} => |planet|" text))'
template: "{{= | | =}}<|#lambda|-|/lambda|>"
expected: "<-{{planet}} => Earth->"
- name: Section - Multiple Calls
desc: Lambdas used for sections should not be cached.
data:
lambda: !code
ruby: 'proc { |text| "__#{text}__" }'
perl: 'sub { "__" . $_[0] . "__" }'
js: 'function(txt) { return "__" + txt + "__" }'
php: 'return "__" . $text . "__";'
python: 'lambda text: "__%s__" % (text)'
clojure: '(fn [text] (str "__" text "__"))'
template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}'
expected: '__FILE__ != __LINE__'
- name: Inverted Section
desc: Lambdas used for inverted sections should be considered truthy.
data:
static: 'static'
lambda: !code
ruby: 'proc { |text| false }'
perl: 'sub { 0 }'
js: 'function(txt) { return false }'
php: 'return false;'
python: 'lambda text: 0'
clojure: '(fn [text] false)'
template: "<{{^lambda}}{{static}}{{/lambda}}>"
expected: "<>"

View File

@ -0,0 +1,8 @@
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>

74
docs/build/node_modules/hogan.js/tools/release.js generated vendored Normal file
View File

@ -0,0 +1,74 @@
/*
* 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.
*/
var fs = require('fs');
var path = require('path');
var Hogan = require(__dirname + '/../lib/hogan');
var minlicense = '/**\n* @preserve Copyright 2012 Twitter, Inc.\n* @license http://www.apache.org/licenses/LICENSE-2.0.txt\n*/\n';
function read(path) {
return fs.readFileSync(path).toString()
}
// Good enough for little js files
function copy(src, dst) {
return fs.writeFileSync(dst, read(src));
}
function uglify(src, dst) {
var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
var orig_code = read(src);
var ast = jsp.parse(orig_code); // parse code and get the initial AST
ast = pro.ast_mangle(ast); // get a new AST with mangled names
ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
fs.writeFileSync(dst, minlicense + pro.gen_code(ast));
}
var packageJSON = JSON.parse(read('package.json'));
var version = packageJSON.version.substring(0, packageJSON.version.indexOf('-'));
function removeFirstComment(text) {
return text.substring(text.indexOf('*/') + 2);
}
var context = {
template: removeFirstComment(read(__dirname + '/../lib/template.js')),
compiler: removeFirstComment(read(__dirname + '/../lib/compiler.js'))
};
var wrapperPath = '/../wrappers/';
var wrappers = fs.readdirSync(__dirname + wrapperPath).map(function(f) {
return __dirname + wrapperPath + f;
});
var distPath = __dirname + '/../dist/';
wrappers.forEach(function(wrapper) {
var tail = path.basename(wrapper, '.mustache');
var target = distPath + 'hogan-' + version + '.' + tail;
var uglified = distPath + 'hogan-' + version + '.min.' + tail;
fs.writeFileSync(target, Hogan.compile(read(wrapper)).render(context));
uglify(target, uglified);
});
// Also release Hogan.Template on its own.
var templateTarget = distPath + 'template-' + version + '.js';
fs.writeFileSync(templateTarget, read(__dirname + '/../lib/template.js'));
uglify(templateTarget, distPath + 'template-' + version + '.min.js');
// Add packageJSON to node distribution
packageJSON.version = version;
fs.writeFileSync(__dirname + '/../dist/nodejs/package.json',
JSON.stringify(packageJSON, null, " "));

View File

@ -0,0 +1,32 @@
/*
* 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.
*/
var Hogan = require(__dirname + '/../lib/hogan.js');
var fs = require('fs');
var path = require('path');
// Substitute variables in the homepage with values from package.json
var homeTemplatePath = __dirname + '/../build/gh-pages/index.html.mustache';
var contextPath = __dirname + '/../dist/nodejs/package.json';
var homepage = fs.readFileSync(homeTemplatePath).toString();
var context = JSON.parse(fs.readFileSync(contextPath).toString());
var template = Hogan.compile(homepage);
fs.writeFileSync(path.dirname(homeTemplatePath) + '/index.html',
template.render(context));
fs.unlinkSync(homeTemplatePath);

500
docs/build/node_modules/hogan.js/web/1.0.0/hogan.js generated vendored Normal file
View File

@ -0,0 +1,500 @@
/*
* 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.
*/
var HoganTemplate = (function () {
function constructor(text) {
this.text = text;
};
constructor.prototype = {
// render: replaced by generated code.
r: function (context, partials) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials) {
return this.r(context, partials);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
return partial.render(context, partials);
},
// render a section
rs: function(context, partials, section) {
var buf = '';
var tail = context[context.length - 1];
if (!isArray(tail)) {
buf = section(context, partials);
return buf;
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end) {
if (isArray(val) && val.length === 0) {
return false;
}
if (!inverted && typeof val == 'function') {
val = this.ls(val, ctx, partials, start, end);
}
var pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
var names = key.split('.');
var val = this.f(names[0], ctx, partials, returnFound);
var cx = null;
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false;
var v = null;
var found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text) {
var t = val.call(cx, text, function(t) {
return Hogan.compile(t).render(cx);
});
var s = Hogan.compile(t.toString()).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, start, end) {
var cx = ctx[ctx.length - 1];
if (val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end));
}
var t = val.call(cx);
if (typeof t == 'function') {
return this.ho(t, cx, partials, this.text.substring(start, end));
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
return Hogan.compile(val.call(cx).toString()).render(cx, partials);
}
};
var rAmp = /&/g, rLt = /</g, rGt = />/g, rApos =/\'/g,
rQuot = /\"/g, hChars =/[&<>\"\']/;
function hoganEscape(str) {
var s = String(str === null ? '' : str);
return hChars.test(s) ? s.replace(rAmp,'&amp;')
.replace(rLt,'&lt;').replace(rGt,'&gt;')
.replace(rApos,'&#39;').replace(rQuot, '&quot;') : s;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
}
return constructor;
})();
var Hogan = (function () {
function scan(text) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) == null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart; j < tokens.length; j++) {
if (!tokens[j].tag) {
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'})
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag;
var closeIndex = text.indexOf(close, index);
var delimiters = trim(text.substring(text.indexOf('=', index) + 1,
closeIndex)).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text[i] == '\n') {
filterLine(seenTag);
} else {
buf += text[i];
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
var tag = tagTypes[text[i + 1]];
tagType = tag ? text[i + 1] : '_v';
seenTag = i;
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
} else {
if (tagChange(ctag, text, i)) {
i += ctag.length - 1;
tokens.push({tag: tagType, n: trim(buf),
i: (tagType == '/') ? seenTag - 1 : i + 1});
buf = '';
state = IN_TEXT;
if (tagType == '{') {
i++;
}
} else {
buf += text[i];
}
}
}
filterLine(seenTag, true);
return tokens;
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/;
var tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
function tagChange(tag, text, index) {
if (text[index] != tag[0]) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text[index + i] != tag[i]) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' ||
isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length == 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function generate(tree, text, options) {
var code = 'var c = [cx];var b = "";var _ = this;' +
walk(tree) + 'return b;';
if (options.asString) {
return 'function(cx,p){' + code + ';};';
}
var template = new HoganTemplate(text);
template.r = new Function('cx', 'p', code);
return template;
}
var rQuot = /\"/g, rNewline = /\n/g, rCr = /\r/g, rSlash = /\\/g;
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r')
};
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i].n);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('\n');
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text(tree[i]);
}
}
return code;
}
function section(nodes, id, method, start, end) {
var code = 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),';
code += 'c,p,0,' + start + ',' + end + ')){';
code += 'b += _.rs(c,p,';
code += 'function(c,p){ var b = "";';
code += walk(nodes);
code += 'return b;});c.pop();}';
code += 'else{b += _.b; _.b = ""};';
return code;
}
function invertedSection(nodes, id, method) {
var code = 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0)){';
code += walk(nodes);
code += '};';
return code;
}
function partial(id) {
return 'b += _.rp("' + esc(id) + '",c[c.length - 1],p);';
}
function tripleStache(id, method) {
return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
}
function variable(id, method) {
return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return 'b += "' + esc(id) + '";';
}
return ({
scan: scan,
parse: function(tokens, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
cache: {},
compile: function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
options = options || {};
var t = this.cache[text];
if (t) {
return t;
}
t = generate(this.parse(scan(text), options), text, options);
return this.cache[text] = t;
}
});
})();
// Export the hogan constructor for Node.js and CommonJS.
if (typeof module !== 'undefined' && module.exports) {
module.exports = Hogan;
module.exports.Template = HoganTemplate;
} else if (typeof exports !== 'undefined') {
exports.Hogan = Hogan;
exports.HoganTemplate = HoganTemplate;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,500 @@
/*
* 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.
*/
var HoganTemplate = (function () {
function constructor(text) {
this.text = text;
};
constructor.prototype = {
// render: replaced by generated code.
r: function (context, partials) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials) {
return this.r(context, partials);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
return partial.render(context, partials);
},
// render a section
rs: function(context, partials, section) {
var buf = '';
var tail = context[context.length - 1];
if (!isArray(tail)) {
buf = section(context, partials);
return buf;
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end) {
if (isArray(val) && val.length === 0) {
return false;
}
if (!inverted && typeof val == 'function') {
val = this.ls(val, ctx, partials, start, end);
}
var pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
var names = key.split('.');
var val = this.f(names[0], ctx, partials, returnFound);
var cx = null;
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false;
var v = null;
var found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text) {
var t = val.call(cx, text, function(t) {
return Hogan.compile(t).render(cx);
});
var s = Hogan.compile(t.toString()).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, start, end) {
var cx = ctx[ctx.length - 1];
if (val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end));
}
var t = val.call(cx);
if (typeof t == 'function') {
return this.ho(t, cx, partials, this.text.substring(start, end));
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
return Hogan.compile(val.call(cx).toString()).render(cx, partials);
}
};
var rAmp = /&/g, rLt = /</g, rGt = />/g, rApos =/\'/g,
rQuot = /\"/g, hChars =/[&<>\"\']/;
function hoganEscape(str) {
var s = String(str === null ? '' : str);
return hChars.test(s) ? s.replace(rAmp,'&amp;')
.replace(rLt,'&lt;').replace(rGt,'&gt;')
.replace(rApos,'&#39;').replace(rQuot, '&quot;') : s;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
}
return constructor;
})();
var Hogan = (function () {
function scan(text) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) == null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart; j < tokens.length; j++) {
if (!tokens[j].tag) {
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'})
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag;
var closeIndex = text.indexOf(close, index);
var delimiters = trim(text.substring(text.indexOf('=', index) + 1,
closeIndex)).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text[i] == '\n') {
filterLine(seenTag);
} else {
buf += text[i];
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
var tag = tagTypes[text[i + 1]];
tagType = tag ? text[i + 1] : '_v';
seenTag = i;
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
} else {
if (tagChange(ctag, text, i)) {
i += ctag.length - 1;
tokens.push({tag: tagType, n: trim(buf),
i: (tagType == '/') ? seenTag - 1 : i + 1});
buf = '';
state = IN_TEXT;
if (tagType == '{') {
i++;
}
} else {
buf += text[i];
}
}
}
filterLine(seenTag, true);
return tokens;
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/;
var tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
function tagChange(tag, text, index) {
if (text[index] != tag[0]) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text[index + i] != tag[i]) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' ||
isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length == 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function generate(tree, text, options) {
var code = 'var c = [cx];var b = "";var _ = this;' +
walk(tree) + 'return b;';
if (options.asString) {
return 'function(cx,p){' + code + ';};';
}
var template = new HoganTemplate(text);
template.r = new Function('cx', 'p', code);
return template;
}
var rQuot = /\"/g, rNewline = /\n/g, rCr = /\r/g, rSlash = /\\/g;
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r')
};
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i].n);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('\n');
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text(tree[i]);
}
}
return code;
}
function section(nodes, id, method, start, end) {
var code = 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),';
code += 'c,p,0,' + start + ',' + end + ')){';
code += 'b += _.rs(c,p,';
code += 'function(c,p){ var b = "";';
code += walk(nodes);
code += 'return b;});c.pop();}';
code += 'else{b += _.b; _.b = ""};';
return code;
}
function invertedSection(nodes, id, method) {
var code = 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0)){';
code += walk(nodes);
code += '};';
return code;
}
function partial(id) {
return 'b += _.rp("' + esc(id) + '",c[c.length - 1],p);';
}
function tripleStache(id, method) {
return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
}
function variable(id, method) {
return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return 'b += "' + esc(id) + '";';
}
return ({
scan: scan,
parse: function(tokens, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
cache: {},
compile: function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
options = options || {};
var t = this.cache[text];
if (t) {
return t;
}
t = generate(this.parse(scan(text), options), text, options);
return this.cache[text] = t;
}
});
})();
// Export the hogan constructor for Node.js and CommonJS.
if (typeof module !== 'undefined' && module.exports) {
module.exports = Hogan;
module.exports.Template = HoganTemplate;
} else if (typeof exports !== 'undefined') {
exports.Hogan = Hogan;
exports.HoganTemplate = HoganTemplate;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,545 @@
/*
* 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.
*/
var HoganTemplate = (function () {
function constructor(text) {
this.text = text;
}
constructor.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
return partial.r(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var buf = '',
tail = context[context.length - 1];
if (!isArray(tail)) {
return buf = section(context, partials);
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (!inverted && typeof val == 'function') {
val = this.ls(val, ctx, partials, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var t = val.call(cx, text, function(t) {
return Hogan.compile(t, {delimiters: tags}).render(cx, partials);
});
var s = Hogan.compile(t.toString(), {delimiters: tags}).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = val.call(cx);
if (val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
if (typeof t == 'function') {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
return Hogan.compile(val.call(cx).toString()).render(cx, partials);
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function hoganEscape(str) {
str = String(str === null ? '' : str);
return hChars.test(str) ?
str
.replace(rAmp,'&amp;')
.replace(rLt,'&lt;')
.replace(rGt,'&gt;')
.replace(rApos,'&#39;')
.replace(rQuot, '&quot;') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
return constructor;
})();
var Hogan = (function () {
// Setup regex assignments
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/,
rQuot = /\"/g,
rNewline = /\n/g,
rCr = /\r/g,
rSlash = /\\/g,
tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
function scan(text, delimiters) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
tag = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart, next; j < tokens.length; j++) {
if (!tokens[j].tag) {
if ((next = tokens[j+1]) && next.tag == '>') {
// set indent to token value
next.indent = tokens[j].toString()
}
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'});
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag,
closeIndex = text.indexOf(close, index),
delimiters = trim(
text.substring(text.indexOf('=', index) + 1, closeIndex)
).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
if (delimiters) {
delimiters = delimiters.split(' ');
otag = delimiters[0];
ctag = delimiters[1];
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text.charAt(i) == '\n') {
filterLine(seenTag);
} else {
buf += text.charAt(i);
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
tag = tagTypes[text.charAt(i + 1)];
tagType = tag ? text.charAt(i + 1) : '_v';
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
seenTag = i;
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
if (tagType == '{') {
i++;
}
} else {
buf += text.charAt(i);
}
}
}
filterLine(seenTag, true);
return tokens;
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
function tagChange(tag, text, index) {
if (text.charAt(index) != tag.charAt(0)) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text.charAt(index + i) != tag.charAt(i)) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length === 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function generate(tree, text, options) {
var code = 'i = i || "";var c = [cx];var b = i + "";var _ = this;'
+ walk(tree)
+ 'return b;';
if (options.asString) {
return 'function(cx,p,i){' + code + ';}';
}
var template = new HoganTemplate(text);
template.r = new Function('cx', 'p', 'i', code);
return template;
}
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r');
}
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i]);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text('"' + esc(tree[i]) + '"');
}
}
return code;
}
function section(nodes, id, method, start, end, tags) {
return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
'c,p,0,' + start + ',' + end + ', "' + tags + '")){' +
'b += _.rs(c,p,' +
'function(c,p){ var b = "";' +
walk(nodes) +
'return b;});c.pop();}' +
'else{b += _.b; _.b = ""};';
}
function invertedSection(nodes, id, method) {
return 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
walk(nodes) +
'};';
}
function partial(tok) {
return 'b += _.rp("' + esc(tok.n) + '",c[c.length - 1],p,"' + (tok.indent || '') + '");';
}
function tripleStache(id, method) {
return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
}
function variable(id, method) {
return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return 'b += ' + id + ';';
}
return ({
scan: scan,
parse: function(tokens, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
cache: {},
compile: function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options = options || {};
var t = this.cache[text];
if (t) {
return t;
}
t = generate(this.parse(scan(text, options.delimiters), options), text, options);
return this.cache[text] = t;
}
});
})();
// Export the hogan constructor for Node.js and CommonJS.
if (typeof module !== 'undefined' && module.exports) {
module.exports = Hogan;
module.exports.Template = HoganTemplate;
} else if (typeof define === 'function' && define.amd) {
define(function () { return Hogan; });
} else if (typeof exports !== 'undefined') {
exports.Hogan = Hogan;
exports.HoganTemplate = HoganTemplate;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,576 @@
/*
* 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.
*/
var Hogan = {};
(function (Hogan) {
Hogan.Template = function constructor(renderFunc, text, compiler) {
if (renderFunc) {
this.r = renderFunc;
}
this.c = compiler;
this.text = text || '';
}
Hogan.Template.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials, indent) {
return this.ri([context], partials || {}, indent);
},
// render internal -- a hook for overrides that catches partials too
ri: function (context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
if (this.c && typeof partial == 'string') {
partial = this.c.compile(partial);
}
return partial.ri(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var buf = '',
tail = context[context.length - 1];
if (!isArray(tail)) {
return buf = section(context, partials);
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (typeof val == 'function') {
val = this.ls(val, ctx, partials, inverted, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var compiler = this.c;
var t = val.call(cx, text, function(t) {
return compiler.compile(t, {delimiters: tags}).render(cx, partials);
});
var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, inverted, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = null;
if (!inverted && this.c && val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
t = val.call(cx);
if (typeof t == 'function') {
if (inverted) {
return true;
} else if (this.c) {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
var result = val.call(cx);
if (typeof result == 'function') {
result = result.call(cx);
}
result = result.toString();
if (this.c && ~result.indexOf("{{")) {
return this.c.compile(result).render(cx, partials);
}
return result;
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function hoganEscape(str) {
str = String((str === null || str === undefined) ? '' : str);
return hChars.test(str) ?
str
.replace(rAmp,'&amp;')
.replace(rLt,'&lt;')
.replace(rGt,'&gt;')
.replace(rApos,'&#39;')
.replace(rQuot, '&quot;') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
})(typeof exports !== 'undefined' ? exports : Hogan);
(function (Hogan) {
// Setup regex assignments
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/,
rQuot = /\"/g,
rNewline = /\n/g,
rCr = /\r/g,
rSlash = /\\/g,
tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
Hogan.scan = function scan(text, delimiters) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
tag = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart, next; j < tokens.length; j++) {
if (!tokens[j].tag) {
if ((next = tokens[j+1]) && next.tag == '>') {
// set indent to token value
next.indent = tokens[j].toString()
}
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'});
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag,
closeIndex = text.indexOf(close, index),
delimiters = trim(
text.substring(text.indexOf('=', index) + 1, closeIndex)
).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
if (delimiters) {
delimiters = delimiters.split(' ');
otag = delimiters[0];
ctag = delimiters[1];
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text.charAt(i) == '\n') {
filterLine(seenTag);
} else {
buf += text.charAt(i);
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
tag = tagTypes[text.charAt(i + 1)];
tagType = tag ? text.charAt(i + 1) : '_v';
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
seenTag = i;
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
if (tagType == '{') {
if (ctag == '}}') {
i++;
} else {
cleanTripleStache(tokens[tokens.length - 1]);
}
}
} else {
buf += text.charAt(i);
}
}
}
filterLine(seenTag, true);
return tokens;
}
function cleanTripleStache(token) {
if (token.n.substr(token.n.length - 1) === '}') {
token.n = token.n.substring(0, token.n.length - 1);
}
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
function tagChange(tag, text, index) {
if (text.charAt(index) != tag.charAt(0)) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text.charAt(index + i) != tag.charAt(i)) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length === 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function writeCode(tree) {
return 'i = i || "";var b = i + "";var _ = this;' + walk(tree) + 'return b;';
}
Hogan.generate = function (code, text, options) {
if (options.asString) {
return 'function(c,p,i){' + code + ';}';
}
return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan);
}
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r');
}
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i]);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text('"' + esc(tree[i]) + '"');
}
}
return code;
}
function section(nodes, id, method, start, end, tags) {
return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
'c,p,0,' + start + ',' + end + ', "' + tags + '")){' +
'b += _.rs(c,p,' +
'function(c,p){ var b = "";' +
walk(nodes) +
'return b;});c.pop();}' +
'else{b += _.b; _.b = ""};';
}
function invertedSection(nodes, id, method) {
return 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
walk(nodes) +
'};';
}
function partial(tok) {
return 'b += _.rp("' + esc(tok.n) + '",c,p,"' + (tok.indent || '') + '");';
}
function tripleStache(id, method) {
return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
}
function variable(id, method) {
return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return 'b += ' + id + ';';
}
Hogan.parse = function(tokens, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
Hogan.cache = {};
Hogan.compile = function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options = options || {};
var key = text + '||' + !!options.asString;
var t = this.cache[key];
if (t) {
return t;
}
t = this.generate(writeCode(this.parse(this.scan(text, options.delimiters), options)), text, options);
return this.cache[key] = t;
};
})(typeof exports !== 'undefined' ? exports : Hogan);
if (typeof define === 'function' && define.amd) {
define(Hogan);
}

View File

@ -0,0 +1,576 @@
/*
* 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.
*/
var Hogan = {};
(function (Hogan) {
Hogan.Template = function constructor(renderFunc, text, compiler) {
if (renderFunc) {
this.r = renderFunc;
}
this.c = compiler;
this.text = text || '';
}
Hogan.Template.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials, indent) {
return this.ri([context], partials || {}, indent);
},
// render internal -- a hook for overrides that catches partials too
ri: function (context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
if (this.c && typeof partial == 'string') {
partial = this.c.compile(partial);
}
return partial.ri(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var buf = '',
tail = context[context.length - 1];
if (!isArray(tail)) {
return buf = section(context, partials);
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (typeof val == 'function') {
val = this.ls(val, ctx, partials, inverted, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var compiler = this.c;
var t = val.call(cx, text, function(t) {
return compiler.compile(t, {delimiters: tags}).render(cx, partials);
});
var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, inverted, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = null;
if (!inverted && this.c && val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
t = val.call(cx);
if (typeof t == 'function') {
if (inverted) {
return true;
} else if (this.c) {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
var result = val.call(cx);
if (typeof result == 'function') {
result = result.call(cx);
}
result = result.toString();
if (this.c && ~result.indexOf("{{")) {
return this.c.compile(result).render(cx, partials);
}
return result;
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function hoganEscape(str) {
str = String((str === null || str === undefined) ? '' : str);
return hChars.test(str) ?
str
.replace(rAmp,'&amp;')
.replace(rLt,'&lt;')
.replace(rGt,'&gt;')
.replace(rApos,'&#39;')
.replace(rQuot, '&quot;') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
})(typeof exports !== 'undefined' ? exports : Hogan);
(function (Hogan) {
// Setup regex assignments
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/,
rQuot = /\"/g,
rNewline = /\n/g,
rCr = /\r/g,
rSlash = /\\/g,
tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
Hogan.scan = function scan(text, delimiters) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
tag = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart, next; j < tokens.length; j++) {
if (!tokens[j].tag) {
if ((next = tokens[j+1]) && next.tag == '>') {
// set indent to token value
next.indent = tokens[j].toString()
}
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'});
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag,
closeIndex = text.indexOf(close, index),
delimiters = trim(
text.substring(text.indexOf('=', index) + 1, closeIndex)
).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
if (delimiters) {
delimiters = delimiters.split(' ');
otag = delimiters[0];
ctag = delimiters[1];
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text.charAt(i) == '\n') {
filterLine(seenTag);
} else {
buf += text.charAt(i);
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
tag = tagTypes[text.charAt(i + 1)];
tagType = tag ? text.charAt(i + 1) : '_v';
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
seenTag = i;
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
if (tagType == '{') {
if (ctag == '}}') {
i++;
} else {
cleanTripleStache(tokens[tokens.length - 1]);
}
}
} else {
buf += text.charAt(i);
}
}
}
filterLine(seenTag, true);
return tokens;
}
function cleanTripleStache(token) {
if (token.n.substr(token.n.length - 1) === '}') {
token.n = token.n.substring(0, token.n.length - 1);
}
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
function tagChange(tag, text, index) {
if (text.charAt(index) != tag.charAt(0)) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text.charAt(index + i) != tag.charAt(i)) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length === 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function writeCode(tree) {
return 'i = i || "";var b = i + "";var _ = this;' + walk(tree) + 'return b;';
}
Hogan.generate = function (code, text, options) {
if (options.asString) {
return 'function(c,p,i){' + code + ';}';
}
return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan);
}
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r');
}
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i]);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text('"' + esc(tree[i]) + '"');
}
}
return code;
}
function section(nodes, id, method, start, end, tags) {
return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
'c,p,0,' + start + ',' + end + ', "' + tags + '")){' +
'b += _.rs(c,p,' +
'function(c,p){ var b = "";' +
walk(nodes) +
'return b;});c.pop();}' +
'else{b += _.b; _.b = ""};';
}
function invertedSection(nodes, id, method) {
return 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
walk(nodes) +
'};';
}
function partial(tok) {
return 'b += _.rp("' + esc(tok.n) + '",c,p,"' + (tok.indent || '') + '");';
}
function tripleStache(id, method) {
return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
}
function variable(id, method) {
return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return 'b += ' + id + ';';
}
Hogan.parse = function(tokens, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
Hogan.cache = {};
Hogan.compile = function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options = options || {};
var key = text + '||' + !!options.asString;
var t = this.cache[key];
if (t) {
return t;
}
t = this.generate(writeCode(this.parse(this.scan(text, options.delimiters), options)), text, options);
return this.cache[key] = t;
};
})(typeof exports !== 'undefined' ? exports : Hogan);
if (typeof module !== 'undefined' && module.exports) {
module.exports = Hogan;
}

View File

@ -0,0 +1,572 @@
/*
* 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.
*/
var Hogan = {};
(function (Hogan) {
Hogan.Template = function constructor(renderFunc, text, compiler) {
if (renderFunc) {
this.r = renderFunc;
}
this.c = compiler;
this.text = text || '';
}
Hogan.Template.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials, indent) {
return this.ri([context], partials || {}, indent);
},
// render internal -- a hook for overrides that catches partials too
ri: function (context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
if (this.c && typeof partial == 'string') {
partial = this.c.compile(partial);
}
return partial.ri(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var buf = '',
tail = context[context.length - 1];
if (!isArray(tail)) {
return buf = section(context, partials);
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (typeof val == 'function') {
val = this.ls(val, ctx, partials, inverted, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var compiler = this.c;
var t = val.call(cx, text, function(t) {
return compiler.compile(t, {delimiters: tags}).render(cx, partials);
});
var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, inverted, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = null;
if (!inverted && this.c && val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
t = val.call(cx);
if (typeof t == 'function') {
if (inverted) {
return true;
} else if (this.c) {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
var result = val.call(cx);
if (typeof result == 'function') {
result = result.call(cx);
}
result = result.toString();
if (this.c && ~result.indexOf("{{")) {
return this.c.compile(result).render(cx, partials);
}
return result;
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function hoganEscape(str) {
str = String((str === null || str === undefined) ? '' : str);
return hChars.test(str) ?
str
.replace(rAmp,'&amp;')
.replace(rLt,'&lt;')
.replace(rGt,'&gt;')
.replace(rApos,'&#39;')
.replace(rQuot, '&quot;') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
})(typeof exports !== 'undefined' ? exports : Hogan);
(function (Hogan) {
// Setup regex assignments
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/,
rQuot = /\"/g,
rNewline = /\n/g,
rCr = /\r/g,
rSlash = /\\/g,
tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
Hogan.scan = function scan(text, delimiters) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
tag = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart, next; j < tokens.length; j++) {
if (!tokens[j].tag) {
if ((next = tokens[j+1]) && next.tag == '>') {
// set indent to token value
next.indent = tokens[j].toString()
}
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'});
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag,
closeIndex = text.indexOf(close, index),
delimiters = trim(
text.substring(text.indexOf('=', index) + 1, closeIndex)
).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
if (delimiters) {
delimiters = delimiters.split(' ');
otag = delimiters[0];
ctag = delimiters[1];
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text.charAt(i) == '\n') {
filterLine(seenTag);
} else {
buf += text.charAt(i);
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
tag = tagTypes[text.charAt(i + 1)];
tagType = tag ? text.charAt(i + 1) : '_v';
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
seenTag = i;
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
if (tagType == '{') {
if (ctag == '}}') {
i++;
} else {
cleanTripleStache(tokens[tokens.length - 1]);
}
}
} else {
buf += text.charAt(i);
}
}
}
filterLine(seenTag, true);
return tokens;
}
function cleanTripleStache(token) {
if (token.n.substr(token.n.length - 1) === '}') {
token.n = token.n.substring(0, token.n.length - 1);
}
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
function tagChange(tag, text, index) {
if (text.charAt(index) != tag.charAt(0)) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text.charAt(index + i) != tag.charAt(i)) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length === 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function writeCode(tree) {
return 'i = i || "";var b = i + "";var _ = this;' + walk(tree) + 'return b;';
}
Hogan.generate = function (code, text, options) {
if (options.asString) {
return 'function(c,p,i){' + code + ';}';
}
return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan);
}
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r');
}
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i]);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text('"' + esc(tree[i]) + '"');
}
}
return code;
}
function section(nodes, id, method, start, end, tags) {
return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
'c,p,0,' + start + ',' + end + ', "' + tags + '")){' +
'b += _.rs(c,p,' +
'function(c,p){ var b = "";' +
walk(nodes) +
'return b;});c.pop();}' +
'else{b += _.b; _.b = ""};';
}
function invertedSection(nodes, id, method) {
return 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
walk(nodes) +
'};';
}
function partial(tok) {
return 'b += _.rp("' + esc(tok.n) + '",c,p,"' + (tok.indent || '') + '");';
}
function tripleStache(id, method) {
return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
}
function variable(id, method) {
return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return 'b += ' + id + ';';
}
Hogan.parse = function(tokens, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
Hogan.cache = {};
Hogan.compile = function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options = options || {};
var key = text + '||' + !!options.asString;
var t = this.cache[key];
if (t) {
return t;
}
t = this.generate(writeCode(this.parse(this.scan(text, options.delimiters), options)), text, options);
return this.cache[key] = t;
};
})(typeof exports !== 'undefined' ? exports : Hogan);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,619 @@
/*
* 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.
*/
// A wrapper for compatibility with Mustache.js, quirks and all
var Hogan = {};
(function (Hogan) {
Hogan.Template = function constructor(renderFunc, text, compiler) {
if (renderFunc) {
this.r = renderFunc;
}
this.c = compiler;
this.text = text || '';
}
Hogan.Template.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials, indent) {
return this.ri([context], partials || {}, indent);
},
// render internal -- a hook for overrides that catches partials too
ri: function (context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
if (this.c && typeof partial == 'string') {
partial = this.c.compile(partial);
}
return partial.ri(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var buf = '',
tail = context[context.length - 1];
if (!isArray(tail)) {
return buf = section(context, partials);
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (typeof val == 'function') {
val = this.ls(val, ctx, partials, inverted, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var compiler = this.c;
var t = val.call(cx, text, function(t) {
return compiler.compile(t, {delimiters: tags}).render(cx, partials);
});
var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, inverted, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = null;
if (!inverted && this.c && val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
t = val.call(cx);
if (typeof t == 'function') {
if (inverted) {
return true;
} else if (this.c) {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
var result = val.call(cx);
if (typeof result == 'function') {
result = result.call(cx);
}
result = result.toString();
if (this.c && ~result.indexOf("{{")) {
return this.c.compile(result).render(cx, partials);
}
return result;
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function hoganEscape(str) {
str = String((str === null || str === undefined) ? '' : str);
return hChars.test(str) ?
str
.replace(rAmp,'&amp;')
.replace(rLt,'&lt;')
.replace(rGt,'&gt;')
.replace(rApos,'&#39;')
.replace(rQuot, '&quot;') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
})(typeof exports !== 'undefined' ? exports : Hogan);
(function (Hogan) {
// Setup regex assignments
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/,
rQuot = /\"/g,
rNewline = /\n/g,
rCr = /\r/g,
rSlash = /\\/g,
tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
Hogan.scan = function scan(text, delimiters) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
tag = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart, next; j < tokens.length; j++) {
if (!tokens[j].tag) {
if ((next = tokens[j+1]) && next.tag == '>') {
// set indent to token value
next.indent = tokens[j].toString()
}
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'});
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag,
closeIndex = text.indexOf(close, index),
delimiters = trim(
text.substring(text.indexOf('=', index) + 1, closeIndex)
).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
if (delimiters) {
delimiters = delimiters.split(' ');
otag = delimiters[0];
ctag = delimiters[1];
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text.charAt(i) == '\n') {
filterLine(seenTag);
} else {
buf += text.charAt(i);
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
tag = tagTypes[text.charAt(i + 1)];
tagType = tag ? text.charAt(i + 1) : '_v';
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
seenTag = i;
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
if (tagType == '{') {
if (ctag == '}}') {
i++;
} else {
cleanTripleStache(tokens[tokens.length - 1]);
}
}
} else {
buf += text.charAt(i);
}
}
}
filterLine(seenTag, true);
return tokens;
}
function cleanTripleStache(token) {
if (token.n.substr(token.n.length - 1) === '}') {
token.n = token.n.substring(0, token.n.length - 1);
}
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
function tagChange(tag, text, index) {
if (text.charAt(index) != tag.charAt(0)) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text.charAt(index + i) != tag.charAt(i)) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length === 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function writeCode(tree) {
return 'i = i || "";var b = i + "";var _ = this;' + walk(tree) + 'return b;';
}
Hogan.generate = function (code, text, options) {
if (options.asString) {
return 'function(c,p,i){' + code + ';}';
}
return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan);
}
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r');
}
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i]);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text('"' + esc(tree[i]) + '"');
}
}
return code;
}
function section(nodes, id, method, start, end, tags) {
return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
'c,p,0,' + start + ',' + end + ', "' + tags + '")){' +
'b += _.rs(c,p,' +
'function(c,p){ var b = "";' +
walk(nodes) +
'return b;});c.pop();}' +
'else{b += _.b; _.b = ""};';
}
function invertedSection(nodes, id, method) {
return 'if (!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
walk(nodes) +
'};';
}
function partial(tok) {
return 'b += _.rp("' + esc(tok.n) + '",c,p,"' + (tok.indent || '') + '");';
}
function tripleStache(id, method) {
return 'b += (_.' + method + '("' + esc(id) + '",c,p,0));';
}
function variable(id, method) {
return 'b += (_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return 'b += ' + id + ';';
}
Hogan.parse = function(tokens, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
Hogan.cache = {};
Hogan.compile = function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options = options || {};
var key = text + '||' + !!options.asString;
var t = this.cache[key];
if (t) {
return t;
}
t = this.generate(writeCode(this.parse(this.scan(text, options.delimiters), options)), text, options);
return this.cache[key] = t;
};
})(typeof exports !== 'undefined' ? exports : Hogan);
var Mustache = (function (Hogan) {
// Mustache.js has non-spec partial context behavior
function mustachePartial(name, context, partials, indent) {
var partialScope = this.f(name, context, partials, 0);
var cx = context;
if (partialScope) {
cx = cx.concat(partialScope);
}
return Hogan.Template.prototype.rp.call(this, name, cx, partials, indent);
}
var HoganTemplateWrapper = function(renderFunc, text, compiler){
this.rp = mustachePartial;
Hogan.Template.call(this, renderFunc, text, compiler);
};
HoganTemplateWrapper.prototype = Hogan.Template.prototype;
// Add a wrapper for Hogan's generate method. Mustache and Hogan keep
// separate caches, and Mustache returns wrapped templates.
var wrapper;
var HoganWrapper = function(){
this.cache = {};
this.generate = function(code, text, options) {
return new HoganTemplateWrapper(new Function('c', 'p', 'i', code), text, wrapper);
}
};
HoganWrapper.prototype = Hogan;
wrapper = new HoganWrapper();
return {
to_html: function(text, data, partials, sendFun) {
var template = wrapper.compile(text);
var result = template.render(data, partials);
if (!sendFun) {
return result;
}
sendFun(result);
}
}
})(Hogan);

View File

@ -0,0 +1,233 @@
/*
* 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.
*/
var Hogan = {};
(function (Hogan) {
Hogan.Template = function constructor(renderFunc, text, compiler) {
if (renderFunc) {
this.r = renderFunc;
}
this.c = compiler;
this.text = text || '';
}
Hogan.Template.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
render: function render(context, partials, indent) {
return this.ri([context], partials || {}, indent);
},
// render internal -- a hook for overrides that catches partials too
ri: function (context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
if (this.c && typeof partial == 'string') {
partial = this.c.compile(partial);
}
return partial.ri(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var buf = '',
tail = context[context.length - 1];
if (!isArray(tail)) {
return buf = section(context, partials);
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
buf += section(context, partials);
context.pop();
}
return buf;
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (typeof val == 'function') {
val = this.ls(val, ctx, partials, inverted, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var compiler = this.c;
var t = val.call(cx, text, function(t) {
return compiler.compile(t, {delimiters: tags}).render(cx, partials);
});
var s = compiler.compile(t.toString(), {delimiters: tags}).render(cx, partials);
this.b = s;
return false;
},
// higher order template result buffer
b: '',
// lambda replace section
ls: function(val, ctx, partials, inverted, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = null;
if (!inverted && this.c && val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
t = val.call(cx);
if (typeof t == 'function') {
if (inverted) {
return true;
} else if (this.c) {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
var result = val.call(cx);
if (typeof result == 'function') {
result = result.call(cx);
}
result = result.toString();
if (this.c && ~result.indexOf("{{")) {
return this.c.compile(result).render(cx, partials);
}
return result;
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function hoganEscape(str) {
str = String((str === null || str === undefined) ? '' : str);
return hChars.test(str) ?
str
.replace(rAmp,'&amp;')
.replace(rLt,'&lt;')
.replace(rGt,'&gt;')
.replace(rApos,'&#39;')
.replace(rQuot, '&quot;') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
})(typeof exports !== 'undefined' ? exports : Hogan);

View File

@ -0,0 +1,5 @@
/**
* @preserve Copyright 2012 Twitter, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
*/
var Hogan={};(function(a){function h(a){return a=String(a===null||a===undefined?"":a),g.test(a)?a.replace(b,"&amp;").replace(c,"&lt;").replace(d,"&gt;").replace(e,"&#39;").replace(f,"&quot;"):a}a.Template=function j(a,b,c){a&&(this.r=a),this.c=c,this.text=b||""},a.Template.prototype={r:function(a,b,c){return""},v:h,render:function(b,c,d){return this.ri([b],c||{},d)},ri:function(a,b,c){return this.r(a,b,c)},rp:function(a,b,c,d){var e=c[a];return e?(this.c&&typeof e=="string"&&(e=this.c.compile(e)),e.ri(b,c,d)):""},rs:function(a,b,c){var d="",e=a[a.length-1];if(!i(e))return d=c(a,b);for(var f=0;f<e.length;f++)a.push(e[f]),d+=c(a,b),a.pop();return d},s:function(a,b,c,d,e,f,g){var h;return i(a)&&a.length===0?!1:(typeof a=="function"&&(a=this.ls(a,b,c,d,e,f,g)),h=a===""||!!a,!d&&h&&b&&b.push(typeof a=="object"?a:b[b.length-1]),h)},d:function(a,b,c,d){var e=a.split("."),f=this.f(e[0],b,c,d),g=null;if(a==="."&&i(b[b.length-2]))return b[b.length-1];for(var h=1;h<e.length;h++)f&&typeof f=="object"&&e[h]in f?(g=f,f=f[e[h]]):f="";return d&&!f?!1:(!d&&typeof f=="function"&&(b.push(g),f=this.lv(f,b,c),b.pop()),f)},f:function(a,b,c,d){var e=!1,f=null,g=!1;for(var h=b.length-1;h>=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=a.call(b,d,function(a){return f.compile(a,{delimiters:e}).render(b,c)}),h=f.compile(g.toString(),{delimiters:e}).render(b,c);return this.b=h,!1},b:"",ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"&&(e=e.call(d)),e=e.toString(),this.c&&~e.indexOf("{{")?this.c.compile(e).render(d,c):e}};var b=/&/g,c=/</g,d=/>/g,e=/\'/g,f=/\"/g,g=/[&<>\"\']/,i=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan)

BIN
docs/build/node_modules/hogan.js/web/favicon.ico generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
docs/build/node_modules/hogan.js/web/images/logo.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
docs/build/node_modules/hogan.js/web/images/noise.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

BIN
docs/build/node_modules/hogan.js/web/images/stripes.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

139
docs/build/node_modules/hogan.js/web/index.html.mustache generated vendored Executable file
View File

@ -0,0 +1,139 @@
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>Hogan.js</title>
<meta name="description" content="">
<meta name="author" content="">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Mobile Specific Metas
================================================== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<!-- CSS
================================================== -->
<link rel="stylesheet" href="stylesheets/skeleton.css">
<link rel="stylesheet" href="stylesheets/layout.css">
</head>
<body>
<!-- Primary Page Layout
================================================== -->
<header class="hogan-hero">
<div class="stripes"></div>
<div class="noise"></div>
<div class="container">
<h1>Hogan.js</h1>
<h3>JavaScript templating from Twitter.</h3>
<a href="https://github.com/twitter/hogan.js" class="download button">View on Github</a>
</div>
</header>
<div class="primary container">
<!-- Layout 1 -->
<div class="five columns">
<h4>Getting started</h4>
<p>
Hogan.js is a 2.5k JS templating engine developed at Twitter. Use it as a part of your asset packager to compile templates ahead of time or include it in your browser to handle dynamic templates.
</p>
<p>
If you're developing with Node.js, just use NPM to add the Hogan package.
</p>
<pre><code>$ npm install hogan.js</code></pre>
<p>
Alternatively, drop hogan.js in your browser by adding the following script.
</p>
<pre><code>&lt;script src="http://twitter.github.com/hogan.js/builds/{{version}}/hogan.js"&gt;&lt;/script&gt;</code></pre>
</div>
<div class="ten columns offset-by-one">
<script src="https://gist.github.com/1484613.js"> </script>
</div>
<div class="hogan-divider">
<div class="hogan-icon"></div>
</div>
<!-- Layout 2 -->
<div class="five columns">
<h4>Templates</h4>
<p>
Hogan.js was developed against the mustache test suite, so everything that holds true for templates as specified <a href="//mustache.github.com/mustache.5.html">here</a>, is also the case for hogan.js.
</p>
<p>
That means you get variables, sections, lambdas, partials, filters, and everything else you've come to expect from mustache templating - only much, much faster.
</p>
</div>
<div class="ten columns offset-by-one">
<script src="https://gist.github.com/1484342.js"></script>
</div>
<div class="hogan-divider">
<div class="hogan-icon"></div>
</div>
<!-- Layout 3 -->
<div class="five columns">
<h4>Compiling</h4>
<p>
Use <code>hogan.compile()</code> to precompile your templates into vanilla JS.
</p>
<p>
It's best to serve your templates precompiled whenever you can (rather than the raw templates), as parsing is the most time consuming operation.
</p>
<p>
</p>
</div>
<div class="ten columns offset-by-one">
<script src="https://gist.github.com/1484513.js"> </script>
</div>
<div class="hogan-divider">
<div class="hogan-icon"></div>
</div>
<!-- Layout 4 -->
<div class="five columns">
<h4 id='rendering'>Rendering</h4>
<p>
Once compiled, call the <code>render()</code> method with a context and optional partials object.
</p>
<p>
If supplying partials, you can compile them ahead of time, or pass string templates.</p>
<p>
</p>
</div>
<div class="ten columns offset-by-one">
<script src="https://gist.github.com/1575714.js"> </script>
</div>
<div class="sixteen columns hogan-footer">
<span class="copyright">
Designed and built with all the love in the world <a href="http://twitter.com/twitter" target="_blank">@twitter</a> by <a href="http://twitter.com/sayrer" target="_blank">@sayrer</a> and <a href="http://twitter.com/fat" target="_blank">@fat</a>.<br />
Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.
</span>
<span class="colophon">
<a href="#">Back to top</a>
</span>
</div>
</div><!-- container -->
<!-- End Document
================================================== -->
</body>
</html>

206
docs/build/node_modules/hogan.js/web/stylesheets/layout.css generated vendored Executable file
View File

@ -0,0 +1,206 @@
/* #Reset & Basics (Inspired by E. Meyers)
================================================== */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline; }
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block; }
body {
line-height: 1; }
ol, ul {
list-style: none; }
blockquote, q {
quotes: none; }
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none; }
table {
border-collapse: collapse;
border-spacing: 0; }
/* #Basic Styles
================================================== */
body {
background: #fff;
font: 14px/24px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #000;
-webkit-font-smoothing: antialiased; /* Fix for webkit rendering */
-webkit-text-size-adjust: 100%;
}
a {
color: #999113;
text-decoration: none;
}
a:hover {
color: #7b750e;
text-decoration: underline;
}
/* #Typography
================================================== */
h1, h2, h3, h4, h5, h6 {
font-weight: bold; }
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-weight: inherit; }
h1 { font-size: 75px; line-height: 80px; margin-bottom: 14px;}
h2 { font-size: 35px; line-height: 40px; margin-bottom: 10px; }
h3 { font-size: 28px; line-height: 34px; margin-bottom: 8px; }
h4 { font-size: 21px; line-height: 30px; margin-bottom: 4px; }
h5 { font-size: 17px; line-height: 24px; }
h6 { font-size: 14px; line-height: 21px; }
p { margin-bottom: 22px; }
/* #Main styles
================================================== */
/* Hogan Hero */
.hogan-hero {
position: relative;
background: #333; /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, #333 0%, #000 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#333), color-stop(100%,#000)); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, #333 0%,#000 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, #333 0%,#000 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, #333 0%,#000 100%); /* IE10+ */
background: radial-gradient(center, ellipse cover, #333 0%,#000 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#333', endColorstr='#000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
.hogan-hero .container {
padding: 180px 0;
}
.hogan-hero h1 {
letter-spacing: -3px;
color: #fff;
position: relative;
margin-bottom: 5px;
}
.hogan-hero h3 {
max-width: 650px;
margin-bottom: 20px;
color: #fff;
}
.hogan-hero .noise,
.hogan-hero .stripes {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.hogan-hero .noise {
background: url(../images/noise.png) repeat;
}
.hogan-hero .stripes {
background: url(../images/stripes.png) repeat;
}
/* Primary content container */
.primary.container {
padding-top: 100px;
}
/*Hogan divider */
.hogan-divider {
padding-top: 60px;
border-bottom: 1px solid #ddd;
margin-bottom: 60px;
clear: both;
position: relative;
}
.hogan-icon {
width: 40px;
height: 30px;
position: absolute;
left: 50%;
top: 46px;
margin-left: -20px;
background: url('../images/small-hogan-icon.png') white no-repeat center center;
}
/* Button style */
.button {
display: inline-block;
cursor: pointer;
background: #dfd52e;
border-radius: 3px;
margin-bottom: 20px;
color: #000;
text-transform: uppercase;
text-decoration: none;
font-size: 15px;
padding: 0 34px;
line-height: 46px;
font-weight: bold;
-webkit-transition: background-color .3s ease-in-out;
-moz-transition: background-color .3s ease-in-out;
transition: background-color .3s ease-in-out;
}
.button:hover {
text-decoration: inherit;
color: inherit;
background-color: #f5e810;
}
/* Hogan footer */
.hogan-footer {
border-top: 1px solid #ddd;
margin-top: 60px;
padding: 20px 0 40px;
color: #999;
font-size: 12px;
}
.hogan-footer .copyright {
float: left;
}
.hogan-footer .colophon {
float: right;
}
pre, code {
background: #F8F8FF;
border: 1px solid #DDD;
padding: 5px 10px;
margin-bottom: 20px;
font-family: courier;
overflow: hidden;
}
pre code {
border: 0;
padding: 0;
margin-bottom: 0;
}
/* #Media Queries
================================================== */
/* Smaller than standard 960 (devices and browsers) */
@media only screen and (max-width: 959px) {}
/* Tablet Portrait size to standard 960 (devices and browsers) */
@media only screen and (min-width: 768px) and (max-width: 959px) {}
/* All Mobile Sizes (devices and browser) */
@media only screen and (max-width: 767px) {
.hogan-hero .container {
padding: 100px 0;
}
}
/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
@media only screen and (min-width: 480px) and (max-width: 767px) {}
/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
@media only screen and (max-width: 479px) {}

236
docs/build/node_modules/hogan.js/web/stylesheets/skeleton.css generated vendored Executable file
View File

@ -0,0 +1,236 @@
/*
* Skeleton V1.1
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 8/17/2011
*/
/* Table of Contents
==================================================
#Base 960 Grid
#Tablet (Portrait)
#Mobile (Portrait)
#Mobile (Landscape)
#Clearing */
/* #Base 960 Grid
================================================== */
.container { position: relative; width: 960px; margin: 0 auto; padding: 0; }
.column, .columns { float: left; display: inline; margin-left: 10px; margin-right: 10px; }
.row { margin-bottom: 20px; }
/* Nested Column Classes */
.column.alpha, .columns.alpha { margin-left: 0; }
.column.omega, .columns.omega { margin-right: 0; }
/* Base Grid */
.container .one.column { width: 40px; }
.container .two.columns { width: 100px; }
.container .three.columns { width: 160px; }
.container .four.columns { width: 220px; }
.container .five.columns { width: 280px; }
.container .six.columns { width: 340px; }
.container .seven.columns { width: 400px; }
.container .eight.columns { width: 460px; }
.container .nine.columns { width: 520px; }
.container .ten.columns { width: 580px; }
.container .eleven.columns { width: 640px; }
.container .twelve.columns { width: 700px; }
.container .thirteen.columns { width: 760px; }
.container .fourteen.columns { width: 820px; }
.container .fifteen.columns { width: 880px; }
.container .sixteen.columns { width: 940px; }
.container .one-third.column { width: 300px; }
.container .two-thirds.column { width: 620px; }
/* Offsets */
.container .offset-by-one { padding-left: 60px; }
.container .offset-by-two { padding-left: 120px; }
.container .offset-by-three { padding-left: 180px; }
.container .offset-by-four { padding-left: 240px; }
.container .offset-by-five { padding-left: 300px; }
.container .offset-by-six { padding-left: 360px; }
.container .offset-by-seven { padding-left: 420px; }
.container .offset-by-eight { padding-left: 480px; }
.container .offset-by-nine { padding-left: 540px; }
.container .offset-by-ten { padding-left: 600px; }
.container .offset-by-eleven { padding-left: 660px; }
.container .offset-by-twelve { padding-left: 720px; }
.container .offset-by-thirteen { padding-left: 780px; }
.container .offset-by-fourteen { padding-left: 840px; }
.container .offset-by-fifteen { padding-left: 900px; }
/* #Tablet (Portrait)
================================================== */
/* Note: Design for a width of 768px */
@media only screen and (min-width: 768px) and (max-width: 959px) {
.container { width: 768px; }
.container .column,
.container .columns { margin-left: 10px; margin-right: 10px; }
.column.alpha, .columns.alpha { margin-left: 0; margin-right: 10px; }
.column.omega, .columns.omega { margin-right: 0; margin-left: 10px; }
.container .one.column { width: 28px; }
.container .two.columns { width: 76px; }
.container .three.columns { width: 124px; }
.container .four.columns { width: 172px; }
.container .five.columns { width: 220px; }
.container .six.columns { width: 268px; }
.container .seven.columns { width: 316px; }
.container .eight.columns { width: 364px; }
.container .nine.columns { width: 412px; }
.container .ten.columns { width: 460px; }
.container .eleven.columns { width: 508px; }
.container .twelve.columns { width: 556px; }
.container .thirteen.columns { width: 604px; }
.container .fourteen.columns { width: 652px; }
.container .fifteen.columns { width: 700px; }
.container .sixteen.columns { width: 748px; }
.container .one-third.column { width: 236px; }
.container .two-thirds.column { width: 492px; }
/* Offsets */
.container .offset-by-one { padding-left: 48px; }
.container .offset-by-two { padding-left: 96px; }
.container .offset-by-three { padding-left: 144px; }
.container .offset-by-four { padding-left: 192px; }
.container .offset-by-five { padding-left: 240px; }
.container .offset-by-six { padding-left: 288px; }
.container .offset-by-seven { padding-left: 336px; }
.container .offset-by-eight { padding-left: 348px; }
.container .offset-by-nine { padding-left: 432px; }
.container .offset-by-ten { padding-left: 480px; }
.container .offset-by-eleven { padding-left: 528px; }
.container .offset-by-twelve { padding-left: 576px; }
.container .offset-by-thirteen { padding-left: 624px; }
.container .offset-by-fourteen { padding-left: 672px; }
.container .offset-by-fifteen { padding-left: 720px; }
}
/* #Mobile (Portrait)
================================================== */
/* Note: Design for a width of 320px */
@media only screen and (max-width: 767px) {
.container { width: 300px; }
.columns, .column { margin: 0; }
.container .one.column,
.container .two.columns,
.container .three.columns,
.container .four.columns,
.container .five.columns,
.container .six.columns,
.container .seven.columns,
.container .eight.columns,
.container .nine.columns,
.container .ten.columns,
.container .eleven.columns,
.container .twelve.columns,
.container .thirteen.columns,
.container .fourteen.columns,
.container .fifteen.columns,
.container .sixteen.columns,
.container .one-third.column,
.container .two-thirds.column { width: 300px; }
/* Offsets */
.container .offset-by-one,
.container .offset-by-two,
.container .offset-by-three,
.container .offset-by-four,
.container .offset-by-five,
.container .offset-by-six,
.container .offset-by-seven,
.container .offset-by-eight,
.container .offset-by-nine,
.container .offset-by-ten,
.container .offset-by-eleven,
.container .offset-by-twelve,
.container .offset-by-thirteen,
.container .offset-by-fourteen,
.container .offset-by-fifteen { padding-left: 0; }
}
/* #Mobile (Landscape)
================================================== */
/* Note: Design for a width of 480px */
@media only screen and (min-width: 480px) and (max-width: 767px) {
.container { width: 420px; }
.columns, .column { margin: 0; }
.container .one.column,
.container .two.columns,
.container .three.columns,
.container .four.columns,
.container .five.columns,
.container .six.columns,
.container .seven.columns,
.container .eight.columns,
.container .nine.columns,
.container .ten.columns,
.container .eleven.columns,
.container .twelve.columns,
.container .thirteen.columns,
.container .fourteen.columns,
.container .fifteen.columns,
.container .sixteen.columns,
.container .one-third.column,
.container .two-thirds.column { width: 420px; }
}
/* #Clearing
================================================== */
/* Self Clearing Goodness */
.container:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; }
/* Use clearfix class on parent to clear nested columns,
or wrap each row of columns in a <div class="row"> */
.clearfix:before,
.clearfix:after,
.row:before,
.row:after {
content: '\0020';
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0; }
.row:after,
.clearfix:after {
clear: both; }
.row,
.clearfix {
zoom: 1; }
/* You can also use a <br class="clear" /> to clear columns */
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}

View File

@ -0,0 +1,21 @@
/*
* 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.
*/
{{{template}}}
{{{compiler}}}
if (typeof define === 'function' && define.amd) {
define(Hogan);
}

View File

@ -0,0 +1,21 @@
/*
* 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.
*/
{{{template}}}
{{{compiler}}}
if (typeof module !== 'undefined' && module.exports) {
module.exports = Hogan;
}

17
docs/build/node_modules/hogan.js/wrappers/js.mustache generated vendored Normal file
View File

@ -0,0 +1,17 @@
/*
* 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.
*/
{{{template}}}
{{{compiler}}}

View File

@ -0,0 +1,64 @@
/*
* 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.
*/
// A wrapper for compatibility with Mustache.js, quirks and all
{{{template}}}
{{{compiler}}}
var Mustache = (function (Hogan) {
// Mustache.js has non-spec partial context behavior
function mustachePartial(name, context, partials, indent) {
var partialScope = this.f(name, context, partials, 0);
var cx = context;
if (partialScope) {
cx = cx.concat(partialScope);
}
return Hogan.Template.prototype.rp.call(this, name, cx, partials, indent);
}
var HoganTemplateWrapper = function(renderFunc, text, compiler){
this.rp = mustachePartial;
Hogan.Template.call(this, renderFunc, text, compiler);
};
HoganTemplateWrapper.prototype = Hogan.Template.prototype;
// Add a wrapper for Hogan's generate method. Mustache and Hogan keep
// separate caches, and Mustache returns wrapped templates.
var wrapper;
var HoganWrapper = function(){
this.cache = {};
this.generate = function(code, text, options) {
return new HoganTemplateWrapper(new Function('c', 'p', 'i', code), text, wrapper);
}
};
HoganWrapper.prototype = Hogan;
wrapper = new HoganWrapper();
return {
to_html: function(text, data, partials, sendFun) {
var template = wrapper.compile(text);
var result = template.render(data, partials);
if (!sendFun) {
return result;
}
sendFun(result);
}
}
})(Hogan);

6
docs/build/package.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"name": "bootstrap-doc-builder"
, "version": "0.0.1"
, "description": "build bootstrap docs"
, "dependencies": { "hogan.js": "1.0.5-dev" }
}

51
docs/components.html Executable file → Normal file
View File

@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@ -18,10 +18,11 @@
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" type="image/x-icon" href="assets/ico/favicon.ico">
<link rel="apple-touch-icon" href="assets/ico/bootstrap-apple-57x57.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/ico/bootstrap-apple-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/ico/bootstrap-apple-114x114.png">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
<body>
@ -33,8 +34,8 @@
<div class="container">
<a class="brand" href="./index.html">Bootstrap</a>
<ul class="nav">
<li><a href="./index.html">Overview</a></li>
<li class="dropdown">
<li class=""><a href="./index.html">Overview</a></li>
<li class="dropdown ">
<a href="./scaffolding.html" class="dropdown-toggle" data-toggle="dropdown">
Scaffolding
<b class="caret"></b>
@ -45,7 +46,7 @@
<li><a href="./scaffolding.html#responsive">Responsive design</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./base-css.html" class="dropdown-toggle" data-toggle="dropdown">
Base CSS
<b class="caret"></b>
@ -75,7 +76,7 @@
<li><a href="./components.html#progress">Progress bars</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./javascript.html" class="dropdown-toggle" data-toggle="dropdown">
Javascript plugins
<b class="caret"></b>
@ -95,7 +96,7 @@
<li><a href="./javascript.html#typeahead">Typeahead</a></li>
</ul>
</li>
<li>
<li class="">
<a href="./less.html">
Using LESS
</a>
@ -107,13 +108,12 @@
<div class="container">
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Components</h1>
<p class="lead">Dozens of reusable components are built into Bootstrap to provide navigation, alerts, popovers, and much more.</p>
</header>
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Components</h1>
<p class="lead">Dozens of reusable components are built into Bootstrap to provide navigation, alerts, popovers, and much more.</p>
</header>
<!-- Button Groups
@ -1284,9 +1284,6 @@
</div>
</section>
<!-- Footer
================================================== -->
<footer class="footer">
@ -1295,17 +1292,27 @@
<p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</footer>
</div><!-- /container -->
<!-- Le javascript -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<!-- <script src="http://code.jquery.com/jquery-1.7.min.js"></script> -->
<script src="../js/tests/vendor/jquery.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="../js/bootstrap-transition.js"></script>
<script src="../js/bootstrap-alert.js"></script>
<script src="../js/bootstrap-modal.js"></script>
<script src="../js/bootstrap-dropdown.js"></script>
<script src="../js/bootstrap-tab.js"></script>
<script src="../js/bootstrap-scrollspy.js"></script>
<script src="../js/bootstrap-tab.js"></script>
<script src="../js/bootstrap-tooltip.js"></script>
<script src="../js/bootstrap-popover.js"></script>
<script src="../js/bootstrap-button.js"></script>
<script src="../js/bootstrap-collapse.js"></script>
<script src="../js/bootstrap-carousel.js"></script>
<script src="../js/bootstrap-typeahead.js"></script>
<script src="assets/js/application.js"></script>
</body>
</html>

View File

@ -4,11 +4,10 @@
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@ -19,23 +18,24 @@
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" type="image/x-icon" href="assets/ico/favicon.ico">
<link rel="apple-touch-icon" href="assets/ico/bootstrap-apple-57x57.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/ico/bootstrap-apple-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/ico/bootstrap-apple-114x114.png">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
<body>
<!-- Navbar
================================================== -->
<div class="navbar navbar-fixed" data-scrollspy="scrollspy">
<div class="navbar navbar-fixed">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./index.html">Bootstrap</a>
<ul class="nav">
<li class="active"><a href="./index.html">Overview</a></li>
<li class="dropdown">
<li class="dropdown ">
<a href="./scaffolding.html" class="dropdown-toggle" data-toggle="dropdown">
Scaffolding
<b class="caret"></b>
@ -46,7 +46,7 @@
<li><a href="./scaffolding.html#responsive">Responsive design</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./base-css.html" class="dropdown-toggle" data-toggle="dropdown">
Base CSS
<b class="caret"></b>
@ -59,7 +59,7 @@
<li><a href="./base-css.html#icons">Icons by Glyphicons</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./components.html" class="dropdown-toggle" data-toggle="dropdown">
Components
<b class="caret"></b>
@ -76,7 +76,7 @@
<li><a href="./components.html#progress">Progress bars</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./javascript.html" class="dropdown-toggle" data-toggle="dropdown">
Javascript plugins
<b class="caret"></b>
@ -96,7 +96,7 @@
<li><a href="./javascript.html#typeahead">Typeahead</a></li>
</ul>
</li>
<li>
<li class="">
<a href="./less.html">
Using LESS
</a>
@ -108,196 +108,194 @@
<div class="container">
<div id="overview">
<div id="overview">
<!-- Masthead
================================================== -->
<header class="jumbotron masthead">
<div class="inner">
<h1>Bootstrap,<br> from Twitter</h1>
<p class="lead">Bootstrap is a responsive frontend toolkit from Twitter designed to kickstart web development, featuring HTML, CSS, and JS for dozens of base elements and common design components.</p>
<p class="download-info">
<a href="https://github.com/twitter/bootstrap/" class="btn primary btn-large">Download on GitHub</a>
<a href="./scaffolding.html" class="btn btn-large">Get started &rarr;</a>
</p>
<!-- Masthead
================================================== -->
<header class="jumbotron masthead">
<div class="inner">
<h1>Bootstrap,<br> from Twitter</h1>
<p class="lead">Bootstrap is a responsive frontend toolkit from Twitter designed to kickstart web development, featuring HTML, CSS, and JS for dozens of base elements and common design components.</p>
<p class="download-info">
<a href="https://github.com/twitter/bootstrap/" class="btn primary btn-large">Download on GitHub</a>
<a href="./scaffolding.html" class="btn btn-large">Get started &rarr;</a>
</p>
<div class="benefits">
<h4>Feature highlights</h4>
<ul>
<li><span>&times;</span> Built on LESS</li>
<li><span>&times;</span> Complete styleguide docs</li>
<li><span>&times;</span> Fully responsive design</li>
<li><span>&times;</span> Small footprint (7kb gzipped)</li>
<li><span>&times;</span> Support for IE7 and up</li>
<li><span>&times;</span> Custom jQuery plugins</li>
<li><span>&times;</span> Dozens of components</li>
</ul>
</div>
</div>
</header>
<ul class="quick-links">
<li><strong>Quick links</strong></li>
<li><a href="https://github.com/twitter/bootstrap/">GitHub</a></li>
<li><a href="https://github.com/twitter/bootstrap/issues?state=open">Issues</a></li>
<li><a href="https://github.com/twitter/bootstrap/wiki/Roadmap">Roadmap</a></li>
<li><a href="https://github.com/twitter/bootstrap/wiki/Changelog">Changelog</a></li>
<li class="divider">&middot;</li>
<li>
<iframe class="github-btn" src="http://markdotto.github.com/github-buttons/github-btn.html?user=twitter&repo=bootstrap&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="114px" height="20px"></iframe>
</li>
<li>
<iframe class="github-btn" src="http://markdotto.github.com/github-buttons/github-btn.html?user=twitter&repo=bootstrap&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="98px" height="20px"></iframe>
</li>
<!--
<li><strong>Authors</strong></li>
<li><a href="http://twitter.com/mdo">@mdo</a></li>
<li><a href="http://twitter.com/fat">@fat</a></li>
-->
<li class="divider">&middot;</li>
<li class="follow-btn">
<a href="https://twitter.com/twbootstrap" class="twitter-follow-button" data-width="145px" data-link-color="#0069D6" data-show-count="false">Follow @twbootstrap</a>
</li>
<li class="tweet-btn">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://twitter.github.com/bootstrap/" data-count="horizontal" data-via="twbootstrap" data-related="mdo:Creator of Twitter Bootstrap">Tweet</a>
</li>
<div class="benefits">
<h4>Feature highlights</h4>
<ul>
<li><span>&times;</span> Built on LESS</li>
<li><span>&times;</span> Complete styleguide docs</li>
<li><span>&times;</span> Fully responsive design</li>
<li><span>&times;</span> Small footprint (7kb gzipped)</li>
<li><span>&times;</span> Support for IE7 and up</li>
<li><span>&times;</span> Custom jQuery plugins</li>
<li><span>&times;</span> Dozens of components</li>
</ul>
</div>
</div>
</header>
<ul class="quick-links">
<li><strong>Quick links</strong></li>
<li><a href="https://github.com/twitter/bootstrap/">GitHub</a></li>
<li><a href="https://github.com/twitter/bootstrap/issues?state=open">Issues</a></li>
<li><a href="https://github.com/twitter/bootstrap/wiki/Roadmap">Roadmap</a></li>
<li><a href="https://github.com/twitter/bootstrap/wiki/Changelog">Changelog</a></li>
<li class="divider">&middot;</li>
<li>
<iframe class="github-btn" src="http://markdotto.github.com/github-buttons/github-btn.html?user=twitter&repo=bootstrap&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="114px" height="20px"></iframe>
</li>
<li>
<iframe class="github-btn" src="http://markdotto.github.com/github-buttons/github-btn.html?user=twitter&repo=bootstrap&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="98px" height="20px"></iframe>
</li>
<!--
<li><strong>Authors</strong></li>
<li><a href="http://twitter.com/mdo">@mdo</a></li>
<li><a href="http://twitter.com/fat">@fat</a></li>
-->
<li class="divider">&middot;</li>
<li class="follow-btn">
<a href="https://twitter.com/twbootstrap" class="twitter-follow-button" data-width="145px" data-link-color="#0069D6" data-show-count="false">Follow @twbootstrap</a>
</li>
<li class="tweet-btn">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://twitter.github.com/bootstrap/" data-count="horizontal" data-via="twbootstrap" data-related="mdo:Creator of Twitter Bootstrap">Tweet</a>
</li>
</ul>
<div class="marketing">
<h1>Built with Bootstrap.</h1>
<p class="marketing-byline">For even more sites built with Bootstrap, <a href="http://builtwithbootstrap.tumblr.com/" target="_blank">visit the unofficial Tumblr</a>.</p>
<ul class="thumbnails example-sites">
<li class="span4">
<a class="thumbnail" href="http://kippt.com/" target="_blank">
<img src="assets/img/example-sites/kippt.png" alt="Kippt">
</a>
</li>
<li class="span4">
<a class="thumbnail" href="http://www.fleetio.com/" target="_blank">
<img src="assets/img/example-sites/fleetio.png" alt="Fleetio">
</a>
</li>
<li class="span4">
<a class="thumbnail" href="http://www.jshint.com/" target="_blank">
<img src="assets/img/example-sites/jshint.png" alt="JS Hint">
</a>
</li>
</ul>
<div class="marketing">
<h1>Built with Bootstrap.</h1>
<p class="marketing-byline">For even more sites built with Bootstrap, <a href="http://builtwithbootstrap.tumblr.com/" target="_blank">visit the unofficial Tumblr</a>.</p>
<ul class="thumbnails example-sites">
<li class="span4">
<a class="thumbnail" href="http://kippt.com/" target="_blank">
<img src="assets/img/example-sites/kippt.png" alt="Kippt">
</a>
</li>
<li class="span4">
<a class="thumbnail" href="http://www.fleetio.com/" target="_blank">
<img src="assets/img/example-sites/fleetio.png" alt="Fleetio">
</a>
</li>
<li class="span4">
<a class="thumbnail" href="http://www.jshint.com/" target="_blank">
<img src="assets/img/example-sites/jshint.png" alt="JS Hint">
</a>
</li>
</ul>
<h1>Designed for everyone, everywhere.</h1>
<p class="marketing-byline">Need reasons to love Bootstrap? Look no further.</p>
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_042_group.png">
<h2>Built for and by nerds</h2>
<p>Like you, we love building awesome products on the web. We love it so much, we decided to help people just like us do it easier, better, and faster. Bootstrap is built for you.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_079_podium.png">
<h2>For all skill levels</h2>
<p>Bootstrap is designed to help people of all skill level&mdash;designer or developer, huge nerd or early beginner. Use it as a complete kit or use to start something more complex.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_163_iphone.png">
<h2>Cross-everything</h2>
<p>Originally built with only modern browsers in mind, Bootstrap has evolved to include support for all major browsers (even IE7!) and, with Bootstrap 2, tablets and smartphones, too.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_155_show_thumbnails.png">
<h2>12-column grid</h2>
<p>Grid systems aren't everything, but having a durable and flexible one at the core of your work can make development much simpler. Use our built-in grid classes or roll your own.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_214_resize_small.png">
<h2>Responsive design</h2>
<p>With Bootstrap 2, we've gone fully responsive. Our components are scaled according to a range of resolutions and devices to provide a consistent experience, no matter what.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_266_book_open.png">
<h2>Styleguide docs</h2>
<p>Unlike other front-end toolkits, Bootstrap was designed first and foremost as a styleguide to document not only our features, but best practices and living, coded examples.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_082_roundabout.png">
<h2>Growing library</h2>
<p>Despite being only 7kb (gzipped), Bootstrap is one of the most complete front-end toolkits out there with dozens of fully functional components ready to be put to use.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_009_magic.png">
<h2>Custom jQuery plugins</h2>
<p>What good is an awesome design component without easy-to-use, proper, and extensible interactions? With Bootstrap, you get custom-built jQuery plugins to bring your projects to life.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/less-small.png">
<h2>Built on LESS</h2>
<p>Where vanilla CSS falters, LESS excels. Variables, nesting, operations, and mixins in LESS makes coding CSS faster and more efficient with minimal overhead.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span3">
<img class="small-icon" src="assets/img/icon-html5.png">
<h3>HTML5</h3>
<p>Built to support new HTML5 elements and syntax.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-css3.png">
<h3>CSS3</h3>
<p>Progressively enhanced components for ultimate style.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-github.png">
<h3>Open-source</h3>
<p>Built for and maintained by the community via <a href="https://github.com">GitHub</a>.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-twitter.png">
<h3>Made at Twitter</h3>
<p>Brought to you by an experienced <a href="http://twitter.com/fat">engineer</a> and <a href="http://twitter.com/mdo">designer</a>.</p>
</div>
</div><!--/row-->
<!-- Quickstart options
================================================== -->
<h1>Get started in no time.</h1>
<p class="marketing-byline">Quickly start using Bootstrap within your workflow and development process.</p>
<table class="table table-bordered getting-started">
<tbody>
<tr>
<td class="quick-start">
<h3>Hotlink the CSS</h3>
<p>For the quickest and easiest start, just copy this snippet into your webpage.</p>
<form>
<textarea class="copy-code" rows="1">&lt;link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.min.css"></textarea>
</form>
</td>
<td class="quick-start">
<h3>Use it with LESS</h3>
<p>A fan of using LESS? No problem, just clone the repo and add these lines:</p>
<form>
<textarea class="copy-code" rows="2">&lt;link rel="stylesheet/less" href="/path/to/bootstrap.less"&gt;
&lt;script src="/path/to/less.js"&gt;&lt;/script&gt;</textarea>
</form>
</td>
<td class="quick-start">
<h3>Fork on GitHub</h3>
<p>Download, fork, pull, file issues, and more with the Bootstrap GitHub repo.</p>
<p><a target="_blank" href="https://github.com/twitter/bootstrap" class="btn primary">Bootstrap on GitHub &raquo;</a></p>
<p class="current-version">Currently <a href="https://github.com/twitter/bootstrap/wiki/Changelog">v2.0.0</a></p>
</td>
</tr>
</tbody>
</table>
</div><!-- /.marketing -->
</div><!-- /#overview -->
<h1>Designed for everyone, everywhere.</h1>
<p class="marketing-byline">Need reasons to love Bootstrap? Look no further.</p>
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_042_group.png">
<h2>Built for and by nerds</h2>
<p>Like you, we love building awesome products on the web. We love it so much, we decided to help people just like us do it easier, better, and faster. Bootstrap is built for you.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_079_podium.png">
<h2>For all skill levels</h2>
<p>Bootstrap is designed to help people of all skill level&mdash;designer or developer, huge nerd or early beginner. Use it as a complete kit or use to start something more complex.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_163_iphone.png">
<h2>Cross-everything</h2>
<p>Originally built with only modern browsers in mind, Bootstrap has evolved to include support for all major browsers (even IE7!) and, with Bootstrap 2, tablets and smartphones, too.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_155_show_thumbnails.png">
<h2>12-column grid</h2>
<p>Grid systems aren't everything, but having a durable and flexible one at the core of your work can make development much simpler. Use our built-in grid classes or roll your own.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_214_resize_small.png">
<h2>Responsive design</h2>
<p>With Bootstrap 2, we've gone fully responsive. Our components are scaled according to a range of resolutions and devices to provide a consistent experience, no matter what.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_266_book_open.png">
<h2>Styleguide docs</h2>
<p>Unlike other front-end toolkits, Bootstrap was designed first and foremost as a styleguide to document not only our features, but best practices and living, coded examples.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_082_roundabout.png">
<h2>Growing library</h2>
<p>Despite being only 7kb (gzipped), Bootstrap is one of the most complete front-end toolkits out there with dozens of fully functional components ready to be put to use.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_009_magic.png">
<h2>Custom jQuery plugins</h2>
<p>What good is an awesome design component without easy-to-use, proper, and extensible interactions? With Bootstrap, you get custom-built jQuery plugins to bring your projects to life.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/less-small.png">
<h2>Built on LESS</h2>
<p>Where vanilla CSS falters, LESS excels. Variables, nesting, operations, and mixins in LESS makes coding CSS faster and more efficient with minimal overhead.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span3">
<img class="small-icon" src="assets/img/icon-html5.png">
<h3>HTML5</h3>
<p>Built to support new HTML5 elements and syntax.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-css3.png">
<h3>CSS3</h3>
<p>Progressively enhanced components for ultimate style.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-github.png">
<h3>Open-source</h3>
<p>Built for and maintained by the community via <a href="https://github.com">GitHub</a>.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-twitter.png">
<h3>Made at Twitter</h3>
<p>Brought to you by an experienced <a href="http://twitter.com/fat">engineer</a> and <a href="http://twitter.com/mdo">designer</a>.</p>
</div>
</div><!--/row-->
<!-- Quickstart options
================================================== -->
<h1>Get started in no time.</h1>
<p class="marketing-byline">Quickly start using Bootstrap within your workflow and development process.</p>
<table class="table table-bordered getting-started">
<tbody>
<tr>
<td class="quick-start">
<h3>Hotlink the CSS</h3>
<p>For the quickest and easiest start, just copy this snippet into your webpage.</p>
<form>
<textarea class="copy-code" rows="1">&lt;link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.min.css"></textarea>
</form>
</td>
<td class="quick-start">
<h3>Use it with LESS</h3>
<p>A fan of using LESS? No problem, just clone the repo and add these lines:</p>
<form>
<textarea class="copy-code" rows="2">&lt;link rel="stylesheet/less" href="/path/to/bootstrap.less"&gt;
&lt;script src="/path/to/less.js"&gt;&lt;/script&gt;</textarea>
</form>
</td>
<td class="quick-start">
<h3>Fork on GitHub</h3>
<p>Download, fork, pull, file issues, and more with the Bootstrap GitHub repo.</p>
<p><a target="_blank" href="https://github.com/twitter/bootstrap" class="btn primary">Bootstrap on GitHub &raquo;</a></p>
<p class="current-version">Currently <a href="https://github.com/twitter/bootstrap/wiki/Changelog">v2.0.0</a></p>
</td>
</tr>
</tbody>
</table>
</div><!-- /.marketing -->
</div><!-- /#overview -->
<!-- Footer
================================================== -->
<footer class="footer">
@ -306,13 +304,27 @@
<p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</footer>
</div><!-- /container -->
<!-- Le javascript -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script src="assets/js/application.js"></script>
<!-- <script src="http://code.jquery.com/jquery-1.7.min.js"></script> -->
<script src="../js/tests/vendor/jquery.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="../js/bootstrap-transition.js"></script>
<script src="../js/bootstrap-alert.js"></script>
<script src="../js/bootstrap-modal.js"></script>
<script src="../js/bootstrap-dropdown.js"></script>
<script src="../js/bootstrap-scrollspy.js"></script>
<script src="../js/bootstrap-tab.js"></script>
<script src="../js/bootstrap-tooltip.js"></script>
<script src="../js/bootstrap-popover.js"></script>
<script src="../js/bootstrap-button.js"></script>
<script src="../js/bootstrap-collapse.js"></script>
<script src="../js/bootstrap-carousel.js"></script>
<script src="../js/bootstrap-typeahead.js"></script>
<script src="assets/js/application.js"></script>
</body>
</html>

View File

@ -25,7 +25,7 @@
</head>
<body id="bootstrap-js">
<body>
<!-- Navbar
================================================== -->
@ -34,8 +34,8 @@
<div class="container">
<a class="brand" href="./index.html">Bootstrap</a>
<ul class="nav">
<li><a href="./index.html">Overview</a></li>
<li class="dropdown">
<li class=""><a href="./index.html">Overview</a></li>
<li class="dropdown ">
<a href="./scaffolding.html" class="dropdown-toggle" data-toggle="dropdown">
Scaffolding
<b class="caret"></b>
@ -46,7 +46,7 @@
<li><a href="./scaffolding.html#responsive">Responsive design</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./base-css.html" class="dropdown-toggle" data-toggle="dropdown">
Base CSS
<b class="caret"></b>
@ -59,7 +59,7 @@
<li><a href="./base-css.html#icons">Icons by Glyphicons</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./components.html" class="dropdown-toggle" data-toggle="dropdown">
Components
<b class="caret"></b>
@ -96,7 +96,7 @@
<li><a href="./javascript.html#typeahead">Typeahead</a></li>
</ul>
</li>
<li>
<li class="">
<a href="./less.html">
Using LESS
</a>
@ -107,1308 +107,1306 @@
</div>
<div class="container">
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Javascript for Bootstrap</h1>
<p class="lead">Bring Bootstrap's components to life&mdash;now with 12 custom <a href="http://jquery.com/" target="_blank">jQuery</a> plugins.
</header>
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Javascript for Bootstrap</h1>
<p class="lead">Bring Bootstrap's components to life&mdash;now with 12 custom <a href="http://jquery.com/" target="_blank">jQuery</a> plugins.
</header>
<!-- Using Javascript w/ Bootstrap
================================================== -->
<section id="javascript">
<div class="page-header">
<h1>jQuery plugins <small>A dozen Bootstrap plugins to get you started</small></h1>
</div>
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#modals">Modals</a><input checked="true" value="bootstrap-modal.js" type="checkbox"></h3>
<p>A streamlined, but flexible, take on the traditional javascript modal plugin with only the minimum required functionality and smart defaults.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#dropdowns">Dropdowns</a><input checked="true" value="bootstrap-dropdown.js" type="checkbox"></h3>
<p>Add dropdown menus to nearly anything in Bootstrap with this simple plugin. Bootstrap features full dropdown menu support on in the navbar, tabs, and pills.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#scrollspy">Scrollspy</a><input checked="true" value="bootstrap-scrollspy.js" type="checkbox"></h3>
<p>Use scrollspy to automatically update the links in your navbar to show the current active link based on scroll position.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#tabs">Togglable tabs</a><input checked="true" value="bootstrap-tab.js" type="checkbox"></h3>
<p>Use this plugin to make tabs and pills more useful by allowing them to toggle through tabbable panes of local content.</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#tooltips">Tooltips</a><input checked="true" value="bootstrap-tooltip.js" type="checkbox"></h3>
<p>A new take on the jQuery Tipsy plugin, Tooltips don't rely on images, uss CSS3 for animations, and data-attributes for local title storage.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#popovers">Popovers</a> <small class="muted">*</small><input checked="true" value="bootstrap-popover.js" type="checkbox"></h3>
<p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
<p class="muted"><strong>*</strong> Requires <a href="#tooltips">Tooltips</a> to be included</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#alerts">Alert messages</a><input checked="true" value="bootstrap-alert.js" type="checkbox"></h3>
<p>The alert plugin is a tiny class for adding close functionality to alerts.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#buttons">Buttons</a><input checked="true" value="bootstrap-button.js" type="checkbox"></h3>
<p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#collapse">Collapse</a><input checked="true" value="bootstrap-collapse.js" type="checkbox"></h3>
<p>Get base styles and flexible support for collapsible components like accordions and navigation.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#carousel">Carousel</a><input checked="true" value="bootstrap-carousel.js" type="checkbox"></h3>
<p>Create a merry-go-round of any content you wish to provide an interactive slideshow of content.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#typeahead">Typeahead</a><input checked="true" value="bootstrap-typeahead.js" type="checkbox"></h3>
<p>A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#transitions">Transitions</a> <small class="muted">*</small><input value="bootstrap-transition.js" checked="true" type="checkbox"></h3>
<p>For simple transition effects, include bootstrap-transition.js once to slide in modals or fade out alerts.</p>
<p class="muted"><strong>*</strong> Required for animation in plugins</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<div class="btn-group" id="javascriptBuilder">
<a id="javascriptBuild" class="btn primary large" href="#">Download Source</a>
<a class="btn primary large dropdown-toggle" data-toggle="dropdown" href="#">
<span class="caret"></span>
</a>
<ul class="dropdown-menu large">
<li class="active"><a href="#">Compressed</a></li>
<li><a href="#">Uncompressed</a></li>
</ul>
<!-- Using Javascript w/ Bootstrap
================================================== -->
<section id="javascript">
<div class="page-header">
<h1>jQuery plugins <small>A dozen Bootstrap plugins to get you started</small></h1>
</div>
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#modals">Modals</a><input checked="true" value="bootstrap-modal.js" type="checkbox"></h3>
<p>A streamlined, but flexible, take on the traditional javascript modal plugin with only the minimum required functionality and smart defaults.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#dropdowns">Dropdowns</a><input checked="true" value="bootstrap-dropdown.js" type="checkbox"></h3>
<p>Add dropdown menus to nearly anything in Bootstrap with this simple plugin. Bootstrap features full dropdown menu support on in the navbar, tabs, and pills.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#scrollspy">Scrollspy</a><input checked="true" value="bootstrap-scrollspy.js" type="checkbox"></h3>
<p>Use scrollspy to automatically update the links in your navbar to show the current active link based on scroll position.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#tabs">Togglable tabs</a><input checked="true" value="bootstrap-tab.js" type="checkbox"></h3>
<p>Use this plugin to make tabs and pills more useful by allowing them to toggle through tabbable panes of local content.</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#tooltips">Tooltips</a><input checked="true" value="bootstrap-tooltip.js" type="checkbox"></h3>
<p>A new take on the jQuery Tipsy plugin, Tooltips don't rely on images, uss CSS3 for animations, and data-attributes for local title storage.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#popovers">Popovers</a> <small class="muted">*</small><input checked="true" value="bootstrap-popover.js" type="checkbox"></h3>
<p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
<p class="muted"><strong>*</strong> Requires <a href="#tooltips">Tooltips</a> to be included</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#alerts">Alert messages</a><input checked="true" value="bootstrap-alert.js" type="checkbox"></h3>
<p>The alert plugin is a tiny class for adding close functionality to alerts.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#buttons">Buttons</a><input checked="true" value="bootstrap-button.js" type="checkbox"></h3>
<p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#collapse">Collapse</a><input checked="true" value="bootstrap-collapse.js" type="checkbox"></h3>
<p>Get base styles and flexible support for collapsible components like accordions and navigation.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#carousel">Carousel</a><input checked="true" value="bootstrap-carousel.js" type="checkbox"></h3>
<p>Create a merry-go-round of any content you wish to provide an interactive slideshow of content.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#typeahead">Typeahead</a><input checked="true" value="bootstrap-typeahead.js" type="checkbox"></h3>
<p>A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#transitions">Transitions</a> <small class="muted">*</small><input value="bootstrap-transition.js" checked="true" type="checkbox"></h3>
<p>For simple transition effects, include bootstrap-transition.js once to slide in modals or fade out alerts.</p>
<p class="muted"><strong>*</strong> Required for animation in plugins</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<div class="btn-group" id="javascriptBuilder">
<a id="javascriptBuild" class="btn primary large" href="#">Download Source</a>
<a class="btn primary large dropdown-toggle" data-toggle="dropdown" href="#">
<span class="caret"></span>
</a>
<ul class="dropdown-menu large">
<li class="active"><a href="#">Compressed</a></li>
<li><a href="#">Uncompressed</a></li>
</ul>
</div>
</div>
</div>
<hr>
<a id="selectAll" href="#" style="float:right">Select/Unselect All Plugins</a>
<p class="muted"><span class="label warning">Note:</span> All plugins require the latest version of <a href="http://jquery.com/" target="_blank">jQuery</a> to be included.</p>
</section>
<!-- Modal
================================================== -->
<section id="modals">
<div class="page-header">
<h1>Modals <small>bootstrap-modal.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About modals</h3>
<p>A streamlined, but flexible, take on the traditional javascript modal plugin with only the minimum required functionality and smart defaults.</p>
<a href="../js/bootstrap-modal.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Static example</h2>
<p>Below is a statically rendered modal.</p>
<div class="well" style="background-color: #888; border: none;">
<div class="modal" style="position: relative; top: auto; left: auto; margin: 0 auto; z-index: 1">
<div class="modal-header">
<a href="#" class="close" data-dismiss="modal">&times;</a>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<a href="#" class="btn primary">Save changes</a>
<a href="#" class="btn">Close</a>
</div>
</div>
</div> <!-- /well -->
<h2>Live demo</h2>
<p>Toggle a modal via javascript by clicking the button below. It will slide down and fade in from the top of the page.</p>
<!-- sample modal content -->
<div id="myModal" class="modal hide fade">
<div class="modal-header">
<a href="#" class="close" data-dismiss="modal" >&times;</a>
<h3>Modal Heading</h3>
</div>
<div class="modal-body">
<h4>Text in a modal</h4>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem.</p>
<h4>Popover in a modal</h4>
<p>This <a href="#" class="btn" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">button</a> should trigger a popover on hover.</p>
<h4>Tooltips in a modal</h4>
<p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> should have tooltips on hover.</p>
</div>
<div class="modal-footer">
<a href="#" class="btn primary">Save changes</a>
<a href="#" class="btn" data-dismiss="modal" >Close</a>
</div>
</div>
<a data-toggle="modal" href="#myModal" class="btn primary large">Launch demo modal</a>
<hr>
<a id="selectAll" href="#" style="float:right">Select/Unselect All Plugins</a>
<p class="muted"><span class="label warning">Note:</span> All plugins require the latest version of <a href="http://jquery.com/" target="_blank">jQuery</a> to be included.</p>
</section>
<!-- Modal
================================================== -->
<section id="modals">
<div class="page-header">
<h1>Modals <small>bootstrap-modal.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About modals</h3>
<p>A streamlined, but flexible, take on the traditional javascript modal plugin with only the minimum required functionality and smart defaults.</p>
<a href="../js/bootstrap-modal.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Static example</h2>
<p>Below is a statically rendered modal.</p>
<div class="well" style="background-color: #888; border: none;">
<div class="modal" style="position: relative; top: auto; left: auto; margin: 0 auto; z-index: 1">
<div class="modal-header">
<a href="#" class="close" data-dismiss="modal">&times;</a>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<a href="#" class="btn primary">Save changes</a>
<a href="#" class="btn">Close</a>
</div>
</div>
</div> <!-- /well -->
<h2>Live demo</h2>
<p>Toggle a modal via javascript by clicking the button below. It will slide down and fade in from the top of the page.</p>
<!-- sample modal content -->
<div id="myModal" class="modal hide fade">
<div class="modal-header">
<a href="#" class="close" data-dismiss="modal" >&times;</a>
<h3>Modal Heading</h3>
</div>
<div class="modal-body">
<h4>Text in a modal</h4>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem.</p>
<h4>Popover in a modal</h4>
<p>This <a href="#" class="btn" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">button</a> should trigger a popover on hover.</p>
<h4>Tooltips in a modal</h4>
<p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> should have tooltips on hover.</p>
</div>
<div class="modal-footer">
<a href="#" class="btn primary">Save changes</a>
<a href="#" class="btn" data-dismiss="modal" >Close</a>
</div>
</div>
<a data-toggle="modal" href="#myModal" class="btn primary large">Launch demo modal</a>
<hr>
<h2>Using bootstrap-modal</h2>
<p>Call the modal via javascript:</p>
<pre class="prettyprint linenums">$('#myModal').modal(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>backdrop</td>
<td>boolean</td>
<td>true</td>
<td>Includes a modal-backdrop element</td>
</tr>
<tr>
<td>keyboard</td>
<td>boolean</td>
<td>true</td>
<td>Closes the modal when escape key is pressed</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>You can activate modals on your page easily without having to write a single line of javascript. Just set <code>data-toggle="modal"</code> on a controller element with a <code>data-target="#foo"</code> or <code>href="#foo"</code> which corresponds to a modal element id, and when clicked, it will launch your modal.</p>
<p>Also, to add options to your modal instance, just include them as additional data attributes on either the control element or the modal markup itself.</p>
<h2>Using bootstrap-modal</h2>
<p>Call the modal via javascript:</p>
<pre class="prettyprint linenums">$('#myModal').modal(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>backdrop</td>
<td>boolean</td>
<td>true</td>
<td>Includes a modal-backdrop element</td>
</tr>
<tr>
<td>keyboard</td>
<td>boolean</td>
<td>true</td>
<td>Closes the modal when escape key is pressed</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>You can activate modals on your page easily without having to write a single line of javascript. Just set <code>data-toggle="modal"</code> on a controller element with a <code>data-target="#foo"</code> or <code>href="#foo"</code> which corresponds to a modal element id, and when clicked, it will launch your modal.</p>
<p>Also, to add options to your modal instance, just include them as additional data attributes on either the control element or the modal markup itself.</p>
<pre class="prettyprint linenums">
&lt;a class="btn" data-toggle="modal" href="#myModal" &gt;Launch Modal&lt;/a&gt;
</pre>
<pre class="prettyprint linenums">
&lt;div class="modal"&gt;
&lt;div class="modal-header"&gt;
&lt;a href="#" class="close js-dismiss"&gt;&times;&lt;/a&gt;
&lt;h3&gt;Modal header&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
&lt;p&gt;One fine body…&lt;/p&gt;
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;a href="#" class="btn primary"&gt;Save changes&lt;/a&gt;
&lt;a href="#" class="btn"&gt;Close&lt;/a&gt;
&lt;/div&gt;
&lt;div class="modal-header"&gt;
&lt;a href="#" class="close js-dismiss"&gt;&times;&lt;/a&gt;
&lt;h3&gt;Modal header&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
&lt;p&gt;One fine body…&lt;/p&gt;
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;a href="#" class="btn primary"&gt;Save changes&lt;/a&gt;
&lt;a href="#" class="btn"&gt;Close&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
<p><span class="label notice">Notice</span> If you want your modal to animate in and out, just add a <code>.fade</code> class to the <code>.modal</code> element (refer to the demo to see this in action).</p>
<h3>Methods</h3>
<h4>.modal(options)</h4>
<p>Activates your content as a modal. Accepts an optional options <code>object</code>.
<p><span class="label notice">Notice</span> If you want your modal to animate in and out, just add a <code>.fade</code> class to the <code>.modal</code> element (refer to the demo to see this in action).</p>
<h3>Methods</h3>
<h4>.modal(options)</h4>
<p>Activates your content as a modal. Accepts an optional options <code>object</code>.
<pre class="prettyprint linenums">
$('#myModal').modal({
keyboard: false
keyboard: false
})</pre>
<h4>.modal('toggle')</h4>
<p>Manually toggles a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('toggle')</pre>
<h4>.modal('show')</h4>
<p>Manually opens a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('show')</pre>
<h4>.modal('hide')</h4>
<p>Manually hides a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('hide')</pre>
<h3>Events</h3>
<p>Bootstrap's modal class exposes a few events for hooking into modal functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires immediately when the <code>show</code> instance method is called.</td>
</tr>
<tr>
<td>shown</td>
<td>This event is fired when the modal has been made visible to the user (will wait for css transitions to complete).</td>
</tr>
<tr>
<td>hide</td>
<td>This event is fired immediately when the <code>hide</code> instance method has been called.</td>
</tr>
<tr>
<td>hidden</td>
<td>This event is fired when the modal has finished being hidden from the user (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<h4>.modal('toggle')</h4>
<p>Manually toggles a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('toggle')</pre>
<h4>.modal('show')</h4>
<p>Manually opens a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('show')</pre>
<h4>.modal('hide')</h4>
<p>Manually hides a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('hide')</pre>
<h3>Events</h3>
<p>Bootstrap's modal class exposes a few events for hooking into modal functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires immediately when the <code>show</code> instance method is called.</td>
</tr>
<tr>
<td>shown</td>
<td>This event is fired when the modal has been made visible to the user (will wait for css transitions to complete).</td>
</tr>
<tr>
<td>hide</td>
<td>This event is fired immediately when the <code>hide</code> instance method has been called.</td>
</tr>
<tr>
<td>hidden</td>
<td>This event is fired when the modal has finished being hidden from the user (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<pre class="prettyprint linenums">
$('#myModal').on('hidden', function () {
// do something ...
// do something ...
})</pre>
</div>
</div>
</section>
</div>
</div>
</section>
<!-- Dropdown
================================================== -->
<section id="dropdowns">
<div class="page-header">
<h1>Dropdowns <small>bootstrap-dropdown.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About dropdowns</h3>
<p>Add dropdown menus to nearly anything in Bootstrap with this simple plugin. Bootstrap features full dropdown menu support on in the navbar, tabs, and pills.</p>
<a href="../js/bootstrap-dropdown.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Examples</h2>
<p>Click on the dropdown nav links in the navbar and pills below to test dropdowns.</p>
<div id="navbar-example" class="navbar navbar-static">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<a class="brand" href="#">Project Name</a>
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<!-- Dropdown
================================================== -->
<section id="dropdowns">
<div class="page-header">
<h1>Dropdowns <small>bootstrap-dropdown.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About dropdowns</h3>
<p>Add dropdown menus to nearly anything in Bootstrap with this simple plugin. Bootstrap features full dropdown menu support on in the navbar, tabs, and pills.</p>
<a href="../js/bootstrap-dropdown.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Examples</h2>
<p>Click on the dropdown nav links in the navbar and pills below to test dropdowns.</p>
<div id="navbar-example" class="navbar navbar-static">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<a class="brand" href="#">Project Name</a>
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
<ul class="nav pull-right">
<li id="fat-menu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 3 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
</div>
</div> <!-- /navbar-example -->
</li>
</ul>
<ul class="nav pull-right">
<li id="fat-menu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 3 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div> <!-- /navbar-example -->
<ul class="nav pills">
<li class="active"><a href="#">Regular link</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
<ul id="menu1" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown 2 <b class="caret"></b></a>
<ul id="menu2" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown 3 <b class="caret"></b></a>
<ul id="menu3" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul> <!-- /tabs -->
<ul class="nav pills">
<li class="active"><a href="#">Regular link</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
<ul id="menu1" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown 2 <b class="caret"></b></a>
<ul id="menu2" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown 3 <b class="caret"></b></a>
<ul id="menu3" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul> <!-- /tabs -->
<hr>
<hr>
<h2>Using bootstrap-dropdown.js</h2>
<p>Call the dropdowns via javascript:</p>
<pre class="prettyprint linenums">$('.dropdown-toggle').dropdown()</pre>
<h3>Markup</h3>
<p>To quickly add dropdown functionality to any element just add <code>data-toggle="dropdown"</code> and any valid bootstrap dropdown will automatically be activated.</p>
<p><span class="label notice">Notice</span> For added control and flexibility, optionally specify a <code>data-target="#fat"</code> or <code>href="#fat"</code> - this allows you to target specific dropdowns.</p>
<h2>Using bootstrap-dropdown.js</h2>
<p>Call the dropdowns via javascript:</p>
<pre class="prettyprint linenums">$('.dropdown-toggle').dropdown()</pre>
<h3>Markup</h3>
<p>To quickly add dropdown functionality to any element just add <code>data-toggle="dropdown"</code> and any valid bootstrap dropdown will automatically be activated.</p>
<p><span class="label notice">Notice</span> For added control and flexibility, optionally specify a <code>data-target="#fat"</code> or <code>href="#fat"</code> - this allows you to target specific dropdowns.</p>
<pre class="prettyprint linenums">
&lt;ul class="nav pills"&gt;
&lt;li class="active"&gt;&lt;a href="#"&gt;Regular link&lt;/a&gt;&lt;/li&gt;
&lt;li class="dropdown" id="menu1"&gt;
&lt;a class="dropdown-toggle" data-toggle="dropdown" href="#menu1"&gt;
Dropdown
&lt;b class="caret"&gt;&lt;/b&gt;
&lt;/a&gt;
&lt;ul class="dropdown-menu"&gt;
&lt;li&gt;&lt;a href="#"&gt;Action&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Another action&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Something else here&lt;/a&gt;&lt;/li&gt;
&lt;li class="divider"&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Separated link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
...
&lt;li class="active"&gt;&lt;a href="#"&gt;Regular link&lt;/a&gt;&lt;/li&gt;
&lt;li class="dropdown" id="menu1"&gt;
&lt;a class="dropdown-toggle" data-toggle="dropdown" href="#menu1"&gt;
Dropdown
&lt;b class="caret"&gt;&lt;/b&gt;
&lt;/a&gt;
&lt;ul class="dropdown-menu"&gt;
&lt;li&gt;&lt;a href="#"&gt;Action&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Another action&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Something else here&lt;/a&gt;&lt;/li&gt;
&lt;li class="divider"&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Separated link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
...
&lt;/ul&gt;</pre>
<h3>Methods</h3>
<h4>$().dropdown()</h4>
<p>
A programatic api for activating menus for a given navbar or tabbed navigation.
</p>
</div>
</div>
</section>
<h3>Methods</h3>
<h4>$().dropdown()</h4>
<p>
A programatic api for activating menus for a given navbar or tabbed navigation.
</p>
</div>
</div>
</section>
<!-- ScrollSpy
================================================== -->
<section id="scrollspy">
<div class="page-header">
<h1>ScrollSpy <small>bootstrap-scrollspy.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<p>The ScrollSpy plugin is for automatically updating nav targets based on scroll position.</p>
<a href="../js/bootstrap-scrollspy.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example navbar with scrollspy</h2>
<p>Scroll the area below and watch the navigation update. The dropdown sub items will be highlighted as well. Try it!</p>
<div id="navbarExample" class="navbar navbar-static">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<a class="brand" href="#">Project Name</a>
<ul class="nav">
<li><a href="#fat">@fat</a></li>
<li><a href="#mdo">@mdo</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#one">one</a></li>
<li><a href="#two">two</a></li>
<li class="divider"></li>
<li><a href="#three">three</a></li>
</ul>
</li>
<!-- ScrollSpy
================================================== -->
<section id="scrollspy">
<div class="page-header">
<h1>ScrollSpy <small>bootstrap-scrollspy.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<p>The ScrollSpy plugin is for automatically updating nav targets based on scroll position.</p>
<a href="../js/bootstrap-scrollspy.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example navbar with scrollspy</h2>
<p>Scroll the area below and watch the navigation update. The dropdown sub items will be highlighted as well. Try it!</p>
<div id="navbarExample" class="navbar navbar-static">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<a class="brand" href="#">Project Name</a>
<ul class="nav">
<li><a href="#fat">@fat</a></li>
<li><a href="#mdo">@mdo</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#one">one</a></li>
<li><a href="#two">two</a></li>
<li class="divider"></li>
<li><a href="#three">three</a></li>
</ul>
</div>
</div>
</li>
</ul>
</div>
<div data-spy="scroll" data-target="#navbarExample" data-offset="0" class="scrollspy-example">
<h4 id="fat">@fat</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
<h4 id="mdo">@mdo</h4>
<p>
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.
</p>
<h4 id="one">one</h4>
<p>
Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.
</p>
<h4 id="two">two</h4>
<p>
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
</p>
<h4 id="three">three</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
<p>Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
</p>
</div>
<hr>
<h2>Using bootstrap-scrollspy.js</h2>
<p>Call the scrollspy via javascript:</p>
<pre class="prettyprint linenums">$('#navbar').scrollspy()</pre>
<h3>Markup</h3>
<p>To easily add scrollspy behavior to your topbar navigation, just add <code>data-spy="scroll"</code> to the element you want to spy on (most typically this would be the body).
<pre class="prettyprint linenums">&lt;body data-spy="scroll" &gt;...&lt;/body&gt;</pre>
<p><span class="label notice">Notice</span> Navbar anchor tags must have resolvable id targets. For example, a <code>&lt;a href="#home"&gt;home&lt;/a&gt;</code> must correspond to something in the dom like <code>&lt;div id="home"&gt;&lt;/div&gt;</code>.
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>offset</td>
<td>number</td>
<td>10</td>
<td>Pixels to offset from top when calculating position of scroll.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- Tabs
================================================== -->
<section id="tabs">
<div class="page-header">
<h1>Togglable tabs <small>bootstrap-tab.js</small></h1>
<div data-spy="scroll" data-target="#navbarExample" data-offset="0" class="scrollspy-example">
<h4 id="fat">@fat</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
<h4 id="mdo">@mdo</h4>
<p>
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.
</p>
<h4 id="one">one</h4>
<p>
Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.
</p>
<h4 id="two">two</h4>
<p>
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
</p>
<h4 id="three">three</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
<p>Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
</p>
</div>
<div class="row">
<div class="span3 columns">
<p>This plugin adds quick, dynamic tab and pill functionality for transitioning through local content.</p>
<a href="../js/bootstrap-tab.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example tabs</h2>
<p>Click the tabs below to toggle between hidden panes, even via dropdown menus.</p>
<ul id="tab" class="nav tabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li><a href="#profile" data-toggle="tab">Profile</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#dropdown1" data-toggle="tab">@fat</a></li>
<li><a href="#dropdown2" data-toggle="tab">@mdo</a></li>
</ul>
</li>
<hr>
<h2>Using bootstrap-scrollspy.js</h2>
<p>Call the scrollspy via javascript:</p>
<pre class="prettyprint linenums">$('#navbar').scrollspy()</pre>
<h3>Markup</h3>
<p>To easily add scrollspy behavior to your topbar navigation, just add <code>data-spy="scroll"</code> to the element you want to spy on (most typically this would be the body).
<pre class="prettyprint linenums">&lt;body data-spy="scroll" &gt;...&lt;/body&gt;</pre>
<p><span class="label notice">Notice</span> Navbar anchor tags must have resolvable id targets. For example, a <code>&lt;a href="#home"&gt;home&lt;/a&gt;</code> must correspond to something in the dom like <code>&lt;div id="home"&gt;&lt;/div&gt;</code>.
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>offset</td>
<td>number</td>
<td>10</td>
<td>Pixels to offset from top when calculating position of scroll.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- Tabs
================================================== -->
<section id="tabs">
<div class="page-header">
<h1>Togglable tabs <small>bootstrap-tab.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<p>This plugin adds quick, dynamic tab and pill functionality for transitioning through local content.</p>
<a href="../js/bootstrap-tab.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example tabs</h2>
<p>Click the tabs below to toggle between hidden panes, even via dropdown menus.</p>
<ul id="tab" class="nav tabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li><a href="#profile" data-toggle="tab">Profile</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#dropdown1" data-toggle="tab">@fat</a></li>
<li><a href="#dropdown2" data-toggle="tab">@mdo</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home">
<p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
</div>
<div class="tab-pane fade" id="profile">
<p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
</div>
<div class="tab-pane fade" id="dropdown1">
<p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p>
</div>
<div class="tab-pane fade" id="dropdown2">
<p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
</div>
</div>
<hr>
<h2>Using bootstrap-tab.js</h2>
<p>Enable tabbable tabs via javascript:</p>
<pre class="prettyprint linenums">$('#myTab').tab('show')</pre>
<h3>Markup</h3>
<p>You can activate a tab or pill navigation without writing any javascript by simply specifying <code>data-toggle="tab"</code> or <code>data-toggle="pill"</code> on an element.</p>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home">
<p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
</div>
<div class="tab-pane fade" id="profile">
<p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
</div>
<div class="tab-pane fade" id="dropdown1">
<p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p>
</div>
<div class="tab-pane fade" id="dropdown2">
<p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
</div>
</div>
<hr>
<h2>Using bootstrap-tab.js</h2>
<p>Enable tabbable tabs via javascript:</p>
<pre class="prettyprint linenums">$('#myTab').tab('show')</pre>
<h3>Markup</h3>
<p>You can activate a tab or pill navigation without writing any javascript by simply specifying <code>data-toggle="tab"</code> or <code>data-toggle="pill"</code> on an element.</p>
<pre class="prettyprint linenums">
&lt;ul class="tabs"&gt;
&lt;li&gt;&lt;a href="#home" data-toggle="tab"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#profile" data-toggle="tab"&gt;Profile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#messages" data-toggle="tab"&gt;Messages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#ettings" data-toggle="tab"&gt;Settings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#home" data-toggle="tab"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#profile" data-toggle="tab"&gt;Profile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#messages" data-toggle="tab"&gt;Messages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#ettings" data-toggle="tab"&gt;Settings&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<h3>Methods</h3>
<h4>$().tab</h4>
<p>
Activates a tab element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the dom.
</p>
<h3>Methods</h3>
<h4>$().tab</h4>
<p>
Activates a tab element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the dom.
</p>
<pre class="prettyprint linenums">
&lt;ul class="tabs"&gt;
&lt;li class="active"&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#profile"&gt;Profile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#messages"&gt;Messages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#settings"&gt;Settings&lt;/a&gt;&lt;/li&gt;
&lt;li class="active"&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#profile"&gt;Profile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#messages"&gt;Messages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#settings"&gt;Settings&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="tab-content"&gt;
&lt;div class="active" id="home"&gt;...&lt;/div&gt;
&lt;div id="profile"&gt;...&lt;/div&gt;
&lt;div id="messages"&gt;...&lt;/div&gt;
&lt;div id="settings"&gt;...&lt;/div&gt;
&lt;div class="active" id="home"&gt;...&lt;/div&gt;
&lt;div id="profile"&gt;...&lt;/div&gt;
&lt;div id="messages"&gt;...&lt;/div&gt;
&lt;div id="settings"&gt;...&lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
$(function () {
$('.tabs a:last').tab('show')
})
$(function () {
$('.tabs a:last').tab('show')
})
&lt;/script&gt;</pre>
</p>
<h3>Events</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires on tab show, but before the new tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
</tr>
<tr>
<td>shown</td>
<td>This event fires on tab show after a tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
</tr>
</tbody>
</table>
</p>
<h3>Events</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires on tab show, but before the new tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
</tr>
<tr>
<td>shown</td>
<td>This event fires on tab show after a tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
</tr>
</tbody>
</table>
<pre class="prettyprint linenums">
<pre class="prettyprint linenums">
$('a[data-toggle="tab"]').on('shown', function (e) {
e.target // activated tab
e.relatedTarget // previous tab
e.target // activated tab
e.relatedTarget // previous tab
})</pre>
</div>
</div>
</div>
</section>
<!-- Tooltips
================================================== -->
<section id="tooltips">
<div class="page-header">
<h1>Tooltips <small>bootstrap-tooltip.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About Tooltips</h3>
<p>Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don't rely on images, uss css3 for animations, and data-attributes for local title storage.</p>
<a href="../js/bootstrap-tooltip.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example use of Tooltips</h2>
<p>Hover over the links below to see tooltips:</p>
<div class="tooltip-demo well">
<p class="muted" style="margin-bottom: 0;">Tight pants next level keffiyeh <a href="#" rel='tooltip' title="first tooltip">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" rel='tooltip' title='Another tooltip'>have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A <a href="#" rel='tooltip' title='Another one here too'>really ironic</a> artisan whatever keytar, scenester farm-to-table banksy Austin <a href="#" rel='tooltip' title='The last tip!'>twitter handle</a> freegan cred raw denim single-origin coffee viral.
</p>
</div>
</section>
<hr>
<h2>Using bootstrap-tooltip.js</h2>
<p>Trigger the tooltip via javascript:</p>
<pre class="prettyprint linenums">$('#example').tooltip(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>animation</td>
<td>boolean</td>
<td>true</td>
<td>apply a css fade transition to the tooltip</td>
</tr>
<tr>
<td>placement</td>
<td>string</td>
<td>'top'</td>
<td>how to position the tooltip - top | bottom | left | right</td>
</tr>
<tr>
<td>selector</td>
<td>string</td>
<td>false</td>
<td>If a selector is provided, tooltip objects will be delegated to the specified targets.</td>
</tr>
<tr>
<td>title</td>
<td>string | function</td>
<td>''</td>
<td>default title value if `title` tag isn't present</td>
</tr>
<tr>
<td>trigger</td>
<td>string</td>
<td>'hover'</td>
<td>how tooltip is triggered - hover | focus | manual</td>
</tr>
<tr>
<td>delay</td>
<td>number | object</td>
<td>0</td>
<td>
<p>delay showing/hiding the tooltip (ms)</p>
<p>If a number is supplied, delay is applied to both hide/show</p>
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
</td>
</tr>
</tbody>
</table>
<p><span class="label notice">Notice</span> Individual tooltip instance options can alternatively be specified through the use of data attributes.</code></p>
<h3>Markup</h3>
<p>For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.</p>
<h3>Methods</h3>
<h4>$().tooltip(options)</h4>
<p>Attaches a tooltip handler to an element collection.</p>
<h4>.tooltip('show')</h4>
<p>Reveals an elements tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('show')</pre>
<h4>.tooltip('hide')</h4>
<p>Hides an elements tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('hide')</pre>
</div>
</div>
</section>
<!-- Tooltips
================================================== -->
<section id="tooltips">
<div class="page-header">
<h1>Tooltips <small>bootstrap-tooltip.js</small></h1>
<!-- Popovers
================================================== -->
<section id="popovers">
<div class="page-header">
<h1>Popovers <small>bootstrap-popover.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About popovers</h3>
<p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
<p class="muted"><strong>*</strong> Requires <a href="#tooltip">Tooltip</a> to be included</p>
<a href="../js/bootstrap-popover.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example hover popover</h2>
<p>Hover over the button to trigger the popover.</p>
<div class="well">
<a href="#" class="btn danger" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">hover for popover</a>
</div>
<div class="row">
<div class="span3 columns">
<h3>About Tooltips</h3>
<p>Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don't rely on images, uss css3 for animations, and data-attributes for local title storage.</p>
<a href="../js/bootstrap-tooltip.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example use of Tooltips</h2>
<p>Hover over the links below to see tooltips:</p>
<div class="tooltip-demo well">
<p class="muted" style="margin-bottom: 0;">Tight pants next level keffiyeh <a href="#" rel='tooltip' title="first tooltip">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" rel='tooltip' title='Another tooltip'>have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A <a href="#" rel='tooltip' title='Another one here too'>really ironic</a> artisan whatever keytar, scenester farm-to-table banksy Austin <a href="#" rel='tooltip' title='The last tip!'>twitter handle</a> freegan cred raw denim single-origin coffee viral.
</p>
</div>
<hr>
<h2>Using bootstrap-tooltip.js</h2>
<p>Trigger the tooltip via javascript:</p>
<pre class="prettyprint linenums">$('#example').tooltip(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>animation</td>
<td>boolean</td>
<td>true</td>
<td>apply a css fade transition to the tooltip</td>
</tr>
<tr>
<td>placement</td>
<td>string</td>
<td>'top'</td>
<td>how to position the tooltip - top | bottom | left | right</td>
</tr>
<tr>
<td>selector</td>
<td>string</td>
<td>false</td>
<td>If a selector is provided, tooltip objects will be delegated to the specified targets.</td>
</tr>
<tr>
<td>title</td>
<td>string | function</td>
<td>''</td>
<td>default title value if `title` tag isn't present</td>
</tr>
<tr>
<td>trigger</td>
<td>string</td>
<td>'hover'</td>
<td>how tooltip is triggered - hover | focus | manual</td>
</tr>
<tr>
<td>delay</td>
<td>number | object</td>
<td>0</td>
<td>
<p>delay showing/hiding the tooltip (ms)</p>
<p>If a number is supplied, delay is applied to both hide/show</p>
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
</td>
</tr>
</tbody>
</table>
<p><span class="label notice">Notice</span> Individual tooltip instance options can alternatively be specified through the use of data attributes.</code></p>
<h3>Markup</h3>
<p>For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.</p>
<h3>Methods</h3>
<h4>$().tooltip(options)</h4>
<p>Attaches a tooltip handler to an element collection.</p>
<h4>.tooltip('show')</h4>
<p>Reveals an elements tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('show')</pre>
<h4>.tooltip('hide')</h4>
<p>Hides an elements tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('hide')</pre>
</div>
<hr>
<h2>Using bootstrap-popover.js</h2>
<p>Enable popovers via javascript:</p>
<pre class="prettyprint linenums">$('#example').popover(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>animation</td>
<td>boolean</td>
<td>true</td>
<td>apply a css fade transition to the tooltip</td>
</tr>
<tr>
<td>placement</td>
<td>string</td>
<td>'right'</td>
<td>how to position the popover - top | bottom | left | right</td>
</tr>
<tr>
<td>selector</td>
<td>string</td>
<td>false</td>
<td>if a selector is provided, tooltip objects will be delegated to the specified targets</td>
</tr>
<tr>
<td>trigger</td>
<td>string</td>
<td>'hover'</td>
<td>how tooltip is triggered - hover | focus | manual</td>
</tr>
<tr>
<td>title</td>
<td>string | function</td>
<td>''</td>
<td>default title value if `title` attribute isn't present</td>
</tr>
<tr>
<td>content</td>
<td>string | function</td>
<td>''</td>
<td>default content value if `data-content` attribute isn't present</td>
</tr>
<tr>
<td>delay</td>
<td>number | object</td>
<td>0</td>
<td>
<p>delay showing/hiding the popover (ms)</p>
<p>If a number is supplied, delay is applied to both hide/show</p>
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
</td>
</tr>
</tbody>
</table>
<p><span class="label notice">Notice</span> Individual popover instance options can alternatively be specified through the use of data attributes.</code></p>
<h3>Markup</h3>
<p>
For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a the selector option.
</p>
<h3>Methods</h3>
<h4>$().popover(options)</h4>
<p>Initializes popovers for an element collection.</p>
<h4>.popover('show')</h4>
<p>Reveals an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('show')</pre>
<h4>.popover('hide')</h4>
<p>Hides an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('hide')</pre>
</div>
</div>
</section>
<!-- Alert
================================================== -->
<section id="alerts">
<div class="page-header">
<h1>Alert messages <small>bootstrap-alert.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About alerts</h3>
<p>The alert plugin is a tiny class for adding close functionality to alerts.</p>
<a href="../js/bootstrap-alerts.js" target="_blank" class="btn">Download</a>
</div>
<div class="span9 columns">
<h2>Example alerts</h2>
<p>The alerts plugin works on regular alert messages, and block messages.</p>
<div class="alert fade in">
<a class="close" data-dismiss="alert" href="#">&times;</a>
<strong>Holy guacamole!</strong> Best check yo self, youre not looking too good.
</div>
</section>
<!-- Popovers
================================================== -->
<section id="popovers">
<div class="page-header">
<h1>Popovers <small>bootstrap-popover.js</small></h1>
<div class="alert alert-block alert-error fade in">
<a class="close" data-dismiss="alert" href="#">&times;</a>
<h4 class="alert-heading">Oh snap! You got an error!</h4>
<p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
<p>
<a class="btn danger small" href="#">Take this action</a> <a class="btn small" href="#">Or do this</a>
</p>
</div>
<div class="row">
<div class="span3 columns">
<h3>About popovers</h3>
<p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
<p class="muted"><strong>*</strong> Requires <a href="#tooltip">Tooltip</a> to be included</p>
<a href="../js/bootstrap-popover.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example hover popover</h2>
<p>Hover over the button to trigger the popover.</p>
<div class="well">
<a href="#" class="btn danger" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">hover for popover</a>
</div>
<hr>
<h2>Using bootstrap-popover.js</h2>
<p>Enable popovers via javascript:</p>
<pre class="prettyprint linenums">$('#example').popover(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>animation</td>
<td>boolean</td>
<td>true</td>
<td>apply a css fade transition to the tooltip</td>
</tr>
<tr>
<td>placement</td>
<td>string</td>
<td>'right'</td>
<td>how to position the popover - top | bottom | left | right</td>
</tr>
<tr>
<td>selector</td>
<td>string</td>
<td>false</td>
<td>if a selector is provided, tooltip objects will be delegated to the specified targets</td>
</tr>
<tr>
<td>trigger</td>
<td>string</td>
<td>'hover'</td>
<td>how tooltip is triggered - hover | focus | manual</td>
</tr>
<tr>
<td>title</td>
<td>string | function</td>
<td>''</td>
<td>default title value if `title` attribute isn't present</td>
</tr>
<tr>
<td>content</td>
<td>string | function</td>
<td>''</td>
<td>default content value if `data-content` attribute isn't present</td>
</tr>
<tr>
<td>delay</td>
<td>number | object</td>
<td>0</td>
<td>
<p>delay showing/hiding the popover (ms)</p>
<p>If a number is supplied, delay is applied to both hide/show</p>
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
</td>
</tr>
</tbody>
</table>
<p><span class="label notice">Notice</span> Individual popover instance options can alternatively be specified through the use of data attributes.</code></p>
<h3>Markup</h3>
<p>
For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a the selector option.
</p>
<h3>Methods</h3>
<h4>$().popover(options)</h4>
<p>Initializes popovers for an element collection.</p>
<h4>.popover('show')</h4>
<p>Reveals an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('show')</pre>
<h4>.popover('hide')</h4>
<p>Hides an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('hide')</pre>
</div>
</div>
</section>
<!-- Alert
================================================== -->
<section id="alerts">
<div class="page-header">
<h1>Alert messages <small>bootstrap-alert.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About alerts</h3>
<p>The alert plugin is a tiny class for adding close functionality to alerts.</p>
<a href="../js/bootstrap-alerts.js" target="_blank" class="btn">Download</a>
</div>
<div class="span9 columns">
<h2>Example alerts</h2>
<p>The alerts plugin works on regular alert messages, and block messages.</p>
<div class="alert fade in">
<a class="close" data-dismiss="alert" href="#">&times;</a>
<strong>Holy guacamole!</strong> Best check yo self, youre not looking too good.
</div>
<div class="alert alert-block alert-error fade in">
<a class="close" data-dismiss="alert" href="#">&times;</a>
<h4 class="alert-heading">Oh snap! You got an error!</h4>
<p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
<p>
<a class="btn danger small" href="#">Take this action</a> <a class="btn small" href="#">Or do this</a>
</p>
</div>
<hr>
<h2>Using bootstrap-alerts.js</h2>
<p>Enable dismissal of an alert via javascript:</p>
<pre class="prettyprint linenums">$(".alert-message").alert()</pre>
<h3>Markup</h3>
<p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
<pre class="prettyprint linenums">&lt;a class="close" data-dismiss="alert" href="#"&gt;&amp;times;&lt;/a&gt;</pre>
<h3>Methods</h3>
<h4>$().alert()</h4>
<p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>
<h4>.alert('close')</h4>
<p>Closes an alert.</p>
<pre class="prettyprint linenums">$(".alert-message").alert('close')</pre>
<h3>Events</h3>
<p>Bootstrap's alert class exposes a few events for hooking into alert functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>close</td>
<td>This event fires immediately when the <code>close</code> instance method is called.</td>
</tr>
<tr>
<td>closed</td>
<td>This event is fired when the alert has been closed (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<hr>
<h2>Using bootstrap-alerts.js</h2>
<p>Enable dismissal of an alert via javascript:</p>
<pre class="prettyprint linenums">$(".alert-message").alert()</pre>
<h3>Markup</h3>
<p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
<pre class="prettyprint linenums">&lt;a class="close" data-dismiss="alert" href="#"&gt;&amp;times;&lt;/a&gt;</pre>
<h3>Methods</h3>
<h4>$().alert()</h4>
<p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>
<h4>.alert('close')</h4>
<p>Closes an alert.</p>
<pre class="prettyprint linenums">$(".alert-message").alert('close')</pre>
<h3>Events</h3>
<p>Bootstrap's alert class exposes a few events for hooking into alert functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>close</td>
<td>This event fires immediately when the <code>close</code> instance method is called.</td>
</tr>
<tr>
<td>closed</td>
<td>This event is fired when the alert has been closed (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<pre class="prettyprint linenums">
$('#my-alert').bind('closed', function () {
// do something ...
// do something ...
})</pre>
</div>
</div>
</section>
</div>
</div>
</section>
<!-- Buttons
================================================== -->
<section id="buttons">
<div class="page-header">
<h1>Buttons <small>bootstrap-button.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
<a href="../js/bootstrap-button.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example uses</h2>
<p>Use the buttons plugin for states and toggles.</p>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>Stateful</td>
<td>
<button id="fat-btn" data-loading-text="loading..." class="btn primary">
Loading State
</button>
</td>
</tr>
<tr>
<td>Single toggle</td>
<td>
<button class="btn primary" data-toggle="button">Single Toggle</button>
</td>
</tr>
<tr>
<td>Checkbox</td>
<td>
<div class="btn-group" data-toggle="buttons-checkbox">
<button class="btn primary">Left</button>
<button class="btn primary">Middle</button>
<button class="btn primary">Right</button>
</div>
</td>
</tr>
<tr>
<td>Radio</td>
<td>
<div class="btn-group" data-toggle="buttons-radio">
<button class="btn primary">Left</button>
<button class="btn primary">Middle</button>
<button class="btn primary">Right</button>
</div>
</td>
</tr>
</tbody>
</table>
<hr>
<h2>Using bootstrap-button.js</h2>
<p>Enable buttons via javascript:</p>
<pre class="prettyprint linenums">$('.tabs').button()</pre>
<h3>Markup</h3>
<p>Data attributes are integral to the button plugin. Check out the example code below for the various markup types.</p>
<!-- Buttons
================================================== -->
<section id="buttons">
<div class="page-header">
<h1>Buttons <small>bootstrap-button.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
<a href="../js/bootstrap-button.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example uses</h2>
<p>Use the buttons plugin for states and toggles.</p>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>Stateful</td>
<td>
<button id="fat-btn" data-loading-text="loading..." class="btn primary">
Loading State
</button>
</td>
</tr>
<tr>
<td>Single toggle</td>
<td>
<button class="btn primary" data-toggle="button">Single Toggle</button>
</td>
</tr>
<tr>
<td>Checkbox</td>
<td>
<div class="btn-group" data-toggle="buttons-checkbox">
<button class="btn primary">Left</button>
<button class="btn primary">Middle</button>
<button class="btn primary">Right</button>
</div>
</td>
</tr>
<tr>
<td>Radio</td>
<td>
<div class="btn-group" data-toggle="buttons-radio">
<button class="btn primary">Left</button>
<button class="btn primary">Middle</button>
<button class="btn primary">Right</button>
</div>
</td>
</tr>
</tbody>
</table>
<hr>
<h2>Using bootstrap-button.js</h2>
<p>Enable buttons via javascript:</p>
<pre class="prettyprint linenums">$('.tabs').button()</pre>
<h3>Markup</h3>
<p>Data attributes are integral to the button plugin. Check out the example code below for the various markup types.</p>
<pre class="prettyprint linenums">
&lt;!-- Add data-toggle="button" to activate toggling on a single button --&gt;
&lt;button class="btn" data-toggle="button"&gt;Single Toggle&lt;/button&gt;
&lt;!-- Add data-toggle="buttons-checkbox" for checkbox style toggling on btn-group --&gt;
&lt;div class="btn-group" data-toggle="buttons-checkbox"&gt;
&lt;button class="btn"&gt;Left&lt;/button&gt;
&lt;button class="btn"&gt;Middle&lt;/button&gt;
&lt;button class="btn"&gt;Right&lt;/button&gt;
&lt;button class="btn"&gt;Left&lt;/button&gt;
&lt;button class="btn"&gt;Middle&lt;/button&gt;
&lt;button class="btn"&gt;Right&lt;/button&gt;
&lt;/div&gt;
&lt;!-- Add data-toggle="buttons-radio" for radio style toggling on btn-group --&gt;
&lt;div class="btn-group" data-toggle="buttons-radio"&gt;
&lt;button class="btn"&gt;Left&lt;/button&gt;
&lt;button class="btn"&gt;Middle&lt;/button&gt;
&lt;button class="btn"&gt;Right&lt;/button&gt;
&lt;button class="btn"&gt;Left&lt;/button&gt;
&lt;button class="btn"&gt;Middle&lt;/button&gt;
&lt;button class="btn"&gt;Right&lt;/button&gt;
&lt;/div&gt;
</pre>
<h3>Methods</h3>
<h4>$().button('toggle')</h4>
<p>Toggles push state. Gives btn the look that it's been activated.</p>
<p><span class="label notice">Notice</span> You can enable auto toggling of a button by using the <code>data-toggle</code> attribute.</p>
<pre class="prettyprint linenums">&lt;button class="btn" data-toggle="button" &gt;...&lt;/button&gt;</pre>
<h4>$().button('loading')</h4>
<p>Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute <code>data-loading-text</code>.
</p>
<pre class="prettyprint linenums">&lt;button class="btn" data-loading-text="loading stuff..." &gt;...&lt;/button&gt;</pre>
<p>
<span class="label notice">Notice</span> Firefox persists the disabled state across page loads. A workaround for this is to use: <code>autocomplete="off"</code>. More info can be found <a href="https://github.com/twitter/bootstrap/issues/793">here</a>.
</p>
<h4>$().button('reset')</h4>
<p>Resets button state - swaps text to original text.</p>
<h4>$().button(string)</h4>
<p>Resets button state - swaps text to any data defined text state.</p>
<h3>Methods</h3>
<h4>$().button('toggle')</h4>
<p>Toggles push state. Gives btn the look that it's been activated.</p>
<p><span class="label notice">Notice</span> You can enable auto toggling of a button by using the <code>data-toggle</code> attribute.</p>
<pre class="prettyprint linenums">&lt;button class="btn" data-toggle="button" &gt;...&lt;/button&gt;</pre>
<h4>$().button('loading')</h4>
<p>Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute <code>data-loading-text</code>.
</p>
<pre class="prettyprint linenums">&lt;button class="btn" data-loading-text="loading stuff..." &gt;...&lt;/button&gt;</pre>
<p>
<span class="label notice">Notice</span> Firefox persists the disabled state across page loads. A workaround for this is to use: <code>autocomplete="off"</code>. More info can be found <a href="https://github.com/twitter/bootstrap/issues/793">here</a>.
</p>
<h4>$().button('reset')</h4>
<p>Resets button state - swaps text to original text.</p>
<h4>$().button(string)</h4>
<p>Resets button state - swaps text to any data defined text state.</p>
<pre class="prettyprint linenums">&lt;button class="btn" data-complete-text="finished!" &gt;...&lt;/button&gt;
&lt;script&gt;
$('.btn').button('complete')
$('.btn').button('complete')
&lt;/script&gt;</pre>
</div>
</div>
</section>
</div>
</div>
</section>
<!-- Collapse
================================================== -->
<section id="collapse">
<div class="page-header">
<h1>Collapse <small>bootstrap-collapse.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>Get base styles and flexible support for collapsible components like accordions and navigation.</p>
<a href="../js/bootstrap-collapse.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example accordion</h2>
<p>Using the collapse plugin, we built a simple accordion style widget:</p>
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
Collapsible Group Item #3
</a>
</div>
<div id="collapseThree" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
<!-- Collapse
================================================== -->
<section id="collapse">
<div class="page-header">
<h1>Collapse <small>bootstrap-collapse.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>Get base styles and flexible support for collapsible components like accordions and navigation.</p>
<a href="../js/bootstrap-collapse.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example accordion</h2>
<p>Using the collapse plugin, we built a simple accordion style widget:</p>
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
Collapsible Group Item #3
</a>
</div>
<div id="collapseThree" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
<hr>
<h2>Using bootstrap-collapse.js</h2>
<p>Enable via javascript:</p>
<pre class="prettyprint linenums">$(".collapse").collapse()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parent</td>
<td>selector</td>
<td>false</td>
<td>If selector then all collapsible elements under the specified parent will be closed when this collasabile item is shown. (similar to traditional accordion behavior)</td>
</tr>
<tr>
<td>toggle</td>
<td>boolean</td>
<td>true</td>
<td>Toggles the collapsible element on invocation</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>Just add <code>data-toggle="collapse"</code> and a <code>data-target</code> to element to automatically assign control of a collapsible element. The <code>data-target</code> attribute accepts a css selector to apply the collapse to. Be sure to add the class <code>collapse</code> to the collapsible element. If you'd like it to default open, add the additional class <code>in</code>.</p>
<pre class="prettyprint linenums">
<hr>
<h2>Using bootstrap-collapse.js</h2>
<p>Enable via javascript:</p>
<pre class="prettyprint linenums">$(".collapse").collapse()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parent</td>
<td>selector</td>
<td>false</td>
<td>If selector then all collapsible elements under the specified parent will be closed when this collasabile item is shown. (similar to traditional accordion behavior)</td>
</tr>
<tr>
<td>toggle</td>
<td>boolean</td>
<td>true</td>
<td>Toggles the collapsible element on invocation</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>Just add <code>data-toggle="collapse"</code> and a <code>data-target</code> to element to automatically assign control of a collapsible element. The <code>data-target</code> attribute accepts a css selector to apply the collapse to. Be sure to add the class <code>collapse</code> to the collapsible element. If you'd like it to default open, add the additional class <code>in</code>.</p>
<pre class="prettyprint linenums">
&lt;button class="btn danger" data-toggle="collapse" data-target="#demo"&gt;
simple collapsible
simple collapsible
&lt;/button&gt;
&lt;div id="demo" class="collapse in"&gt;&lt;/div&gt;</pre>
<p><span class="label notice">Notice</span> To add accordion like group management to a collapsible control just add the additional data attribute <code>data-parent="#selector"</code>. Refer to the demo below to see this in action.</p>
<h3>Methods</h3>
<h4>.collapse(options)</h4>
<p>Activates your content as a collapsible element. Accepts an optional options <code>object</code>.
<p><span class="label notice">Notice</span> To add accordion like group management to a collapsible control just add the additional data attribute <code>data-parent="#selector"</code>. Refer to the demo below to see this in action.</p>
<h3>Methods</h3>
<h4>.collapse(options)</h4>
<p>Activates your content as a collapsible element. Accepts an optional options <code>object</code>.
<pre class="prettyprint linenums">
$('#myCollapsible').collapse({
toggle: false
toggle: false
})</pre>
<h4>.collapse('toggle')</h4>
<p>Toggles a collapsible element to shown or hidden.</p>
<h4>.collapse('show')</h4>
<p>Shows a collapsible element.</p>
<h4>.collapse('hide')</h4>
<p>Hides a collapsible element.</p>
<h3>Events</h3>
<p>
Bootstrap's collapse class exposes a few events for hooking into collapse functionality.
</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires immediately when the <code>show</code> instance method is called.</td>
</tr>
<tr>
<td>shown</td>
<td>This event is fired when a collapse element has been made visible to the user (will wait for css transitions to complete).</td>
</tr>
<tr>
<td>hide</td>
<td>
This event is fired immediately when the <code>hide</code> method has been called.
</td>
</tr>
<tr>
<td>hidden</td>
<td>This event is fired when a collapse element has been hidden from the user (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<h4>.collapse('toggle')</h4>
<p>Toggles a collapsible element to shown or hidden.</p>
<h4>.collapse('show')</h4>
<p>Shows a collapsible element.</p>
<h4>.collapse('hide')</h4>
<p>Hides a collapsible element.</p>
<h3>Events</h3>
<p>
Bootstrap's collapse class exposes a few events for hooking into collapse functionality.
</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires immediately when the <code>show</code> instance method is called.</td>
</tr>
<tr>
<td>shown</td>
<td>This event is fired when a collapse element has been made visible to the user (will wait for css transitions to complete).</td>
</tr>
<tr>
<td>hide</td>
<td>
This event is fired immediately when the <code>hide</code> method has been called.
</td>
</tr>
<tr>
<td>hidden</td>
<td>This event is fired when a collapse element has been hidden from the user (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<pre class="prettyprint linenums">
$('#myCollapsible').on('hidden', function () {
// do something ...
// do something ...
})</pre>
</div>
</div>
</section>
</div>
</div>
</section>
<!-- Carousel
================================================== -->
<section id="carousel">
<div class="page-header">
<h1>Carousel <small>bootstrap-carousel.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>A generic plugin for cycling through elements. A merry-go-round.</p>
<a href="../js/bootstrap-carousel.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example carousel</h2>
<p>Watch the slideshow below.</p>
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="item active">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>First Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>Second Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>Third Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
<!-- Carousel
================================================== -->
<section id="carousel">
<div class="page-header">
<h1>Carousel <small>bootstrap-carousel.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>A generic plugin for cycling through elements. A merry-go-round.</p>
<a href="../js/bootstrap-carousel.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example carousel</h2>
<p>Watch the slideshow below.</p>
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="item active">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>First Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>
</div>
<hr>
<h2>Using bootstrap-carousel.js</h2>
<p>Call via javascript:</p>
<pre class="prettyprint linenums">$('.carousel').carousel()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>interval</td>
<td>number</td>
<td>5000</td>
<td>The amount of type to delay between automatically cycling an item.</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>Data attributes are integral to the carousel plugin. Check out the example code below for the various markup types.</p>
<div class="item">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>Second Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>Third Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>
</div>
<hr>
<h2>Using bootstrap-carousel.js</h2>
<p>Call via javascript:</p>
<pre class="prettyprint linenums">$('.carousel').carousel()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>interval</td>
<td>number</td>
<td>5000</td>
<td>The amount of type to delay between automatically cycling an item.</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>Data attributes are integral to the carousel plugin. Check out the example code below for the various markup types.</p>
<pre class="prettyprint linenums">
&lt;div class="carousel"&gt;
&lt;!-- Carousel items --&gt;
&lt;div class="carousel-inner"&gt;
...
&lt;/div&gt;
&lt;!-- Carousel nav --&gt;
&lt;a class="carousel-control left" href="#myCarousel" data-slide="prev"&gt;&amp;lsaquo;&lt;/a&gt;
&lt;a class="carousel-control right" href="#myCarousel" data-slide="next"&gt;&amp;rsaquo;&lt;/a&gt;
&lt;!-- Carousel items --&gt;
&lt;div class="carousel-inner"&gt;
...
&lt;/div&gt;
&lt;!-- Carousel nav --&gt;
&lt;a class="carousel-control left" href="#myCarousel" data-slide="prev"&gt;&amp;lsaquo;&lt;/a&gt;
&lt;a class="carousel-control right" href="#myCarousel" data-slide="next"&gt;&amp;rsaquo;&lt;/a&gt;
&lt;/div&gt;
</pre>
<h3>Methods</h3>
<h4>.carousel(options)</h4>
<p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p>
<h3>Methods</h3>
<h4>.carousel(options)</h4>
<p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p>
<pre class="prettyprint linenums">
$('.myCarousel').carousel({
interval: 2000
interval: 2000
})
</pre>
<h4>.carousel('cycle')</h4>
<p>Cycles through the carousel items from left to right.</p>
<h4>.carousel('pause')</h4>
<p>Stops the carousel from cycling through items.</p>
<h4>.carousel(number)</h4>
<p>Cycles the carousel to a particular frame (0 based, similar to an array).</p>
<h4>.carousel('prev')</h4>
<p>Cycles to the previous item.</p>
<h4>.carousel('next')</h4>
<p>Cycles to the next item.</p>
<h3>Events</h3>
<p>Bootstrap's modal class exposes a few events for hooking into modal functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>slide</td>
<td>This event fires immediately when the <code>slide</code> instance method is invoked.</td>
</tr>
<tr>
<td>slid</td>
<td>This event is fired when the carousel has completed it's slide transition.</td>
</tr>
</tr>
</tbody>
</table>
</div>
<h4>.carousel('cycle')</h4>
<p>Cycles through the carousel items from left to right.</p>
<h4>.carousel('pause')</h4>
<p>Stops the carousel from cycling through items.</p>
<h4>.carousel(number)</h4>
<p>Cycles the carousel to a particular frame (0 based, similar to an array).</p>
<h4>.carousel('prev')</h4>
<p>Cycles to the previous item.</p>
<h4>.carousel('next')</h4>
<p>Cycles to the next item.</p>
<h3>Events</h3>
<p>Bootstrap's modal class exposes a few events for hooking into modal functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>slide</td>
<td>This event fires immediately when the <code>slide</code> instance method is invoked.</td>
</tr>
<tr>
<td>slid</td>
<td>This event is fired when the carousel has completed it's slide transition.</td>
</tr>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- Typeahead
================================================== -->
<section id="typeahead">
<div class="page-header">
<h1>Typeahead <small>bootstrap-typeahead.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.</p>
<a href="../js/bootstrap-typeahead.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example</h2>
<p>Start typing in the field below to show the typeahead results.</p>
<div class="well">
<input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-data='["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"]'>
</div>
</section>
<hr>
<h2>Using bootstrap-typeahead.js</h2>
<p>Call the typeahead via javascript:</p>
<pre class="prettyprint linenums">$('.typeahead').typeahead()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>items</td>
<td>number</td>
<td>8</td>
<td>The max number of items to display in the dropdown.</td>
</tr>
</tbody>
</table>
<!-- Typeahead
================================================== -->
<section id="typeahead">
<div class="page-header">
<h1>Typeahead <small>bootstrap-typeahead.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.</p>
<a href="../js/bootstrap-typeahead.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example</h2>
<p>Start typing in the field below to show the typeahead results.</p>
<div class="well">
<input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-data='["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"]'>
</div>
<hr>
<h2>Using bootstrap-typeahead.js</h2>
<p>Call the typeahead via javascript:</p>
<pre class="prettyprint linenums">$('.typeahead').typeahead()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>items</td>
<td>number</td>
<td>8</td>
<td>The max number of items to display in the dropdown.</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>Add data attributes to register an element with typeahead functionality.</p>
<h3>Markup</h3>
<p>Add data attributes to register an element with typeahead functionality.</p>
<pre class="prettyprint linenums">
&lt;input type="text" data-provide="typeahead"&gt;
</pre>
</div>
</div>
</section>
</div>
</div>
</section>
<!-- Footer
================================================== -->
<footer class="footer">
@ -1417,6 +1415,7 @@ $('.myCarousel').carousel({
<p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</footer>
</div><!-- /container -->
@ -1438,34 +1437,5 @@ $('.myCarousel').carousel({
<script src="../js/bootstrap-carousel.js"></script>
<script src="../js/bootstrap-typeahead.js"></script>
<script src="assets/js/application.js"></script>
<script>
$(function () {
// tooltip demo
$('.tooltip-demo.well').tooltip({
selector: "a[rel=tooltip]"
})
$('.tooltip-test').tooltip()
// popover demo
$("a[rel=popover]")
.popover()
.click(function(e) {
e.preventDefault()
})
// button state demo
$('#fat-btn')
.click(function () {
var btn = $(this)
btn.button('loading')
setTimeout(function () {
btn.button('reset')
}, 3000)
})
// carousel demo
$('#myCarousel').carousel()
})
</script>
</body>
</html>

View File

@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@ -18,10 +18,11 @@
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" type="image/x-icon" href="assets/ico/favicon.ico">
<link rel="apple-touch-icon" href="assets/ico/bootstrap-apple-57x57.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/ico/bootstrap-apple-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/ico/bootstrap-apple-114x114.png">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
<body>
@ -33,8 +34,8 @@
<div class="container">
<a class="brand" href="./index.html">Bootstrap</a>
<ul class="nav">
<li><a href="./index.html">Overview</a></li>
<li class="dropdown">
<li class=""><a href="./index.html">Overview</a></li>
<li class="dropdown ">
<a href="./scaffolding.html" class="dropdown-toggle" data-toggle="dropdown">
Scaffolding
<b class="caret"></b>
@ -45,7 +46,7 @@
<li><a href="./scaffolding.html#responsive">Responsive design</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./base-css.html" class="dropdown-toggle" data-toggle="dropdown">
Base CSS
<b class="caret"></b>
@ -58,7 +59,7 @@
<li><a href="./base-css.html#icons">Icons by Glyphicons</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./components.html" class="dropdown-toggle" data-toggle="dropdown">
Components
<b class="caret"></b>
@ -75,7 +76,7 @@
<li><a href="./components.html#progress">Progress bars</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./javascript.html" class="dropdown-toggle" data-toggle="dropdown">
Javascript plugins
<b class="caret"></b>
@ -513,8 +514,6 @@
</div>
</section>
<!-- Footer
================================================== -->
<footer class="footer">
@ -523,13 +522,27 @@
<p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</footer>
</div><!-- /container -->
<!-- Le javascript -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<!-- <script src="http://code.jquery.com/jquery-1.7.min.js"></script> -->
<script src="../js/tests/vendor/jquery.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="assets/js/application.js"></script>
<script src="../js/bootstrap-transition.js"></script>
<script src="../js/bootstrap-alert.js"></script>
<script src="../js/bootstrap-modal.js"></script>
<script src="../js/bootstrap-dropdown.js"></script>
<script src="../js/bootstrap-scrollspy.js"></script>
<script src="../js/bootstrap-tab.js"></script>
<script src="../js/bootstrap-tooltip.js"></script>
<script src="../js/bootstrap-popover.js"></script>
<script src="../js/bootstrap-button.js"></script>
<script src="../js/bootstrap-collapse.js"></script>
<script src="../js/bootstrap-carousel.js"></script>
<script src="../js/bootstrap-typeahead.js"></script>
<script src="assets/js/application.js"></script>
</body>
</html>

View File

@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@ -18,10 +18,11 @@
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" type="image/x-icon" href="assets/ico/favicon.ico">
<link rel="apple-touch-icon" href="assets/ico/bootstrap-apple-57x57.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/ico/bootstrap-apple-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/ico/bootstrap-apple-114x114.png">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
<body>
@ -33,7 +34,7 @@
<div class="container">
<a class="brand" href="./index.html">Bootstrap</a>
<ul class="nav">
<li><a href="./index.html">Overview</a></li>
<li class=""><a href="./index.html">Overview</a></li>
<li class="dropdown active">
<a href="./scaffolding.html" class="dropdown-toggle" data-toggle="dropdown">
Scaffolding
@ -45,7 +46,7 @@
<li><a href="./scaffolding.html#responsive">Responsive design</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./base-css.html" class="dropdown-toggle" data-toggle="dropdown">
Base CSS
<b class="caret"></b>
@ -58,7 +59,7 @@
<li><a href="./base-css.html#icons">Icons by Glyphicons</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./components.html" class="dropdown-toggle" data-toggle="dropdown">
Components
<b class="caret"></b>
@ -75,7 +76,7 @@
<li><a href="./components.html#progress">Progress bars</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./javascript.html" class="dropdown-toggle" data-toggle="dropdown">
Javascript plugins
<b class="caret"></b>
@ -95,7 +96,7 @@
<li><a href="./javascript.html#typeahead">Typeahead</a></li>
</ul>
</li>
<li>
<li class="">
<a href="./less.html">
Using LESS
</a>
@ -107,12 +108,13 @@
<div class="container">
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Scaffolding</h1>
<p class="lead">Bootstrap is built on a responsive 12-column grid. We've also included fixed- and fluid-width layouts based on that system.</p>
</header>
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Scaffolding</h1>
<p class="lead">Bootstrap is built on a responsive 12-column grid. We've also included fixed- and fluid-width layouts based on that system.</p>
</header>
@ -417,8 +419,6 @@
</div>
</div>
</section>
<!-- Footer
================================================== -->
<footer class="footer">
@ -427,16 +427,27 @@
<p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</footer>
</div><!-- /container -->
<!-- Le javascript -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<!-- <script src="http://code.jquery.com/jquery-1.7.min.js"></script> -->
<script src="../js/tests/vendor/jquery.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="../js/bootstrap-transition.js"></script>
<script src="../js/bootstrap-tooltip.js"></script>
<script src="../js/bootstrap-alert.js"></script>
<script src="../js/bootstrap-modal.js"></script>
<script src="../js/bootstrap-dropdown.js"></script>
<script src="../js/bootstrap-scrollspy.js"></script>
<script src="../js/bootstrap-tab.js"></script>
<script src="../js/bootstrap-tooltip.js"></script>
<script src="../js/bootstrap-popover.js"></script>
<script src="../js/bootstrap-button.js"></script>
<script src="../js/bootstrap-collapse.js"></script>
<script src="../js/bootstrap-carousel.js"></script>
<script src="../js/bootstrap-typeahead.js"></script>
<script src="assets/js/application.js"></script>
</body>
</html>

144
docs/templates/layout.mustache vendored Normal file
View File

@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="../bootstrap.css" rel="stylesheet">
<link href="assets/css/docs.css" rel="stylesheet">
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
<body>
<!-- Navbar
================================================== -->
<div class="navbar navbar-fixed">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./index.html">Bootstrap</a>
<ul class="nav">
<li class="{{ index }}"><a href="./index.html">Overview</a></li>
<li class="dropdown {{ scaffolding }}">
<a href="./scaffolding.html" class="dropdown-toggle" data-toggle="dropdown">
Scaffolding
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="./scaffolding.html#grid-system">Grid system</a></li>
<li><a href="./scaffolding.html#layouts">Layouts</a></li>
<li><a href="./scaffolding.html#responsive">Responsive design</a></li>
</ul>
</li>
<li class="dropdown {{ base-css }}">
<a href="./base-css.html" class="dropdown-toggle" data-toggle="dropdown">
Base CSS
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="./base-css.html#typography">Typography</a></li>
<li><a href="./base-css.html#tables">Tables</a></li>
<li><a href="./base-css.html#forms">Forms</a></li>
<li><a href="./base-css.html#buttons">Buttons</a></li>
<li><a href="./base-css.html#icons">Icons by Glyphicons</a></li>
</ul>
</li>
<li class="dropdown {{ components }}">
<a href="./components.html" class="dropdown-toggle" data-toggle="dropdown">
Components
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="./components.html#buttonGroups">Button groups</a></li>
<li><a href="./components.html#buttonDropdowns">Split button dropdowns</a></li>
<li><a href="./components.html#navs">Nav, tabs, pills</a></li>
<li><a href="./components.html#navbar">Navbar</a></li>
<li><a href="./components.html#breadcrumbs">Breadcrumbs</a></li>
<li><a href="./components.html#pagination">Pagination</a></li>
<li><a href="./components.html#thumbnails">Thumbnails</a></li>
<li><a href="./components.html#alerts">Alert messages</a></li>
<li><a href="./components.html#progress">Progress bars</a></li>
</ul>
</li>
<li class="dropdown {{ javascript }}">
<a href="./javascript.html" class="dropdown-toggle" data-toggle="dropdown">
Javascript plugins
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="./javascript.html#javascript">Overview</a></li>
<li><a href="./javascript.html#modals">Modal</a></li>
<li><a href="./javascript.html#dropdowns">Dropdown</a></li>
<li><a href="./javascript.html#scrollspy">Scrollspy</a></li>
<li><a href="./javascript.html#tabs">Tab</a></li>
<li><a href="./javascript.html#tooltips">Tooltip</a></li>
<li><a href="./javascript.html#popovers">Popover</a></li>
<li><a href="./javascript.html#alerts">Alert</a></li>
<li><a href="./javascript.html#buttons">Button</a></li>
<li><a href="./javascript.html#collapse">Collapse</a></li>
<li><a href="./javascript.html#carousel">Carousel</a></li>
<li><a href="./javascript.html#typeahead">Typeahead</a></li>
</ul>
</li>
<li class="{{ less }}">
<a href="./less.html">
Using LESS
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
{{>body}}
<!-- Footer
================================================== -->
<footer class="footer">
<p class="pull-right"><a href="#">Back to top</a></p>
<p>Designed and built with all the love in the world <a href="http://twitter.com/twitter" target="_blank">@twitter</a> by <a href="http://twitter.com/mdo" target="_blank">@mdo</a> and <a href="http://twitter.com/fat" target="_blank">@fat</a>.</p>
<p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</footer>
</div><!-- /container -->
<!-- Le javascript -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- <script src="http://code.jquery.com/jquery-1.7.min.js"></script> -->
<script src="../js/tests/vendor/jquery.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="../js/bootstrap-transition.js"></script>
<script src="../js/bootstrap-alert.js"></script>
<script src="../js/bootstrap-modal.js"></script>
<script src="../js/bootstrap-dropdown.js"></script>
<script src="../js/bootstrap-scrollspy.js"></script>
<script src="../js/bootstrap-tab.js"></script>
<script src="../js/bootstrap-tooltip.js"></script>
<script src="../js/bootstrap-popover.js"></script>
<script src="../js/bootstrap-button.js"></script>
<script src="../js/bootstrap-collapse.js"></script>
<script src="../js/bootstrap-carousel.js"></script>
<script src="../js/bootstrap-typeahead.js"></script>
<script src="assets/js/application.js"></script>
</body>
</html>

1427
docs/templates/pages/base-css.mustache vendored Normal file
View File

@ -0,0 +1,1427 @@
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Base CSS</h1>
<p class="lead">On top of the scaffolding, basic HTML elements are styled and enhanced with extensible classes to provide a fresh, consistent look and feel.</p>
</header>
<!-- Typography
================================================== -->
<section id="typography">
<div class="page-header">
<h1>Typography <small>Headings, paragraphs, lists, and other inline type elements</small></h1>
</div>
<h2>Headings &amp; body copy</h2>
<!-- Headings & Paragraph Copy -->
<div class="row">
<div class="span4">
<h3>Typographic scale</h3>
<p>The entire typographic grid is based on two Less variables in our preboot.less file: <code>@baseFontSize</code> and <code>@baseLineHeight</code>. The first is the base font-size used throughout and the second is the base line-height.</p>
<p>We use those variables, and some math, to create the margins, paddings, and line-heights of all our type and more.</p>
</div>
<div class="span4">
<h3>Example body text</h3>
<p>Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec sed odio dui.</p>
</div>
<div class="span4">
<div class="well">
<h1>h1. Heading 1</h1>
<h2>h2. Heading 2</h2>
<h3>h3. Heading 3</h3>
<h4>h4. Heading 4</h4>
<h5>h5. Heading 5</h5>
<h6>h6. Heading 6</h6>
</div>
</div>
</div>
<!-- Misc Elements -->
<h2>Emphasis, address, and abbreviation</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Element</th>
<th>Usage</th>
<th>Optional</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>&lt;strong&gt;</code>
</td>
<td>
For emphasizing a snippet of text with <strong>important</strong>
</td>
<td>
<span class="muted">None</span>
</td>
</tr>
<tr>
<td>
<code>&lt;em&gt;</code>
</td>
<td>
For emphasizing a snippet of text with <em>stress</em>
</td>
<td>
<span class="muted">None</span>
</td>
</tr>
<tr>
<td>
<code>&lt;abbr&gt;</code>
</td>
<td>
Wraps abbreviations and acronyms to show the expanded version on hover
</td>
<td>
Include optional <code>title</code> for expanded text
</td>
</tr>
<tr>
<td>
<code>&lt;address&gt;</code>
</td>
<td>
For contact information for its nearest ancestor or the entire body of work
</td>
<td>
Preserve formatting by ending all lines with <code>&lt;br&gt;</code>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="span4">
<h3>Using emphasis</h3>
<p><a href="#">Fusce dapibus</a>, <strong>tellus ac cursus commodo</strong>, <em>tortor mauris condimentum nibh</em>, ut fermentum massa justo sit amet risus. Maecenas faucibus mollis interdum. Nulla vitae elit libero, a pharetra augue.</p>
<p><strong>Note:</strong> Feel free to use <code>&lt;b&gt;</code> and <code>&lt;i&gt;</code> in HTML5, but their usage has changed a bit. <code>&lt;b&gt;</code> is meant to highlight words or phrases without conveying additional importance while <code>&lt;i&gt;</code> is mostly for voice, technical terms, etc.</p>
</div>
<div class="span4">
<h3>Example addresses</h3>
<p>Here are two examples of how the <code>&lt;address&gt;</code> tag can be used:</p>
<address>
<strong>Twitter, Inc.</strong><br>
795 Folsom Ave, Suite 600<br>
San Francisco, CA 94107<br>
<abbr title="Phone">P:</abbr> (123) 456-7890
</address>
<address>
<strong>Full Name</strong><br>
<a mailto="#">first.last@gmail.com</a>
</address>
</div>
<div class="span4">
<h3>Example abbreviations</h3>
<p>Abbreviations are styled with uppercase text and a light dotted bottom border. They also have a help cursor on hover so users have extra indication something will be shown on hover.</p>
<p><abbr title="HyperText Markup Language">HTML</abbr> is the best thing since sliced bread.</p>
<p>An abbreviation of the word attribute is <abbr title="attribute">attr</abbr>.</p>
</div>
</div>
<!-- Blockquotes -->
<h2>Blockquotes</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Element</th>
<th>Usage</th>
<th>Optional</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>&lt;blockquote&gt;</code>
</td>
<td>
Block-level element for quoting content from another source
</td>
<td>
<p>Add <code>cite</code> attribute for source URL</p>
Use <code>.pull-left</code> and <code>.pull-right</code> classes for floated options
</td>
</tr>
<tr>
<td>
<code>&lt;small&gt;</code>
</td>
<td>
Optional element for adding a user-facing citation, typically an author with title of work
</td>
<td>
Place the <code>&lt;cite&gt;</code> around the title or name of source
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="span4">
<p>To include a blockquote, wrap <code>&lt;blockquote&gt;</code> around any <abbr title="HyperText Markup Language">HTML</abbr> as the quote. For straight quotes we recommend a <code>&lt;p&gt;</code>.</p>
<p>Include an optional <code>&lt;small&gt;</code> element to cite your source and you'll get an em dash <code>&amp;mdash;</code> before it for styling purposes.</p>
</div>
<div class="span8">
<pre class="prettyprint linenums">
&lt;blockquote&gt;
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.&lt;/p&gt;
&lt;small&gt;Someone famous&lt;/small&gt;
&lt;/blockquote&gt;
</pre>
</div>
</div><!--/row-->
<h3>Example blockquotes</h3>
<div class="row">
<div class="span6">
<p>Default blockquotes are styled as such:</p>
<blockquote>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.</p>
<small>Someone famous in <cite title="">Body of work</cite></small>
</blockquote>
</div>
<div class="span6">
<p>To float your blockquote to the right, add <code>class="pull-right"</code>:</p>
<blockquote class="pull-right">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.</p>
<small>Someone famous in <cite title="">Body of work</cite></small>
</blockquote>
</div>
</div>
<!-- Lists -->
<h2>Lists</h2>
<div class="row">
<div class="span3">
<h4>Unordered</h4>
<p><code>&lt;ul&gt;</code></p>
<ul>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
<li>Facilisis in pretium nisl aliquet</li>
<li>Nulla volutpat aliquam velit
<ul>
<li>Phasellus iaculis neque</li>
<li>Purus sodales ultricies</li>
<li>Vestibulum laoreet porttitor sem</li>
<li>Ac tristique libero volutpat at</li>
</ul>
</li>
<li>Faucibus porta lacus fringilla vel</li>
<li>Aenean sit amet erat nunc</li>
<li>Eget porttitor lorem</li>
</ul>
</div>
<div class="span3">
<h4>Unstyled</h4>
<p><code>&lt;ul class="unstyled"&gt;</code></p>
<ul class="unstyled">
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
<li>Facilisis in pretium nisl aliquet</li>
<li>Nulla volutpat aliquam velit
<ul>
<li>Phasellus iaculis neque</li>
<li>Purus sodales ultricies</li>
<li>Vestibulum laoreet porttitor sem</li>
<li>Ac tristique libero volutpat at</li>
</ul>
</li>
<li>Faucibus porta lacus fringilla vel</li>
<li>Aenean sit amet erat nunc</li>
<li>Eget porttitor lorem</li>
</ul>
</div>
<div class="span3">
<h4>Ordered</h4>
<p><code>&lt;ol&gt;</code></p>
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
<li>Facilisis in pretium nisl aliquet</li>
<li>Nulla volutpat aliquam velit</li>
<li>Faucibus porta lacus fringilla vel</li>
<li>Aenean sit amet erat nunc</li>
<li>Eget porttitor lorem</li>
</ol>
</div>
<div class="span3">
<h4>Description</h4>
<p><code>&lt;dl&gt;</code></p>
<dl>
<dt>Description lists</dt>
<dd>A description list is perfect for defining terms.</dd>
<dt>Euismod</dt>
<dd>Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.</dd>
<dd>Donec id elit non mi porta gravida at eget metus.</dd>
<dt>Malesuada porta</dt>
<dd>Etiam porta sem malesuada magna mollis euismod.</dd>
</dl>
</div>
</div><!-- /row -->
<!-- Code -->
<h2>Code <small>Inline and block</small></h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 190px;">Element</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>&lt;code&gt;</code></td>
<td>In a line of text like this, your wrapped code will look like this <code>&lt;html&gt;</code> element.</td>
</tr>
<tr>
<td><code>&lt;pre&gt;</code></td>
<td>
<pre>&lt;div&gt;
&lt;h1&gt;Heading&lt;/h1&gt;
&lt;p&gt;Something right here...&lt;/p&gt;
&lt;/div&gt;</pre>
<p><strong>Note:</strong> Be sure to keep code within <code>&lt;pre&gt;</code> tags as close to the left as possible; it will render all tabs.</p>
</td>
</tr>
<tr>
<td><code>&lt;pre class="prettyprint"&gt;</code></td>
<td>
<p>Using the google-code-prettify library, you're blocks of code get a slightly different visual style and automatic syntax highlighting. You can also add an additional class to add line numbers.</p>
<pre class="prettyprint">&lt;div&gt;
&lt;h1&gt;Heading&lt;/h1&gt;
&lt;p&gt;Something right here...&lt;/p&gt;
&lt;/div&gt;</pre>
<pre class="prettyprint linenums">&lt;div&gt;
&lt;h1&gt;Heading&lt;/h1&gt;
&lt;p&gt;Something right here...&lt;/p&gt;
&lt;/div&gt;</pre>
<p><a href="http://code.google.com/p/google-code-prettify/">Download google-code-prettify</a> and view the readme for <a href="http://google-code-prettify.googlecode.com/svn/trunk/README.html">how to use</a>.</p>
</td>
</tr>
</tbody>
</table>
<!-- Labels -->
<h2>Inline labels <small>for special attention</small></h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 190px;">Labels</th>
<th>Markup</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="label">Default</span>
</td>
<td>
<code>&lt;span class="label"&gt;Default&lt;/span&gt;</code>
</td>
</tr>
<tr>
<td>
<span class="label success">New</span>
</td>
<td>
<code>&lt;span class="label success"&gt;New&lt;/span&gt;</code>
</td>
</tr>
<tr>
<td>
<span class="label warning">Warning</span>
</td>
<td>
<code>&lt;span class="label warning"&gt;Warning&lt;/span&gt;</code>
</td>
</tr>
<tr>
<td>
<span class="label important">Important</span>
</td>
<td>
<code>&lt;span class="label important"&gt;Important&lt;/span&gt;</code>
</td>
</tr>
<tr>
<td>
<span class="label notice">Notice</span>
</td>
<td>
<code>&lt;span class="label notice"&gt;Notice&lt;/span&gt;</code>
</td>
</tr>
</tbody>
</table>
</section>
<!-- Tables
================================================== -->
<section id="tables">
<div class="page-header">
<h1>Tables <small>For, you guessed it, tabular data</small></h1>
</div>
<h2>Table markup</h2>
<div class="row">
<div class="span8">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Tag</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>&lt;table&gt;</code>
</td>
<td>
Wrapping element for displaying data in a tabular format
</td>
</tr>
<tr>
<td>
<code>&lt;thead&gt;</code>
</td>
<td>
Container element for table header rows (<code>&lt;tr&gt;</code>) to label table columns
</td>
</tr>
<tr>
<td>
<code>&lt;tbody&gt;</code>
</td>
<td>
Container element for table rows (<code>&lt;tr&gt;</code>) in the body of the table
</td>
</tr>
<tr>
<td>
<code>&lt;tr&gt;</code>
</td>
<td>
Container element for a set of table cells (<code>&lt;td&gt;</code> or <code>&lt;th&gt;</code>) that appears on a single row
</td>
</tr>
<tr>
<td>
<code>&lt;td&gt;</code>
</td>
<td>
Default table cell
</td>
</tr>
<tr>
<td>
<code>&lt;th&gt;</code>
</td>
<td>
Special table cell for column (or row, depending on scope and placement) labels<br>
Must be used within a <code>&lt;thead&gt;</code>
</td>
</tr>
<tr>
<td>
<code>&lt;caption&gt;</code>
</td>
<td>
Description or summary of what the table holds, especially useful for screen readers
</td>
</tr>
</tbody>
</table>
</div>
<div class="span4">
<pre class="prettyprint linenums">
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;...&lt;/th&gt;
&lt;th&gt;...&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;...&lt;/td&gt;
&lt;td&gt;...&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</pre>
</div>
</div>
<h2>Table options</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Class</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Default</td>
<td class="muted">None</td>
<td>No styles, just columns and rows</td>
</tr>
<tr>
<td>Basic</td>
<td>
<code>.table</code>
</td>
<td>Only horizontal lines between rows</td>
</tr>
<tr>
<td>Bordered</td>
<td>
<code>.table-bordered</code>
</td>
<td>Rounds corners and adds outter border</td>
</tr>
<tr>
<td>Zebra-stripe</td>
<td>
<code>.table-striped</code>
</td>
<td>Adds light gray background color to odd rows (1, 3, 5, etc)</td>
</tr>
<tr>
<td>Condensed</td>
<td>
<code>.table-condensed</code>
</td>
<td>Cuts vertical padding in half, from 8px to 4px, within all <code>td</code> and <code>th</code> elements</td>
</tr>
</tbody>
</table>
<h2>Example tables</h2>
<h3>1. Default table styles</h3>
<div class="row">
<div class="span4">
<p>Tables are automatically styled with only a few borders to ensure readability and maintain structure. With 2.0, the <code>.table</code> class is required.</p>
<pre class="prettyprint linenums">
&lt;table class="table"&gt;
...
&lt;/table&gt;</pre>
</div>
<div class="span8">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Language</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>CSS</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>Javascript</td>
</tr>
<tr>
<td>3</td>
<td>Stu</td>
<td>Dent</td>
<td>HTML</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3>2. Striped table</h3>
<div class="row">
<div class="span4">
<p>Get a little fancy with your tables by adding zebra-striping&mdash;just add the <code>.table-striped</code> class.</p>
<p class="muted"><strong>Note:</strong> Sprited tables use the <code>:nth-child</code> CSS selector and is not available in IE7-IE8.</p>
<pre class="prettyprint linenums" style="margin-bottom: 18px;">
&lt;table class="table table-striped"&gt;
...
&lt;/table&gt;</pre>
</div>
<div class="span8">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Language</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>CSS</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>Javascript</td>
</tr>
<tr>
<td>3</td>
<td>Stu</td>
<td>Dent</td>
<td>HTML</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3>3. Bordered table</h3>
<div class="row">
<div class="span4">
<p>Add borders around the entire table and rounded corners for aesthetic purposes.</p>
<pre class="prettyprint linenums">
&lt;table class="table table-bordered"&gt;
...
&lt;/table&gt;</pre>
</div>
<div class="span8">
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Language</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td colspan="2">Mark Otto</td>
<td>CSS</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td rowspan="2">Javascript</td>
</tr>
</tr>
<td>3</td>
<td>Stu</td>
<td>Dent</td>
</tr>
<tr>
<td>3</td>
<td>Brosef</td>
<td>Stalin</td>
<td>HTML</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3>4. Condensed table</h3>
<div class="row">
<div class="span4">
<p>Make your tables more compact by adding the <code>.table-condensed</code> class to cut table cell padding in half (from 10px to 5px).</p>
<pre class="prettyprint linenums" style="margin-bottom: 18px;">
&lt;table class="table table-condensed"&gt;
...
&lt;/table&gt;</pre>
</div>
<div class="span8">
<table class="table table-condensed">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Language</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>CSS</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>Javascript</td>
</tr>
<tr>
<td>3</td>
<td>Stu</td>
<td>Dent</td>
<td>HTML</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3>5. Striped table w/ TableSorter.js</h3>
<div class="row">
<div class="span4">
<p>Include the <a href="http://jquery.com">jQuery</a> <a href="http://tablesorter.com/docs/">Tablesorter</a> plugin and automaically get clear styles for sorted columns.</p>
<pre class="prettyprint linenums">
&lt;script src="jquery.tablesorter.js"&gt;&lt;/script&gt;
&lt;script &gt;
$(function() {
$("table#sortTableExample")
.tablesorter({
sortList: [[1,0]]
});
});
&lt;/script&gt;
&lt;table class="table table-striped"&gt;
...
&lt;/table&gt;</pre>
</div>
<div class="span8">
<table class="table table-striped tablesorter-example">
<thead>
<tr>
<th>#</th>
<th class="yellow">First Name</th>
<th class="blue">Last Name</th>
<th class="green">Language</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>CSS</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>Javascript</td>
</tr>
<tr>
<td>3</td>
<td>Stu</td>
<td>Dent</td>
<td>HTML</td>
</tr>
<tr>
<td>4</td>
<td>Brosef</td>
<td>Stalin</td>
<td>HTML</td>
</tr>
</tbody>
</table>
<p>Styles for the Tablesorter, zebra striping, borders, and condensing may all compound in any variation to fit your needs.</p>
<table class="table table-striped table-bordered table-condensed tablesorter-example">
<thead>
<tr>
<th>#</th>
<th class="yellow">First Name</th>
<th class="blue">Last Name</th>
<th class="green">Language</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>CSS</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>Javascript</td>
</tr>
<tr>
<td>3</td>
<td>Stu</td>
<td>Dent</td>
<td>HTML</td>
</tr>
<tr>
<td>4</td>
<td>Brosef</td>
<td>Stalin</td>
<td>HTML</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- Forms
================================================== -->
<section id="forms">
<div class="page-header">
<h1>Forms</h1>
</div>
<div class="row">
<div class="span4">
<h2>Flexible HTML and CSS</h2>
<p>The best part about forms in Bootstrap is that all your inputs and controls look great no matter how you build them in your markup. No superfluous HTML is required, but we provide the patterns for those who require it.</p>
<p>More complicated layouts come with succinct and scalable classes for easy styling and event binding, so you're covered at every step.</p>
</div>
<div class="span4">
<h2>Four layouts included</h2>
<p>Bootstrap comes with support for four types of form layouts:</p>
<ul>
<li>Vertical (default)</li>
<li>Search</li>
<li>Inline</li>
<li>Horizontal</li>
</ul>
<p>Different types of form layouts require some changes to markup, but the controls themselves remain and behave the same.</p>
</div>
<div class="span4">
<h2>Control states and more</h2>
<p>Bootstrap's forms include styles for all the base form controls like input, textarea, and select you'd expect. But it also comes with a number of custom components like appended and prepended inputs and support for lists of checkboxes.</p>
<p>States like error, warning, and success are included for each type of form control. Also included are styles for disabled controls.</p>
</div>
</div>
<h2>Four types of forms</h2>
<p>Bootstrap provides simple markup and styles for four styles of common web forms.</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Class</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>Vertical (default)</th>
<td><code>.vertical-form</code> <span class="muted">(not required)</span></td>
<td>Stacked, left-aligned labels over controls</td>
</tr>
<tr>
<th>Horizontal</th>
<td><code>.form-horizontal</code></td>
<td>Float left, right-aligned labels on same line as controls</td>
</tr>
<tr>
<th>Inline</th>
<td><code>.form-inline</code></td>
<td>Left-aligned label and inline-block controls for compact style</td>
</tr>
<tr>
<th>Search</th>
<td><code>.form-search</code></td>
<td>Extra-rounded text input for a typical search aesthetic</td>
</tr>
</tbody>
</table>
<h2>Example forms <small>using just form controls, no extra markup</small></h2>
<div class="row">
<div class="span4">
<h3>Basic form</h3>
<p>With v2.0, we have lighter and smarter defaults for form styles. No extra markup, just form controls.</p>
<form class="well">
<label>Label name</label>
<input type="text" class="span3" placeholder="Type something...">
<label class="checkbox">
<input type="checkbox"> Check me out
</label>
<button type="submit" class="btn">Submit</button>
</form>
</div>
<div class="span4">
<h3>Search form</h3>
<p>Reflecting default WebKit styles, just add <code>.form-search</code> for extra rounded search fields.</p>
<form class="well form-search">
<input type="text" class="input-medium search-query">
<button type="submit" class="btn">Search</button>
</form>
</div>
<div class="span4">
<h3>Inline form</h3>
<p>Inputs are block level to start. For <code>.form-inline</code> and <code>.form-horizontal</code>, we use inline-block.</p>
<form class="well form-search">
<input type="text" class="input-small" placeholder="Email">
<input type="password" class="input-small" placeholder="Password">
<button type="submit" class="btn">Go</button>
</form>
</div>
</div><!-- /row -->
<br>
<h2>Horizontal forms</h2>
<div class="row">
<div class="span8">
<form class="form-horizontal">
<legend>Controls Bootstrap supports</legend>
<fieldset class="control-group">
<label class="control-label" for="input01">Text input</label>
<div class="controls">
<input type="text" class="xlarge" name="input01">
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="optionsCheckbox">Checkbox</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="optionsCheckbox" value="option1">
Option one is this and that&mdash;be sure to include why its great
</label>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="select01">Select list</label>
<div class="controls">
<select name="select01">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="multiSelect">Multi-select</label>
<div class="controls">
<select multiple="multiple" name="multiSelect">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="fileInput">File input</label>
<div class="controls">
<input class="input-file" id="fileInput" name="fileInput" type="file">
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="textarea">Textarea</label>
<div class="controls">
<textarea class="input-xlarge" name="textarea" id="textarea" rows="3"></textarea>
</div>
</fieldset>
<fieldset class="form-actions">
<button type="submit" class="btn primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
</fieldset>
</form>
</div>
<div class="span4">
<div class="form-docs">
<h3>What's included</h3>
<p>Shown on the left are all the default form controls we support. Here's the bulleted list:</p>
<ul>
<li>text inputs (text, password, email, etc)</li>
<li>checkbox</li>
<li>radio</li>
<li>select</li>
<li>multiple select</li>
<li>file input</li>
<li>textarea</li>
</ul>
<hr>
<h3>New defaults with v2.0</h3>
<p>Up to v1.4, Bootstrap's default form styles used the horizontal layout. With Bootstrap 2, we removed that constraint to have smarter, more scalable defaults for any form.</p>
</div>
</div>
</div>
<br>
<div class="row">
<div class="span8">
<form class="form-horizontal">
<legend>Form control states</legend>
<fieldset class="control-group">
<label class="control-label" for="focusedInput">Focused input</label>
<div class="controls">
<input class="input-xlarge focused" id="focusedInput" name="focusedInput" type="text" value="This is focused...">
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="disabledInput">Disabled input</label>
<div class="controls">
<input class="input-xlarge disabled" id="disabledInput" name="disabledInput" type="text" placeholder="Disabled input here..." disabled>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="optionsCheckbox">Disabled checkbox</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="optionsCheckbox" value="option1" disabled>
This is a disabled checkbox
</label>
</div>
</fieldset>
<fieldset class="control-group warning">
<label class="control-label" for="inputError">Input with warning</label>
<div class="controls">
<input type="text" name="inputError">
<span class="help-inline">Something may have gone wrong</span>
</div>
</fieldset>
<fieldset class="control-group error">
<label class="control-label" for="inputError">Input with error</label>
<div class="controls">
<input type="text" name="inputError">
<span class="help-inline">Please correct the error</span>
</div>
</fieldset>
<fieldset class="control-group success">
<label class="control-label" for="inputError">Input with success</label>
<div class="controls">
<input type="text" name="inputError">
<span class="help-inline">Woohoo!</span>
</div>
</fieldset>
<fieldset class="form-actions">
<button type="submit" class="btn primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
</fieldset>
</form>
</div>
<div class="span4">
<div class="form-docs">
<h3>Redesigned browser states</h3>
<p>Bootstrap features styles for browser-supported focused and <code>disabled</code> states. We remove the default Webkit <code>outline</code> and apply a <code>box-shadow</code> in it's place for <code>:focus</code>.</p>
<hr>
<h3>Form validation</h3>
<p>It also includes validation styles for errors, warnings, and success. To use, add the a class to the surrounding <code>.control-group</code>.</p>
<pre class="prettyprint linenums">
&lt;fieldset
class="control-group error"&gt;
...
&lt;/fieldset&gt;
</pre>
</div>
</div>
</div>
<br>
<div class="row">
<div class="span8">
<form class="form-horizontal">
<legend>Extending form controls</legend>
<fieldset class="control-group">
<label class="control-label">Form sizes</label>
<div class="controls docs-input-sizes">
<input class="span2" type="text" name="" placeholder=".span2">
<input class="span3" type="text" name="" placeholder=".span3">
<input class="span4" type="text" name="" placeholder=".span4">
<p class="help-block">Use the same <code>.span*</code> classes from the grid system for input sizes.</p>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="prependedInput">Prepended text</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on">@</span>
<input class="span2" id="prependedInput" name="prependedInput" size="16" type="text">
</div>
<p class="help-block">Here's some help text</p>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="appendedInput">Appended text</label>
<div class="controls">
<div class="input-append">
<input class="span2" id="appendedInput" name="appendedInput" size="16" type="text">
<span class="add-on">.00</span>
</div>
<p class="help-block">Here's more help text</p>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="inlineCheckboxes">Inline checkboxes</label>
<div class="controls">
<label class="checkbox inline">
<input type="checkbox" name="inlineCheckbox1" value="option1"> 1
</label>
<label class="checkbox inline">
<input type="checkbox" name="inlineCheckbox1" value="option1"> 2
</label>
<label class="checkbox inline">
<input type="checkbox" name="inlineCheckbox1" value="option1"> 3
</label>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="optionsCheckboxes">Checkboxes</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="optionsCheckboxes" value="option1">
Option one is this and that&mdash;be sure to include why its great
</label>
<label class="checkbox">
<input type="checkbox" name="optionsCheckboxes" value="option2">
Option two can also be checked and included in form results
</label>
<label class="checkbox">
<input type="checkbox" name="optionsCheckboxes" value="option3">
Option three can&mdash;yes, you guessed it&mdash;also be checked and included in form results
</label>
<p class="help-text"><strong>Note:</strong> Labels surround all the options for much larger click areas and a more usable form.</p>
</div>
</fieldset>
<fieldset class="control-group">
<label class="control-label" for="optionsRadios">Radio buttons</label>
<div class="controls">
<label class="radio">
<input type="radio" checked name="optionsRadios" value="option1">
Option one is this and that&mdash;be sure to include why its great
</label>
<label class="radio">
<input type="radio" name="optionsRadios" value="option2">
Option two can is something else and selecting it will deselect option one
</label>
</div>
</fieldset>
<fieldset class="form-actions">
<button type="submit" class="btn primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
</fieldset>
</form>
</div>
<div class="span4">
<div class="form-docs">
<h3>Prepend &amp; append inputs</h3>
<p>Input groups&mdash;with appended or prepended text&mdash;provide an easy way to give more context for your inputs. Great examples include the @ sign for Twitter usernames or $ for finances.</p>
<hr>
<h3>Checkboxes and radios</h3>
<p>Up to v1.4, Bootstrap required extra markup around checkboxes and radios to stack them. Now, it's a simple matter of repeating the <code>&lt;label class="checkbox"&gt;</code> that wraps the <code>&lt;input type="checkbox"&gt;</code>.</p>
<p>Inline checkboxes and radios are also supported. Just add <code>.inline</code> to any <code>.checkbox</code> or <code>.radio</code> and you're done.</p>
</div>
</div>
</div><!-- /row -->
</section>
<section id="buttons">
<div class="page-header">
<h1>Buttons</h1>
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Button</th>
<th>Class</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="btn" href="#">Default</a></td>
<td><code>.btn</code></td>
<td>Standard gray button with gradient</td>
</tr>
<tr>
<td><a class="btn primary" href="#">Primary</a></td>
<td><code>.primary</code></td>
<td>Provides extra visual weight and identifies the primary action in a set of buttons</td>
</tr>
<tr>
<td><a class="btn info" href="#">Info</a></td>
<td><code>.info</code></td>
<td>Used as an alternate to the default styles</td>
</tr>
<tr>
<td><a class="btn success" href="#">Success</a></td>
<td><code>.success</code></td>
<td>Indicates a successful or positive action</td>
</tr>
<tr>
<td><a class="btn danger" href="#">Danger</a></td>
<td><code>.danger</code></td>
<td>Indicates a dangerous or potentially negative action</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="span4">
<h3>Buttons for actions</h3>
<p>As a convention, buttons should only be used for actions while hyperlinks are to be used for objects. For instance, "Download" should be a button while "recent activity" should be a link.</p>
</div>
<div class="span4">
<h3>For anchors and forms</h3>
<p>Button styles can be applied to anything with the <code>.btn</code> applied. However, typically youll want to apply these to only <code>&lt;a&gt;</code> and <code>&lt;button&gt;</code> elements.</p>
</div>
<div class="span4">
<p><strong>Note:</strong> All buttons must include the <code>.btn</code> class. Button styles should be applied to <code>&lt;button&gt;</code> and <code>&lt;a&gt;</code> elements for consistency.</p>
</div>
</div>
<div class="row">
<div class="span4">
<h3>Multiple sizes</h3>
<p>Fancy larger or smaller buttons? Have at it!</p>
<p>
<a href="#" class="btn large primary">Primary action</a>
<a href="#" class="btn large">Action</a>
</p>
<p>
<a href="#" class="btn small primary">Primary action</a>
<a href="#" class="btn small">Action</a>
</p>
</div>
<div class="span8">
<h3>Disabled state</h3>
<p>For buttons that are not active or are disabled by the app for one reason or another, use the disabled state. Thats <code>.disabled</code> for links and <code>:disabled</code> for <code>&lt;button&gt;</code> elements.</p>
<p>
<a href="#" class="btn large primary disabled">Primary action</a>
<a href="#" class="btn large disabled">Action</a>
</p>
<p>
<button class="btn large primary disabled" disabled="disabled">Primary action</button>&nbsp;<button class="btn large" disabled>Action</button>
</p>
</div>
</div>
<br>
</section>
<!-- Icons
================================================== -->
<section id="icons">
<div class="page-header">
<h1>Icons <small>Graciously provided by <a href="http://glyphicons.com" target="_blank">Glyphicons</a></small></h1>
</div>
<div class="row">
<div class="span2">
<div class="the-icons">
<i class="glass"></i>
<i class="music"></i>
<i class="search"></i>
<i class="envelope"></i>
<i class="heart"></i>
<i class="star"></i>
<i class="star-empty"></i>
<i class="user"></i>
<i class="film"></i>
<i class="th-large"></i>
<i class="th"></i>
<i class="th-list"></i>
<i class="ok"></i>
<i class="remove"></i>
<i class="zoom-in"></i>
<i class="zoom-out"></i>
<i class="off"></i>
<i class="signal"></i>
<i class="cog"></i>
<i class="trash"></i>
</div>
</div>
<div class="span2">
<div class="the-icons">
<i class="home"></i>
<i class="file"></i>
<i class="time"></i>
<i class="road"></i>
<i class="download-alt"></i>
<i class="download"></i>
<i class="upload"></i>
<i class="inbox"></i>
<i class="play-circle"></i>
<i class="repeat"></i>
<i class="refresh"></i>
<i class="calendar"></i>
<i class="lock"></i>
<i class="flag"></i>
<i class="headphones"></i>
<i class="volume-off"></i>
<i class="volume-down"></i>
<i class="volume-up"></i>
<i class="qrcode"></i>
<i class="barcode"></i>
</div>
</div>
<div class="span2">
<div class="the-icons">
<i class="tag"></i>
<i class="tags"></i>
<i class="book"></i>
<i class="bookmark"></i>
<i class="print"></i>
<i class="camera"></i>
<i class="font"></i>
<i class="bold"></i>
<i class="italic"></i>
<i class="text-height"></i>
<i class="text-width"></i>
<i class="align-left"></i>
<i class="align-center"></i>
<i class="align-right"></i>
<i class="align-justify"></i>
<i class="list"></i>
<i class="indent-left"></i>
<i class="indent-right"></i>
<i class="facetime-video"></i>
<i class="picture"></i>
</div>
</div>
<div class="span2">
<div class="the-icons">
<i class="pencil"></i>
<i class="map-marker"></i>
<i class="adjust"></i>
<i class="tint"></i>
<i class="edit"></i>
<i class="share"></i>
<i class="check"></i>
<i class="move"></i>
<i class="step-backward"></i>
<i class="fast-backward"></i>
<i class="backward"></i>
<i class="play"></i>
<i class="pause"></i>
<i class="stop"></i>
<i class="forward"></i>
<i class="fast-forward"></i>
<i class="step-forward"></i>
<i class="eject"></i>
<i class="chevron-left"></i>
<i class="chevron-right"></i>
</div>
</div>
<div class="span2">
<div class="the-icons">
<i class="arrow-left"></i>
<i class="arrow-right"></i>
<i class="arrow-up"></i>
<i class="arrow-down"></i>
<i class="share-alt"></i>
<i class="resize-full"></i>
<i class="resize-small"></i>
<i class="plus"></i>
<i class="minus"></i>
<i class="asterisk"></i>
</div>
</div>
<div class="span2">
<p class="muted">Light red background color is only used to show the dimensions of the icons in the docs.</p>
</div>
</div>
<br>
<div class="row">
<div class="span4">
<h3>Built as a sprite</h3>
<p>Instead of making every icon an extra request, we've compiled them into a sprite&mdash;a bunch of images in one file that uses CSS to position the images with <code>background-position</code>. This is the same method we use on Twitter.com and it has worked well for us.</p>
<p><a href="http://glyphicons.com" target="_blank">Glyphicons</a> has granted us use of the Halflings set in our open-source toolkit so long as we provide a link and credit. Please consider doing the same in your projects.</p>
</div>
<div class="span4">
<h3>How to use</h3>
<p>With v2.0.0, the <code>&lt;i&gt;</code> tag is essentially dedicated to iconography. To use the icons, you can place the follow code wherever you like one to appear:</p>
<pre class="prettyprint linenums">
&lt;i class="chevron-left"&gt;&lt;/i&gt;
</pre>
<p>There are over 100 classes to choose from for your icons. Just add an <code>&lt;i&gt;</code> tag with the right class and you're set. You can find the full list in sprites.less or right here in this document.</p>
</div>
<div class="span4">
<h3>Use cases</h3>
<p>Icons are great, but where would one use them? Here are a few ideas:</p>
<ul>
<li>As visuals for your sidebar navigation</li>
<li>For a purely icon-driven nav</li>
<li>For buttons to help convey the meaning of an action</li>
<li>With links to share context on a user's destination</li>
</ul>
<p>Essentially, anywhere you can put an <code>&lt;i&gt;</code> tag, you can put an icon.</p>
</div>
</div>
<h3>Examples</h3>
<div class="row">
<div class="span4">
<p>Use them in buttons, or in button groups for a toolbar style presentation.</p>
<p>
<a class="btn" href="#"><i class="refresh"></i> Refresh</a>
<a class="btn" href="#"><i class="cog"></i> Settings</a>
</p>
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn" href="#"><i class="font"></i></a>
<a class="btn" href="#"><i class="bold"></i></a>
<a class="btn" href="#"><i class="italic"></i></a>
</div>
<div class="btn-group">
<a class="btn" href="#"><i class="align-left"></i></a>
<a class="btn" href="#"><i class="align-center"></i></a>
<a class="btn" href="#"><i class="align-right"></i></a>
<a class="btn" href="#"><i class="align-justify"></i></a>
</div>
</div>
</div>
<div class="span3">
<p>Or, use them in navigation.</p>
<div class="well" style="padding: 8px 0;">
<ul class="nav list">
<li class="active"><a href="#"><i class="home"></i> Home</a></li>
<li><a href="#"><i class="book"></i> Library</a></li>
<li><a href="#"><i class="pencil"></i> Applications</a></li>
</ul>
</div> <!-- /well -->
</div>
</div>
</section>

1176
docs/templates/pages/components.mustache vendored Normal file
View File

@ -0,0 +1,1176 @@
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Components</h1>
<p class="lead">Dozens of reusable components are built into Bootstrap to provide navigation, alerts, popovers, and much more.</p>
</header>
<!-- Button Groups
================================================== -->
<section id="buttonGroups">
<div class="page-header">
<h1>Button groups <small>Join buttons for more toolbar-like functionality</small></h1>
</div>
<div class="row">
<div class="span4">
<h3>Button groups</h3>
<p>Use button groups to join multiple buttons together as one composite component. Build them with a series of <code>&lt;a&gt;</code> or <code>&lt;button&gt;</code> elements.</p>
<p>You can also combine sets of <code>&lt;div class="btn-group"&gt;</code> into a <code>&lt;div class="btn-toolbar"&gt;</code> for more complex projects.</p>
<div class="well" style="padding: 10px; margin-bottom: 9px;">
<div class="btn-group">
<a class="btn" href="#">Left</a>
<a class="btn" href="#">Middle</a>
<a class="btn" href="#">Right</a>
</div>
</div>
<div class="well" style="padding: 10px;">
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn" href="#">1</a>
<a class="btn" href="#">2</a>
<a class="btn" href="#">3</a>
<a class="btn" href="#">4</a>
</div>
<div class="btn-group">
<a class="btn" href="#">5</a>
<a class="btn" href="#">6</a>
<a class="btn" href="#">7</a>
</div>
<div class="btn-group">
<a class="btn" href="#">8</a>
</div>
</div>
</div>
</div>
<div class="span4">
<h3>Example markup</h3>
<p>Here's how the HTML looks for a standard button group built with anchor tag buttons:</p>
<pre class="prettyprint linenums">
&lt;div class="btn-group"&gt;
&lt;a class="btn" href="#"&gt;1&lt;/a&gt;
&lt;a class="btn" href="#"&gt;2&lt;/a&gt;
&lt;a class="btn" href="#"&gt;3&lt;/a&gt;
&lt;/div&gt;
</pre>
<p>And with a toolbar for multiple groups:</p>
<pre class="prettyprint linenums">
&lt;div class="btn-toolbar"&gt;
&lt;div class="btn-group"&gt;
...
&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
<div class="span4">
<h3>Checkbox and radio flavors</h3>
<p>Button groups can also function as radios, where only one button may be active, or checkboxes, where any number of buttons may be active. View <a href="./javascript.html#buttons">the Javascript docs</a> for that.</p>
<p><a class="btn js-btn" href="./javascript.html#buttons">Get the javascript &raquo;</a></p>
<hr>
<h4 class="muted">Heads up</h4>
<p class="muted">CSS for button groups is in a separate file, button-groups.less.</p>
</div>
</div>
</section>
<!-- Split button dropdowns
================================================== -->
<section id="buttonDropdowns">
<div class="page-header">
<h1>Split button dropdowns <small>Built on button groups to provide contextual menus</small></h1>
</div>
<div class="row">
<div class="span4">
<h3>Split button dropdowns</h3>
<p>Building on the button group styles and markup, we can easily create a split button. Split buttons feature a standard action on the left and a dropdown toggle on the right with contextual links.</p>
<div class="well" style="padding: 10px; margin-bottom: 9px;">
<div class="btn-toolbar" style="margin-bottom: 9px;">
<div class="btn-group">
<a class="btn" href="#">Action</a>
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<a class="btn primary" href="#">Action</a>
<a class="btn primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<a class="btn danger" href="#">Danger</a>
<a class="btn danger dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
</div>
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn success" href="#">Success</a>
<a class="btn success dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<a class="btn info" href="#">Info</a>
<a class="btn info dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
</div>
</div> <!-- /well -->
</div>
<div class="span8">
<h3>Example markup</h3>
<p>Similar to a button group, our markup uses regular button markup, but with a handful of additions to refine the style and support Bootstrap's dropdown jQuery plugin.</p>
<pre class="prettyprint linenums">
&lt;div class="btn-group"&gt;
&lt;a class="btn" href="#"&gt;Action&lt;/a&gt;
&lt;a class="btn dropdown-toggle" data-toggle="dropdown" href="#"&gt;
&lt;span class="caret"&gt;&lt;/span&gt;
&lt;/a&gt;
&lt;ul class="dropdown-menu"&gt;
&lt;!-- dropdown menu links --&gt;
&lt;/ul&gt;
&lt;/div&gt;
</pre>
</div>
</div>
</section>
<!-- Nav, Tabs, & Pills
================================================== -->
<section id="navs">
<div class="page-header">
<h1>Nav, tabs, and pills <small>Highly customizable list-style navigation</small></h1>
</div>
<h2>Lightweight defaults <small>Same markup, different classes</small></h2>
<div class="row">
<div class="span4">
<h3>Powerful base class</h3>
<p>All nav components here&mdash;tabs, pills, and lists&mdash;<strong>share the same base markup and styles</strong> through the <code>.nav</code> class.</p>
<h3>Why tabs and pills</h3>
<p>Tabs and pills in Bootstrap are built on a <code>&lt;ul&gt;</code> with the same core HTML, a list of links. Swap between tabs or pills with only a class.</p>
<p>Both options are great for sub-sections of content or navigating between pages of related content.</p>
</div>
<div class="span4">
<h3>Basic tabs</h3>
<p>Take a regular <code>&lt;ul&gt;</code> of links and add <code>.tabs</code>:</p>
<ul class="nav tabs">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Messages</a></li>
</ul>
<pre class="prettyprint linenums">
&lt;ul class="nav tabs"&gt;
&lt;li class="active"&gt;
&lt;a href="#"&gt;Home&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;...&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
<div class="span4">
<h3>Basic pills</h3>
<p>Take that same HTML, but use <code>.pills</code> instead:</p>
<ul class="nav pills">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Messages</a></li>
</ul>
<pre class="prettyprint linenums">
&lt;ul class="nav pills"&gt;
&lt;li class="active"&gt;
&lt;a href="#"&gt;Home&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;...&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
</div>
<h2>Stackable <small>Make tabs or pills vertical</small></h2>
<div class="row">
<div class="span4">
<h3>How to stack 'em</h3>
<p>As tabs and pills are horizontal by default, just add a second class, <code>.stacked</code>, to make them appear vertically stacked.</p>
</div>
<div class="span4">
<h3>Stacked tabs</h3>
<ul class="nav tabs stacked">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Messages</a></li>
</ul>
<pre class="prettyprint linenums">
&lt;ul class="nav tabs stacked"&gt;
...
&lt;/ul&gt;
</pre>
</div>
<div class="span4">
<h3>Stacked pills</h3>
<ul class="nav pills stacked">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Messages</a></li>
</ul>
<pre class="prettyprint linenums">
&lt;ul class="nav pills stacked"&gt;
...
&lt;/ul&gt;
</pre>
</div>
</div>
<h2>Dropdowns <small>For advanced nav components</small></h2>
<div class="row">
<div class="span4">
<h3>Rich menus made easy</h3>
<p>Dropdown menus in Bootstrap tabs and pills are super easy and require only a little extra HTML and a lightweight jQuery plugin.</p>
<p>Head over to the Javascript page to read the docs on <a href="./javascript.html#tabs">initializing dropdowns</a> in Bootstrap.</p>
</div>
<div class="span4">
<h3>Tabs with dropdowns</h3>
<ul class="nav tabs">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
<pre class="prettyprint linenums">
&lt;ul class="nav tabs"&gt;
&lt;li class="dropdown"&gt;
&lt;a class="dropdown-toggle"
data-toggle="dropdown"
href="#"&gt;
Dropdown
&lt;b class="caret"&gt;&lt;/b&gt;
&lt;/a&gt;
&lt;ul class="dropdown-menu"&gt;
&lt;!-- links --&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
<div class="span4">
<h3>Pills with dropdowns</h3>
<ul class="nav pills">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
<pre class="prettyprint linenums">
&lt;ul class="nav pills"&gt;
&lt;li class="dropdown"&gt;
&lt;a class="dropdown-toggle"
data-toggle="dropdown"
href="#"&gt;
Dropdown
&lt;b class="caret"&gt;&lt;/b&gt;
&lt;/a&gt;
&lt;ul class="dropdown-menu"&gt;
&lt;!-- links --&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
</div>
<h2>Nav lists <small>Build simple stacked navs, great for sidebars</small></h2>
<div class="row">
<div class="span4">
<h3>Application-style navigation</h3>
<p>Nav lists provide a simple and easy way to build groups of nav links with optional headers. They're best used in sidebars like the Finder in OS X.</p>
<p>Structurally, they're built on the same core nav styles as tabs and pills, so usage and customization are straightforward.</p>
<h4>With icons</h4>
<p>Nav lists are also easy to equip with icons. Add the proper <code>&lt;i&gt;</code> tag with class and you're set.</p>
</div>
<div class="span4">
<h3>Example nav list</h3>
<p>Take a list of links and add <code>class="nav list"</code>:</p>
<div class="well" style="padding: 8px 0;">
<ul class="nav list">
<li class="nav-header">List header</li>
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Library</a></li>
<li><a href="#">Applications</a></li>
<li class="nav-header">Another list header</li>
<li><a href="#">Profile</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Help</a></li>
</ul>
</div> <!-- /well -->
<pre class="prettyprint linenums">
&lt;ul class="nav list"&gt;
&lt;li class="nav-header"&gt;
List header
&lt;/li&gt;
&lt;li class="active"&gt;
&lt;a href="#"&gt;Home&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="#"&gt;Library&lt;/a&gt;
&lt;/li&gt;
...
&lt;/ul&gt;
</pre>
</div>
<div class="span4">
<h3>Example with icons</h3>
<p>Same example, but with <code>&lt;i&gt;</code> tags for icons.</p>
<div class="well" style="padding: 8px 0;">
<ul class="nav list">
<li class="nav-header">List header</li>
<li class="active"><a href="#"><i class="home"></i> Home</a></li>
<li><a href="#"><i class="book"></i> Library</a></li>
<li><a href="#"><i class="pencil"></i> Applications</a></li>
<li class="nav-header">Another list header</li>
<li><a href="#"><i class="user"></i> Profile</a></li>
<li><a href="#"><i class="cog"></i> Settings</a></li>
<li><a href="#"><i class="flag"></i> Help</a></li>
</ul>
</div> <!-- /well -->
<pre class="prettyprint linenums">
&lt;ul class="nav list"&gt;
...
&lt;li&gt;
&lt;a href="#"&gt;
&lt;i class="book"&gt;&lt;/i&gt;
Library
&lt;/a&gt;
&lt;/li&gt;
...
&lt;/ul&gt;
</pre>
</div>
</div>
<h2>Tabbable nav <small>Bring tabs to life via javascript</small></h2>
<div class="row">
<div class="span4">
<h3>What's included</h3>
<p>Bring your tabs to life with a simple plugin to toggle between content via tabs. Bootstrap integrates tabbable tabs in four styles: top (default), right, bottom, and left.</p>
<p>Changing between them is easy and only requires changing very little markup.</p>
</div>
<div class="span4">
<h3>Tabbable example</h3>
<p>To make tabs tabbable, wrap the <code>.tabs</code> in another div with class <code>.tabbable</code>.</p>
<div class="tabbable" style="margin-bottom: 9px;">
<ul class="nav tabs">
<li class="active"><a href="#1" data-toggle="tab">Section 1</a></li>
<li><a href="#2" data-toggle="tab">Section 2</a></li>
<li><a href="#3" data-toggle="tab">Section 3</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="1">
<p>I'm in Section 1.</p>
</div>
<div class="tab-pane" id="2">
<p>Howdy, I'm in Section 2.</p>
</div>
<div class="tab-pane" id="3">
<p>What up girl, this is Section 3.</p>
</div>
</div>
</div> <!-- /tabbable -->
</div>
<div class="span4">
<h3>Custom jQuery plugin</h3>
<p>All tabbable tabs are powered by our lightweight jQuery plugin. Read more about how to bring tabbable tabs to life on the javascript docs page.</p>
<p><a class="btn" href="./javascript.html/#tabs">Get the javascript &rarr;</a></p>
</div>
</div>
<h3>Straightforward markup</h3>
<p>Using tabbable tabs requires a wrapping div, a set of tabs, and a set of tabbable panes of content.</p>
<pre class="prettyprint linenums">
&lt;div class="tabbable"&gt;
&lt;ul class="nav tabs"&gt;
&lt;li class="active"&gt;&lt;a href="#1" data-toggle="tab"&gt;Section 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#2" data-toggle="tab"&gt;Section 2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="tab-content"&gt;
&lt;div class="tab-pane active" id="1"&gt;
&lt;p&gt;I'm in Section 1.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="tab-pane" id="2"&gt;
&lt;p&gt;Howdy, I'm in Section 2.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
<h3>Tabbable in any direction</h3>
<div class="row">
<!--
<div class="span4">
<p>Swap the order of your HTML&mdash;placing <code>.tabs</code> after <code>.tab-content</code>&mdash;for tabs on the bottom.</p>
</div>
-->
<div class="span4">
<h4>Tabs on the bottom</h4>
<p>Flip the order of the HTML and add a class to put tabs on the bottom.</p>
<div class="tabbable tabs-below">
<div class="tab-content">
<div class="tab-pane active" id="A">
<p>I'm in Section A.</p>
</div>
<div class="tab-pane" id="B">
<p>Howdy, I'm in Section B.</p>
</div>
<div class="tab-pane" id="C">
<p>What up girl, this is Section C.</p>
</div>
</div>
<ul class="nav tabs">
<li class="active"><a href="#A" data-toggle="tab">Section 1</a></li>
<li><a href="#B" data-toggle="tab">Section 2</a></li>
<li><a href="#C" data-toggle="tab">Section 3</a></li>
</ul>
</div> <!-- /tabbable -->
<pre class="prettyprint linenums" style="margin-top: 11px;">
&lt;div class="tabbable tabs-bottom"&gt;
&lt;ul class="nav tabs"&gt;
...
&lt;/ul&gt;
&lt;div class="tab-content"&gt;
...
&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
<div class="span4">
<h4>Tabs on the left</h4>
<p>Swap the class to put tabs on the left.</p>
<div class="tabbable tabs-left">
<ul class="nav tabs">
<li class="active"><a href="#lA" data-toggle="tab">Section 1</a></li>
<li><a href="#lB" data-toggle="tab">Section 2</a></li>
<li><a href="#lC" data-toggle="tab">Section 3</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="lA">
<p>I'm in Section A.</p>
</div>
<div class="tab-pane" id="lB">
<p>Howdy, I'm in Section B.</p>
</div>
<div class="tab-pane" id="lC">
<p>What up girl, this is Section C.</p>
</div>
</div>
</div> <!-- /tabbable -->
<pre class="prettyprint linenums">
&lt;div class="tabbable tabs-left"&gt;
&lt;ul class="nav tabs"&gt;
...
&lt;/ul&gt;
&lt;div class="tab-content"&gt;
...
&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
<div class="span4">
<h4>Tabs on the right</h4>
<p>Swap the class to put tabs on the right.</p>
<div class="tabbable tabs-right">
<ul class="nav tabs">
<li class="active"><a href="#rA" data-toggle="tab">Section 1</a></li>
<li><a href="#rB" data-toggle="tab">Section 2</a></li>
<li><a href="#rC" data-toggle="tab">Section 3</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="rA">
<p>I'm in Section A.</p>
</div>
<div class="tab-pane" id="rB">
<p>Howdy, I'm in Section B.</p>
</div>
<div class="tab-pane" id="rC">
<p>What up girl, this is Section C.</p>
</div>
</div>
</div> <!-- /tabbable -->
<pre class="prettyprint linenums">
&lt;div class="tabbable tabs-right"&gt;
&lt;ul class="nav tabs"&gt;
...
&lt;/ul&gt;
&lt;div class="tab-content"&gt;
...
&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
</div>
</section>
<!-- Navbar
================================================== -->
<section id="navbar">
<div class="page-header">
<h1>Navbar</h1>
</div>
<h2>Static navbar example</h2>
<p>An example of a static (not fixed to the top) navbar with project name, navigation, and search form.</p>
<div class="navbar navbar-static">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<a class="brand" href="#">Project name</a>
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
<form class="navbar-search pull-left" action="">
<input type="text" class="search-query span2" placeholder="Search">
</form>
<ul class="nav pull-right">
<li><a href="#">Link</a></li>
<li class="vertical-divider"></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div>
</div><!-- /navbar-inner -->
</div><!-- /navbar -->
<div class="row">
<div class="span8">
<h3>Navbar scaffolding</h3>
<p>The navbar requires only a few divs to structure it well for static or fixed display.</p>
<pre class="prettyprint linenums">
&lt;div class="navbar navbar-static"&gt;
&lt;div class="navbar-inner"&gt;
&lt;div class="container"&gt;
...
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>To make the navbar fixed, swap the <code>.navbar-static</code> class for <code>.navbar-fixed</code>. In your CSS, you will also need to account for the overlap it causes by adding <code>padding-top: 40px;</code> to your <code>&lt;body&gt;</code>.</p>
<pre class="prettyprint linenums">
&lt;div class="navbar navbar-fixed"&gt;
...
&lt;/div&gt;
</pre>
<h3>Brand name</h3>
<p>A simple link to show your brand or project name only requires an anchor tag.</p>
<pre class="prettyprint linenums">
&lt;a class="brand" href="#"&gt;
Project name
&lt;/a&gt;
</pre>
<h3>Search form</h3>
<p>Search forms receive custom styles in the navbar with the <code>.navbar-search</code> class. Include <code>.pull-left</code> or <code>.pull-right</code> on the <code>form</code> to align it.</p>
<pre class="prettyprint linenums">
&lt;form class="navbar-search"&gt;
&lt;input type="text" class="search-query pull-left" placeholder="Search"&gt;
&lt;/form&gt;
</pre>
</div>
<div class="span4">
<h3>Nav links</h3>
<p>Nav items are simple to add via unordered lists.</p>
<pre class="prettyprint linenums">
&lt;ul class="nav"&gt;
&lt;li class="active"&gt;
&lt;a href="#">Home&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<h3>Adding dropdowns</h3>
<p>Adding dropdowns to the nav is super simple, but does require the use of <a href="./javascript.html/#dropdown">our javascript plugin</a>.</p>
<pre class="prettyprint linenums">
&lt;ul class="nav"&gt;
&lt;li class="dropdown"&gt;
&lt;a href="#"
class="dropdown-toggle"
data-toggle="dropdown">
Account
&lt;b class="caret"&gt;&lt;/b&gt;
&lt;/a&gt;
&lt;ul class="dropdown-menu"&gt;
...
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p><a class="btn" href="./javascript.html/#dropdown">Get the javascript &rarr;</a></p>
</div>
</div>
</section>
<!-- Breadcrumbs
================================================== -->
<section id="breadcrumbs">
<div class="page-header">
<h1>Breadcrumbs <small></small></h1>
</div>
<div class="row">
<div class="span6">
<h3>Why use them</h3>
<p>Breadcrumb navigation is used as a way to show users where they are within an app or a site, but not for primary navigation. Keep their use sparse and succinct to be most effective.</p>
<h3>Examples</h3>
<p>A single example shown as it might be displayed across multiple pages.</p>
<ul class="breadcrumb">
<li class="active">Home</li>
</ul>
<ul class="breadcrumb">
<li><a href="#">Home</a> <span class="divider">/</span></li>
<li class="active">Library</li>
</ul>
<ul class="breadcrumb">
<li><a href="#">Home</a> <span class="divider">/</span></li>
<li><a href="#">Library</a> <span class="divider">/</span></li>
<li class="active">Data</li>
</ul>
</div>
<div class="span6">
<h3>Markup</h3>
<p>HTML is your standard unordered list with links.</p>
<pre class="prettyprint linenums">
&lt;ul class="breadcrumb"&gt;
&lt;li&gt;
&lt;a href="#"&gt;Home&lt;/a&gt; &lt;span class="divider"&gt;/&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="#"&gt;Library&lt;/a&gt; &lt;span class="divider"&gt;/&lt;/span&gt;
&lt;/li&gt;
&lt;li class="active"&gt;
&lt;a href="#"&gt;Data&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
</div>
</section>
<!-- Pagination
================================================== -->
<section id="pagination">
<div class="page-header">
<h1>Pagination <small>Two options for paging through content</small></h1>
</div>
<h2>Multi-page pagination</h2>
<div class="row">
<div class="span4">
<h3>When to use</h3>
<p>Ultra simplistic and minimally styled pagination inspired by Rdio, great for apps and search results. The large block is hard to miss, easily scalable, and provides large click areas.</p>
<h3>Stateful page links</h3>
<p>Links are customizable and work in a number of circumstances with the right class. <code>.disabled</code> for unclickable links and <code>.active</code> for current page.</p>
<h3>Flexible alignment</h3>
<p>Add either of two optional classes to change the alignment of pagination links: <code>.pagination-centered</code> and <code>.pagination-right</code>.</p>
</div>
<div class="span4">
<h3>Examples</h3>
<p>The default pagination component is flexible and works in a number of variations.</p>
<div class="pagination">
<ul>
<li class="disabled"><a href="#">&laquo;</a></li>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">&raquo;</a></li>
</ul>
</div>
<div class="pagination">
<ul>
<li><a href="#">&laquo;</a></li>
<li><a href="#">10</a></li>
<li class="active"><a href="#">11</a></li>
<li><a href="#">12</a></li>
<li><a href="#">&raquo;</a></li>
</ul>
</div>
<div class="pagination">
<ul>
<li><a href="#">&larr;</a></li>
<li class="active"><a href="#">10</a></li>
<li class="disabled"><a href="#">...</a></li>
<li><a href="#">20</a></li>
<li><a href="#">&rarr;</a></li>
</ul>
</div>
<div class="pagination pagination-centered">
<ul>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
</ul>
</div>
</div>
<div class="span4">
<h3>Markup</h3>
<p>Wrapped in a <code>&lt;div&gt;</code>, pagination is just a <code>&lt;ul&gt;</code>.</p>
<pre class="prettyprint linenums">
&lt;div class="pagination"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#"&gt;Prev&lt;/a&gt;&lt;/li>
&lt;li class="active"&gt;
&lt;a href="#"&gt;1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Next&lt;/a&gt;&lt;/li>
&lt;/ul&gt;
&lt;/div&gt;
</pre>
</div>
</div><!-- /row -->
<h2>Pager <small>For quick previous and next links</small></h2>
<div class="row">
<div class="span4">
<h3>About pager</h3>
<p>The pager component is a set of links for simple pagination implemenations with light markup and even lighter styles. It's great for simple sites like blogs or magazines.</p>
</div>
<div class="span4">
<h3>Default example</h3>
<p>By default, the pager centers links.</p>
<ul class="pager">
<li><a href="#">Previous</a></li>
<li><a href="#">Next</a></li>
</ul>
<pre class="prettyprint linenums">
&lt;ul class="pager"&gt;
&lt;li&gt;
&lt;a href="#"&gt;Previous&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="#"&gt;Next&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
<div class="span4">
<h3>Aligned links</h3>
<p>Alternatively, you can align each link to the sides:</p>
<ul class="pager">
<li class="previous"><a href="#">&larr; Older</a></li>
<li class="next"><a href="#">Newer &rarr;</a></li>
</ul>
<pre class="prettyprint linenums">
&lt;ul class="pager"&gt;
&lt;li class="previous"&gt;
&lt;a href="#"&gt;&amp;larr; Older&lt;/a&gt;
&lt;/li&gt;
&lt;li class="next"&gt;
&lt;a href="#"&gt;Newer &amp;rarr;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
</div><!-- /row -->
</section>
<!-- Thumbnails
================================================== -->
<section id="thumbnails">
<div class="page-header">
<h1>Thumbnails <small>Grids of images, videos, text, and more</small></h1>
</div>
<div class="row">
<div class="span6">
<h2>Default thumbnails</h2>
<p>By default, Bootstrap's thumbnails are designed to showcase linked images with minimal required markup.</p>
<ul class="thumbnails">
<li class="span3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/210x150" alt="">
</a>
</li>
<li class="span3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/210x150" alt="">
</a>
</li>
<li class="span3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/210x150" alt="">
</a>
</li>
<li class="span3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/210x150" alt="">
</a>
</li>
</ul>
</div>
<div class="span6">
<h2>Highly customizable</h2>
<p>With a bit of extra markup, it's possible to add any kind of HTML content like headings, paragraphs, or buttons into thumbnails.</p>
<ul class="thumbnails">
<li class="span3">
<div class="thumbnail">
<img src="http://placehold.it/210x150" alt="">
<div class="caption">
<h5>Thumbnail label</h5>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a href="#" class="btn primary">Action</a> <a href="#" class="btn">Action</a></p>
</div>
</div>
</li>
<li class="span3">
<div class="thumbnail">
<img src="http://placehold.it/210x150" alt="">
<div class="caption">
<h5>Thumbnail label</h5>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a href="#" class="btn primary">Action</a> <a href="#" class="btn">Action</a></p>
</div>
</div>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="span4">
<h3>Why use thumbnails</h3>
<p>Thumbnails (previously <code>.media-grid</code> up until v1.4) are great for grids of photos or videos, image search results, retail products, portfolios, and much more. They can be links or static content.</p>
</div>
<div class="span4">
<h3>Simple, flexible markup</h3>
<p>Thumbnail markup is simple&mdash;a <code>ul</code> with any number of <code>li</code> elements is all that is required. It's also super flexible, allowing for any type of content with just a bit more markup to wrap your contents.</p>
</div>
<div class="span4">
<h3>Uses grid column sizes</h3>
<p>Lastly, the thumbnails component uses existing grid system classes&mdash;like <code>.span2</code> or <code>.span3</code>&mdash;for control of thumbnail dimensions.</p>
</div>
</div>
<div class="row">
<div class="span6">
<h2>The markup</h2>
<p>As mentioned previously, the required markup for thumbnails is light and straightforward. Here's a look at the default setup <strong>for linked images</strong>:</p>
<pre class="prettyprint linenums">
&lt;ul class="thumbnails"&gt;
&lt;li class="span3"&gt;
&lt;a href="#" class="thumbnail"&gt;
&lt;img src="http://placehold.it/210x150" alt=""&gt;
&lt;/a&gt;
&lt;/li&gt;
...
&lt;/ul&gt;
</pre>
<p>For custom HTML content in thumbnails, the markup changes slightly. To allow block level content anywhere, we swap the <code>&lt;a&gt;</code> for a <code>&lt;div&gt;</code> like so:</p>
<pre class="prettyprint linenums">
&lt;ul class="thumbnails"&gt;
&lt;li class="span3"&gt;
&lt;div class="thumbnail"&gt;
&lt;img src="http://placehold.it/210x150" alt=""&gt;
&lt;h5&gt;Thumbnail label&lt;/h5&gt;
&lt;p&gt;Thumbnail caption right here...&lt;/p&gt;
&lt;/div&gt;
&lt;/li&gt;
...
&lt;/ul&gt;
</pre>
</div>
<div class="span6">
<h2>More examples</h2>
<p>Explore all your options with the various grid classes available to you. You can also mix and match different sizes.</p>
<ul class="thumbnails">
<li class="span4">
<a href="#" class="thumbnail">
<img src="http://placehold.it/290x230" alt="">
</a>
</li>
<li class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/130x100" alt="">
</a>
</li>
<li class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/130x100" alt="">
</a>
</li>
<li class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/130x100" alt="">
</a>
</li>
<li class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/130x100" alt="">
</a>
</li>
<li class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/130x100" alt="">
</a>
</li>
</ul>
</div>
</div>
</section>
<!-- Alerts & Messages
================================================== -->
<section id="alerts">
<div class="page-header">
<h1>Alerts <small>Styles for success, warning, and error messages</small></h1>
</div>
<h2>Lightweight defaults</h2>
<div class="row">
<div class="span4">
<h3>Rewritten base class</h3>
<p>With Bootstrap 2, we've simplified the base class: <code>.alert</code> instead of <code>.alert-message</code>. We've also reduced the minimum required markup&mdash;no <code>&lt;p&gt;</code> is required by default, just the outter <code>&lt;div&gt;</code>.</p>
<h3>Single alert message</h3>
<p>For a more durable component with less code, we've removed the differentiating look for block alerts, messages that come with more padding and typically more text. The class also has changed to <code>.alert-block</code>.</p>
<hr>
<h3>Goes great with javascript</h3>
<p>Bootstrap comes with a great jQuery plugin that supports alert messages, making dismissing them quick and easy.</p>
<p><a class="btn js-btn" href="./javascript.html#alerts">Get the plugin &raquo;</a></p>
</div>
<div class="span8">
<h3>Example alerts</h3>
<p>Wrap your message and an optional close icon in a div with simple class.</p>
<div class="alert">
<a class="close">&times;</a>
<strong>Warning!</strong> Best check yo self, youre not looking too good.
</div>
<pre class="prettyprint linenums">
&lt;div class="alert"&gt;
&lt;a class="close"&gt;&times;&lt;/a&gt;
&lt;strong&gt;Warning!&lt;/strong&gt; Best check yo self, youre not looking too good.
&lt;/div&gt;
</pre>
<p>Easily extend the standard alert message with two optional classes: <code>.alert-block</code> for more padding and text controls and <code>.alert-heading</code> for a matching heading.</p>
<div class="alert alert-block">
<a class="close">&times;</a>
<h4 class="alert-heading">Warning!</h4>
<p>Best check yo self, youre not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</div>
<pre class="prettyprint linenums">
&lt;div class="alert alert-block"&gt;
&lt;a class="close"&gt;&times;&lt;/a&gt;
&lt;h4 class="alert-heading"&gt;Warning!&lt;/h4&gt;
Best check yo self, youre not...
&lt;/div&gt;
</pre>
</div>
</div>
<h2>Contextual alternatives <small>Add optional classes to change an alert's connotation</small></h2>
<div class="row">
<div class="span4">
<h3>Error or danger</h3>
<div class="alert alert-error">
<a class="close">&times;</a>
<strong>Oh snap!</strong> Change a few things up and try submitting again.
</div>
<pre class="prettyprint linenums">
&lt;div class="alert alert-error"&gt;
...
&lt;/div&gt;
</pre>
</div>
<div class="span4">
<h3>Success</h3>
<div class="alert alert-success">
<a class="close">&times;</a>
<strong>Well done!</strong> You successfully read this important alert message.
</div>
<pre class="prettyprint linenums">
&lt;div class="alert alert-success"&gt;
...
&lt;/div&gt;
</pre>
</div>
<div class="span4">
<h3>Information</h3>
<div class="alert alert-info">
<a class="close">&times;</a>
<strong>Heads up!</strong> This alert needs your attention, but its not super important.
</div>
<pre class="prettyprint linenums">
&lt;div class="alert alert-info"&gt;
...
&lt;/div&gt;
</pre>
</div>
</div>
</section>
<!-- Progress bars
================================================== -->
<section id="progress">
<div class="page-header">
<h1>Progress bars <small>For loading, redirecting, or action status</small></h1>
</div>
<h2>Examples and markup</h2>
<div class="row">
<div class="span4">
<h3>Basic</h3>
<p>Default progress bar with a vertical gradient.</p>
<div class="progress">
<div class="bar" style="width: 60%;"></div>
</div>
<pre class="prettyprint linenums">
&lt;div class="progress"&gt;
&lt;div class="bar"
style="width: 60%;"&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
<div class="span4">
<h3>Striped</h3>
<p>Uses a gradient to create a striped effect.</p>
<div class="progress info striped">
<div class="bar" style="width: 20%;"></div>
</div>
<pre class="prettyprint linenums">
&lt;div class="progress info
striped"&gt;
&lt;div class="bar"
style="width: 20%;"&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
<div class="span4">
<h3>Animated</h3>
<p>Takes the striped example and animates it.</p>
<div class="progress danger active striped">
<div class="bar" style="width: 45%"></div>
</div>
<pre class="prettyprint linenums">
&lt;div class="progress danger
striped active"&gt;
&lt;div class="bar"
style="width: 40%;"&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
</div>
<h2>Options and browser support</h2>
<div class="row">
<div class="span4">
<h3>Additional colors</h3>
<p>Progress bars utilize some of the same classes as buttons and alert messages for quick styling.</p>
<ul>
<li><code>.info</code></li>
<li><code>.success</code></li>
<li><code>.danger</code></li>
</ul>
<p>Alternatively, you can customize the LESS files and roll your own colors and sizes.</p>
</div>
<div class="span4">
<h3>Behavior</h3>
<p>Progress bars use CSS3 transitions, so if you dynamically adjust the width via javascript, it will smoothly resize.</p>
<p>If you use the <code>.active</code> class, your <code>.striped</code> progress bars will animate the stripes left to right.</p>
</div>
<div class="span4">
<h3>Browser support</h3>
<p>Progress bars use CSS3 gradients, transitions, and animations to achieve all their effects. These features are not supported in IE7-8 or older versions of Firefox.</p>
<p>Opera does not support animations at this time.</p>
</div>
</div>
</section>

188
docs/templates/pages/index.mustache vendored Normal file
View File

@ -0,0 +1,188 @@
<div id="overview">
<!-- Masthead
================================================== -->
<header class="jumbotron masthead">
<div class="inner">
<h1>Bootstrap,<br> from Twitter</h1>
<p class="lead">Bootstrap is a responsive frontend toolkit from Twitter designed to kickstart web development, featuring HTML, CSS, and JS for dozens of base elements and common design components.</p>
<p class="download-info">
<a href="https://github.com/twitter/bootstrap/" class="btn primary btn-large">Download on GitHub</a>
<a href="./scaffolding.html" class="btn btn-large">Get started &rarr;</a>
</p>
<div class="benefits">
<h4>Feature highlights</h4>
<ul>
<li><span>&times;</span> Built on LESS</li>
<li><span>&times;</span> Complete styleguide docs</li>
<li><span>&times;</span> Fully responsive design</li>
<li><span>&times;</span> Small footprint (7kb gzipped)</li>
<li><span>&times;</span> Support for IE7 and up</li>
<li><span>&times;</span> Custom jQuery plugins</li>
<li><span>&times;</span> Dozens of components</li>
</ul>
</div>
</div>
</header>
<ul class="quick-links">
<li><strong>Quick links</strong></li>
<li><a href="https://github.com/twitter/bootstrap/">GitHub</a></li>
<li><a href="https://github.com/twitter/bootstrap/issues?state=open">Issues</a></li>
<li><a href="https://github.com/twitter/bootstrap/wiki/Roadmap">Roadmap</a></li>
<li><a href="https://github.com/twitter/bootstrap/wiki/Changelog">Changelog</a></li>
<li class="divider">&middot;</li>
<li>
<iframe class="github-btn" src="http://markdotto.github.com/github-buttons/github-btn.html?user=twitter&repo=bootstrap&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="114px" height="20px"></iframe>
</li>
<li>
<iframe class="github-btn" src="http://markdotto.github.com/github-buttons/github-btn.html?user=twitter&repo=bootstrap&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="98px" height="20px"></iframe>
</li>
<!--
<li><strong>Authors</strong></li>
<li><a href="http://twitter.com/mdo">@mdo</a></li>
<li><a href="http://twitter.com/fat">@fat</a></li>
-->
<li class="divider">&middot;</li>
<li class="follow-btn">
<a href="https://twitter.com/twbootstrap" class="twitter-follow-button" data-width="145px" data-link-color="#0069D6" data-show-count="false">Follow @twbootstrap</a>
</li>
<li class="tweet-btn">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://twitter.github.com/bootstrap/" data-count="horizontal" data-via="twbootstrap" data-related="mdo:Creator of Twitter Bootstrap">Tweet</a>
</li>
</ul>
<div class="marketing">
<h1>Built with Bootstrap.</h1>
<p class="marketing-byline">For even more sites built with Bootstrap, <a href="http://builtwithbootstrap.tumblr.com/" target="_blank">visit the unofficial Tumblr</a>.</p>
<ul class="thumbnails example-sites">
<li class="span4">
<a class="thumbnail" href="http://kippt.com/" target="_blank">
<img src="assets/img/example-sites/kippt.png" alt="Kippt">
</a>
</li>
<li class="span4">
<a class="thumbnail" href="http://www.fleetio.com/" target="_blank">
<img src="assets/img/example-sites/fleetio.png" alt="Fleetio">
</a>
</li>
<li class="span4">
<a class="thumbnail" href="http://www.jshint.com/" target="_blank">
<img src="assets/img/example-sites/jshint.png" alt="JS Hint">
</a>
</li>
</ul>
<h1>Designed for everyone, everywhere.</h1>
<p class="marketing-byline">Need reasons to love Bootstrap? Look no further.</p>
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_042_group.png">
<h2>Built for and by nerds</h2>
<p>Like you, we love building awesome products on the web. We love it so much, we decided to help people just like us do it easier, better, and faster. Bootstrap is built for you.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_079_podium.png">
<h2>For all skill levels</h2>
<p>Bootstrap is designed to help people of all skill level&mdash;designer or developer, huge nerd or early beginner. Use it as a complete kit or use to start something more complex.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_163_iphone.png">
<h2>Cross-everything</h2>
<p>Originally built with only modern browsers in mind, Bootstrap has evolved to include support for all major browsers (even IE7!) and, with Bootstrap 2, tablets and smartphones, too.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_155_show_thumbnails.png">
<h2>12-column grid</h2>
<p>Grid systems aren't everything, but having a durable and flexible one at the core of your work can make development much simpler. Use our built-in grid classes or roll your own.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_214_resize_small.png">
<h2>Responsive design</h2>
<p>With Bootstrap 2, we've gone fully responsive. Our components are scaled according to a range of resolutions and devices to provide a consistent experience, no matter what.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_266_book_open.png">
<h2>Styleguide docs</h2>
<p>Unlike other front-end toolkits, Bootstrap was designed first and foremost as a styleguide to document not only our features, but best practices and living, coded examples.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_082_roundabout.png">
<h2>Growing library</h2>
<p>Despite being only 7kb (gzipped), Bootstrap is one of the most complete front-end toolkits out there with dozens of fully functional components ready to be put to use.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/glyphicons/glyphicons_009_magic.png">
<h2>Custom jQuery plugins</h2>
<p>What good is an awesome design component without easy-to-use, proper, and extensible interactions? With Bootstrap, you get custom-built jQuery plugins to bring your projects to life.</p>
</div>
<div class="span4">
<img class="icon" src="assets/img/less-small.png">
<h2>Built on LESS</h2>
<p>Where vanilla CSS falters, LESS excels. Variables, nesting, operations, and mixins in LESS makes coding CSS faster and more efficient with minimal overhead.</p>
</div>
</div><!--/row-->
<div class="row">
<div class="span3">
<img class="small-icon" src="assets/img/icon-html5.png">
<h3>HTML5</h3>
<p>Built to support new HTML5 elements and syntax.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-css3.png">
<h3>CSS3</h3>
<p>Progressively enhanced components for ultimate style.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-github.png">
<h3>Open-source</h3>
<p>Built for and maintained by the community via <a href="https://github.com">GitHub</a>.</p>
</div>
<div class="span3">
<img class="small-icon" src="assets/img/icon-twitter.png">
<h3>Made at Twitter</h3>
<p>Brought to you by an experienced <a href="http://twitter.com/fat">engineer</a> and <a href="http://twitter.com/mdo">designer</a>.</p>
</div>
</div><!--/row-->
<!-- Quickstart options
================================================== -->
<h1>Get started in no time.</h1>
<p class="marketing-byline">Quickly start using Bootstrap within your workflow and development process.</p>
<table class="table table-bordered getting-started">
<tbody>
<tr>
<td class="quick-start">
<h3>Hotlink the CSS</h3>
<p>For the quickest and easiest start, just copy this snippet into your webpage.</p>
<form>
<textarea class="copy-code" rows="1">&lt;link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.min.css"></textarea>
</form>
</td>
<td class="quick-start">
<h3>Use it with LESS</h3>
<p>A fan of using LESS? No problem, just clone the repo and add these lines:</p>
<form>
<textarea class="copy-code" rows="2">&lt;link rel="stylesheet/less" href="/path/to/bootstrap.less"&gt;
&lt;script src="/path/to/less.js"&gt;&lt;/script&gt;</textarea>
</form>
</td>
<td class="quick-start">
<h3>Fork on GitHub</h3>
<p>Download, fork, pull, file issues, and more with the Bootstrap GitHub repo.</p>
<p><a target="_blank" href="https://github.com/twitter/bootstrap" class="btn primary">Bootstrap on GitHub &raquo;</a></p>
<p class="current-version">Currently <a href="https://github.com/twitter/bootstrap/wiki/Changelog">v2.0.0</a></p>
</td>
</tr>
</tbody>
</table>
</div><!-- /.marketing -->
</div><!-- /#overview -->

1299
docs/templates/pages/javascript.mustache vendored Normal file
View File

@ -0,0 +1,1299 @@
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Javascript for Bootstrap</h1>
<p class="lead">Bring Bootstrap's components to life&mdash;now with 12 custom <a href="http://jquery.com/" target="_blank">jQuery</a> plugins.
</header>
<!-- Using Javascript w/ Bootstrap
================================================== -->
<section id="javascript">
<div class="page-header">
<h1>jQuery plugins <small>A dozen Bootstrap plugins to get you started</small></h1>
</div>
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#modals">Modals</a><input checked="true" value="bootstrap-modal.js" type="checkbox"></h3>
<p>A streamlined, but flexible, take on the traditional javascript modal plugin with only the minimum required functionality and smart defaults.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#dropdowns">Dropdowns</a><input checked="true" value="bootstrap-dropdown.js" type="checkbox"></h3>
<p>Add dropdown menus to nearly anything in Bootstrap with this simple plugin. Bootstrap features full dropdown menu support on in the navbar, tabs, and pills.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#scrollspy">Scrollspy</a><input checked="true" value="bootstrap-scrollspy.js" type="checkbox"></h3>
<p>Use scrollspy to automatically update the links in your navbar to show the current active link based on scroll position.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#tabs">Togglable tabs</a><input checked="true" value="bootstrap-tab.js" type="checkbox"></h3>
<p>Use this plugin to make tabs and pills more useful by allowing them to toggle through tabbable panes of local content.</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#tooltips">Tooltips</a><input checked="true" value="bootstrap-tooltip.js" type="checkbox"></h3>
<p>A new take on the jQuery Tipsy plugin, Tooltips don't rely on images, uss CSS3 for animations, and data-attributes for local title storage.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#popovers">Popovers</a> <small class="muted">*</small><input checked="true" value="bootstrap-popover.js" type="checkbox"></h3>
<p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
<p class="muted"><strong>*</strong> Requires <a href="#tooltips">Tooltips</a> to be included</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#alerts">Alert messages</a><input checked="true" value="bootstrap-alert.js" type="checkbox"></h3>
<p>The alert plugin is a tiny class for adding close functionality to alerts.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#buttons">Buttons</a><input checked="true" value="bootstrap-button.js" type="checkbox"></h3>
<p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<label>
<h3><a href="./javascript.html#collapse">Collapse</a><input checked="true" value="bootstrap-collapse.js" type="checkbox"></h3>
<p>Get base styles and flexible support for collapsible components like accordions and navigation.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#carousel">Carousel</a><input checked="true" value="bootstrap-carousel.js" type="checkbox"></h3>
<p>Create a merry-go-round of any content you wish to provide an interactive slideshow of content.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#typeahead">Typeahead</a><input checked="true" value="bootstrap-typeahead.js" type="checkbox"></h3>
<p>A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.</p>
</label>
</div>
<div class="span3">
<label>
<h3><a href="./javascript.html#transitions">Transitions</a> <small class="muted">*</small><input value="bootstrap-transition.js" checked="true" type="checkbox"></h3>
<p>For simple transition effects, include bootstrap-transition.js once to slide in modals or fade out alerts.</p>
<p class="muted"><strong>*</strong> Required for animation in plugins</p>
</label>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<div class="btn-group" id="javascriptBuilder">
<a id="javascriptBuild" class="btn primary large" href="#">Download Source</a>
<a class="btn primary large dropdown-toggle" data-toggle="dropdown" href="#">
<span class="caret"></span>
</a>
<ul class="dropdown-menu large">
<li class="active"><a href="#">Compressed</a></li>
<li><a href="#">Uncompressed</a></li>
</ul>
</div>
</div>
</div>
<hr>
<a id="selectAll" href="#" style="float:right">Select/Unselect All Plugins</a>
<p class="muted"><span class="label warning">Note:</span> All plugins require the latest version of <a href="http://jquery.com/" target="_blank">jQuery</a> to be included.</p>
</section>
<!-- Modal
================================================== -->
<section id="modals">
<div class="page-header">
<h1>Modals <small>bootstrap-modal.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About modals</h3>
<p>A streamlined, but flexible, take on the traditional javascript modal plugin with only the minimum required functionality and smart defaults.</p>
<a href="../js/bootstrap-modal.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Static example</h2>
<p>Below is a statically rendered modal.</p>
<div class="well" style="background-color: #888; border: none;">
<div class="modal" style="position: relative; top: auto; left: auto; margin: 0 auto; z-index: 1">
<div class="modal-header">
<a href="#" class="close" data-dismiss="modal">&times;</a>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<a href="#" class="btn primary">Save changes</a>
<a href="#" class="btn">Close</a>
</div>
</div>
</div> <!-- /well -->
<h2>Live demo</h2>
<p>Toggle a modal via javascript by clicking the button below. It will slide down and fade in from the top of the page.</p>
<!-- sample modal content -->
<div id="myModal" class="modal hide fade">
<div class="modal-header">
<a href="#" class="close" data-dismiss="modal" >&times;</a>
<h3>Modal Heading</h3>
</div>
<div class="modal-body">
<h4>Text in a modal</h4>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem.</p>
<h4>Popover in a modal</h4>
<p>This <a href="#" class="btn" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">button</a> should trigger a popover on hover.</p>
<h4>Tooltips in a modal</h4>
<p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> should have tooltips on hover.</p>
</div>
<div class="modal-footer">
<a href="#" class="btn primary">Save changes</a>
<a href="#" class="btn" data-dismiss="modal" >Close</a>
</div>
</div>
<a data-toggle="modal" href="#myModal" class="btn primary large">Launch demo modal</a>
<hr>
<h2>Using bootstrap-modal</h2>
<p>Call the modal via javascript:</p>
<pre class="prettyprint linenums">$('#myModal').modal(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>backdrop</td>
<td>boolean</td>
<td>true</td>
<td>Includes a modal-backdrop element</td>
</tr>
<tr>
<td>keyboard</td>
<td>boolean</td>
<td>true</td>
<td>Closes the modal when escape key is pressed</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>You can activate modals on your page easily without having to write a single line of javascript. Just set <code>data-toggle="modal"</code> on a controller element with a <code>data-target="#foo"</code> or <code>href="#foo"</code> which corresponds to a modal element id, and when clicked, it will launch your modal.</p>
<p>Also, to add options to your modal instance, just include them as additional data attributes on either the control element or the modal markup itself.</p>
<pre class="prettyprint linenums">
&lt;a class="btn" data-toggle="modal" href="#myModal" &gt;Launch Modal&lt;/a&gt;
</pre>
<pre class="prettyprint linenums">
&lt;div class="modal"&gt;
&lt;div class="modal-header"&gt;
&lt;a href="#" class="close js-dismiss"&gt;&times;&lt;/a&gt;
&lt;h3&gt;Modal header&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
&lt;p&gt;One fine body…&lt;/p&gt;
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;a href="#" class="btn primary"&gt;Save changes&lt;/a&gt;
&lt;a href="#" class="btn"&gt;Close&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
<p><span class="label notice">Notice</span> If you want your modal to animate in and out, just add a <code>.fade</code> class to the <code>.modal</code> element (refer to the demo to see this in action).</p>
<h3>Methods</h3>
<h4>.modal(options)</h4>
<p>Activates your content as a modal. Accepts an optional options <code>object</code>.
<pre class="prettyprint linenums">
$('#myModal').modal({
keyboard: false
})</pre>
<h4>.modal('toggle')</h4>
<p>Manually toggles a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('toggle')</pre>
<h4>.modal('show')</h4>
<p>Manually opens a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('show')</pre>
<h4>.modal('hide')</h4>
<p>Manually hides a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('hide')</pre>
<h3>Events</h3>
<p>Bootstrap's modal class exposes a few events for hooking into modal functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires immediately when the <code>show</code> instance method is called.</td>
</tr>
<tr>
<td>shown</td>
<td>This event is fired when the modal has been made visible to the user (will wait for css transitions to complete).</td>
</tr>
<tr>
<td>hide</td>
<td>This event is fired immediately when the <code>hide</code> instance method has been called.</td>
</tr>
<tr>
<td>hidden</td>
<td>This event is fired when the modal has finished being hidden from the user (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<pre class="prettyprint linenums">
$('#myModal').on('hidden', function () {
// do something ...
})</pre>
</div>
</div>
</section>
<!-- Dropdown
================================================== -->
<section id="dropdowns">
<div class="page-header">
<h1>Dropdowns <small>bootstrap-dropdown.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About dropdowns</h3>
<p>Add dropdown menus to nearly anything in Bootstrap with this simple plugin. Bootstrap features full dropdown menu support on in the navbar, tabs, and pills.</p>
<a href="../js/bootstrap-dropdown.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Examples</h2>
<p>Click on the dropdown nav links in the navbar and pills below to test dropdowns.</p>
<div id="navbar-example" class="navbar navbar-static">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<a class="brand" href="#">Project Name</a>
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
<ul class="nav pull-right">
<li id="fat-menu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 3 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div> <!-- /navbar-example -->
<ul class="nav pills">
<li class="active"><a href="#">Regular link</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
<ul id="menu1" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown 2 <b class="caret"></b></a>
<ul id="menu2" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown 3 <b class="caret"></b></a>
<ul id="menu3" class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul> <!-- /tabs -->
<hr>
<h2>Using bootstrap-dropdown.js</h2>
<p>Call the dropdowns via javascript:</p>
<pre class="prettyprint linenums">$('.dropdown-toggle').dropdown()</pre>
<h3>Markup</h3>
<p>To quickly add dropdown functionality to any element just add <code>data-toggle="dropdown"</code> and any valid bootstrap dropdown will automatically be activated.</p>
<p><span class="label notice">Notice</span> For added control and flexibility, optionally specify a <code>data-target="#fat"</code> or <code>href="#fat"</code> - this allows you to target specific dropdowns.</p>
<pre class="prettyprint linenums">
&lt;ul class="nav pills"&gt;
&lt;li class="active"&gt;&lt;a href="#"&gt;Regular link&lt;/a&gt;&lt;/li&gt;
&lt;li class="dropdown" id="menu1"&gt;
&lt;a class="dropdown-toggle" data-toggle="dropdown" href="#menu1"&gt;
Dropdown
&lt;b class="caret"&gt;&lt;/b&gt;
&lt;/a&gt;
&lt;ul class="dropdown-menu"&gt;
&lt;li&gt;&lt;a href="#"&gt;Action&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Another action&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Something else here&lt;/a&gt;&lt;/li&gt;
&lt;li class="divider"&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Separated link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
...
&lt;/ul&gt;</pre>
<h3>Methods</h3>
<h4>$().dropdown()</h4>
<p>
A programatic api for activating menus for a given navbar or tabbed navigation.
</p>
</div>
</div>
</section>
<!-- ScrollSpy
================================================== -->
<section id="scrollspy">
<div class="page-header">
<h1>ScrollSpy <small>bootstrap-scrollspy.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<p>The ScrollSpy plugin is for automatically updating nav targets based on scroll position.</p>
<a href="../js/bootstrap-scrollspy.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example navbar with scrollspy</h2>
<p>Scroll the area below and watch the navigation update. The dropdown sub items will be highlighted as well. Try it!</p>
<div id="navbarExample" class="navbar navbar-static">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<a class="brand" href="#">Project Name</a>
<ul class="nav">
<li><a href="#fat">@fat</a></li>
<li><a href="#mdo">@mdo</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#one">one</a></li>
<li><a href="#two">two</a></li>
<li class="divider"></li>
<li><a href="#three">three</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div data-spy="scroll" data-target="#navbarExample" data-offset="0" class="scrollspy-example">
<h4 id="fat">@fat</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
<h4 id="mdo">@mdo</h4>
<p>
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.
</p>
<h4 id="one">one</h4>
<p>
Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.
</p>
<h4 id="two">two</h4>
<p>
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
</p>
<h4 id="three">three</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
<p>Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
</p>
</div>
<hr>
<h2>Using bootstrap-scrollspy.js</h2>
<p>Call the scrollspy via javascript:</p>
<pre class="prettyprint linenums">$('#navbar').scrollspy()</pre>
<h3>Markup</h3>
<p>To easily add scrollspy behavior to your topbar navigation, just add <code>data-spy="scroll"</code> to the element you want to spy on (most typically this would be the body).
<pre class="prettyprint linenums">&lt;body data-spy="scroll" &gt;...&lt;/body&gt;</pre>
<p><span class="label notice">Notice</span> Navbar anchor tags must have resolvable id targets. For example, a <code>&lt;a href="#home"&gt;home&lt;/a&gt;</code> must correspond to something in the dom like <code>&lt;div id="home"&gt;&lt;/div&gt;</code>.
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>offset</td>
<td>number</td>
<td>10</td>
<td>Pixels to offset from top when calculating position of scroll.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- Tabs
================================================== -->
<section id="tabs">
<div class="page-header">
<h1>Togglable tabs <small>bootstrap-tab.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<p>This plugin adds quick, dynamic tab and pill functionality for transitioning through local content.</p>
<a href="../js/bootstrap-tab.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example tabs</h2>
<p>Click the tabs below to toggle between hidden panes, even via dropdown menus.</p>
<ul id="tab" class="nav tabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li><a href="#profile" data-toggle="tab">Profile</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#dropdown1" data-toggle="tab">@fat</a></li>
<li><a href="#dropdown2" data-toggle="tab">@mdo</a></li>
</ul>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home">
<p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
</div>
<div class="tab-pane fade" id="profile">
<p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
</div>
<div class="tab-pane fade" id="dropdown1">
<p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p>
</div>
<div class="tab-pane fade" id="dropdown2">
<p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
</div>
</div>
<hr>
<h2>Using bootstrap-tab.js</h2>
<p>Enable tabbable tabs via javascript:</p>
<pre class="prettyprint linenums">$('#myTab').tab('show')</pre>
<h3>Markup</h3>
<p>You can activate a tab or pill navigation without writing any javascript by simply specifying <code>data-toggle="tab"</code> or <code>data-toggle="pill"</code> on an element.</p>
<pre class="prettyprint linenums">
&lt;ul class="tabs"&gt;
&lt;li&gt;&lt;a href="#home" data-toggle="tab"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#profile" data-toggle="tab"&gt;Profile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#messages" data-toggle="tab"&gt;Messages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#ettings" data-toggle="tab"&gt;Settings&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<h3>Methods</h3>
<h4>$().tab</h4>
<p>
Activates a tab element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the dom.
</p>
<pre class="prettyprint linenums">
&lt;ul class="tabs"&gt;
&lt;li class="active"&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#profile"&gt;Profile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#messages"&gt;Messages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#settings"&gt;Settings&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="tab-content"&gt;
&lt;div class="active" id="home"&gt;...&lt;/div&gt;
&lt;div id="profile"&gt;...&lt;/div&gt;
&lt;div id="messages"&gt;...&lt;/div&gt;
&lt;div id="settings"&gt;...&lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
$(function () {
$('.tabs a:last').tab('show')
})
&lt;/script&gt;</pre>
</p>
<h3>Events</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires on tab show, but before the new tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
</tr>
<tr>
<td>shown</td>
<td>This event fires on tab show after a tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
</tr>
</tbody>
</table>
<pre class="prettyprint linenums">
$('a[data-toggle="tab"]').on('shown', function (e) {
e.target // activated tab
e.relatedTarget // previous tab
})</pre>
</div>
</div>
</section>
<!-- Tooltips
================================================== -->
<section id="tooltips">
<div class="page-header">
<h1>Tooltips <small>bootstrap-tooltip.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About Tooltips</h3>
<p>Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don't rely on images, uss css3 for animations, and data-attributes for local title storage.</p>
<a href="../js/bootstrap-tooltip.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example use of Tooltips</h2>
<p>Hover over the links below to see tooltips:</p>
<div class="tooltip-demo well">
<p class="muted" style="margin-bottom: 0;">Tight pants next level keffiyeh <a href="#" rel='tooltip' title="first tooltip">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" rel='tooltip' title='Another tooltip'>have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A <a href="#" rel='tooltip' title='Another one here too'>really ironic</a> artisan whatever keytar, scenester farm-to-table banksy Austin <a href="#" rel='tooltip' title='The last tip!'>twitter handle</a> freegan cred raw denim single-origin coffee viral.
</p>
</div>
<hr>
<h2>Using bootstrap-tooltip.js</h2>
<p>Trigger the tooltip via javascript:</p>
<pre class="prettyprint linenums">$('#example').tooltip(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>animation</td>
<td>boolean</td>
<td>true</td>
<td>apply a css fade transition to the tooltip</td>
</tr>
<tr>
<td>placement</td>
<td>string</td>
<td>'top'</td>
<td>how to position the tooltip - top | bottom | left | right</td>
</tr>
<tr>
<td>selector</td>
<td>string</td>
<td>false</td>
<td>If a selector is provided, tooltip objects will be delegated to the specified targets.</td>
</tr>
<tr>
<td>title</td>
<td>string | function</td>
<td>''</td>
<td>default title value if `title` tag isn't present</td>
</tr>
<tr>
<td>trigger</td>
<td>string</td>
<td>'hover'</td>
<td>how tooltip is triggered - hover | focus | manual</td>
</tr>
<tr>
<td>delay</td>
<td>number | object</td>
<td>0</td>
<td>
<p>delay showing/hiding the tooltip (ms)</p>
<p>If a number is supplied, delay is applied to both hide/show</p>
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
</td>
</tr>
</tbody>
</table>
<p><span class="label notice">Notice</span> Individual tooltip instance options can alternatively be specified through the use of data attributes.</code></p>
<h3>Markup</h3>
<p>For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.</p>
<h3>Methods</h3>
<h4>$().tooltip(options)</h4>
<p>Attaches a tooltip handler to an element collection.</p>
<h4>.tooltip('show')</h4>
<p>Reveals an elements tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('show')</pre>
<h4>.tooltip('hide')</h4>
<p>Hides an elements tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('hide')</pre>
</div>
</div>
</section>
<!-- Popovers
================================================== -->
<section id="popovers">
<div class="page-header">
<h1>Popovers <small>bootstrap-popover.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About popovers</h3>
<p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
<p class="muted"><strong>*</strong> Requires <a href="#tooltip">Tooltip</a> to be included</p>
<a href="../js/bootstrap-popover.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example hover popover</h2>
<p>Hover over the button to trigger the popover.</p>
<div class="well">
<a href="#" class="btn danger" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">hover for popover</a>
</div>
<hr>
<h2>Using bootstrap-popover.js</h2>
<p>Enable popovers via javascript:</p>
<pre class="prettyprint linenums">$('#example').popover(options)</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>animation</td>
<td>boolean</td>
<td>true</td>
<td>apply a css fade transition to the tooltip</td>
</tr>
<tr>
<td>placement</td>
<td>string</td>
<td>'right'</td>
<td>how to position the popover - top | bottom | left | right</td>
</tr>
<tr>
<td>selector</td>
<td>string</td>
<td>false</td>
<td>if a selector is provided, tooltip objects will be delegated to the specified targets</td>
</tr>
<tr>
<td>trigger</td>
<td>string</td>
<td>'hover'</td>
<td>how tooltip is triggered - hover | focus | manual</td>
</tr>
<tr>
<td>title</td>
<td>string | function</td>
<td>''</td>
<td>default title value if `title` attribute isn't present</td>
</tr>
<tr>
<td>content</td>
<td>string | function</td>
<td>''</td>
<td>default content value if `data-content` attribute isn't present</td>
</tr>
<tr>
<td>delay</td>
<td>number | object</td>
<td>0</td>
<td>
<p>delay showing/hiding the popover (ms)</p>
<p>If a number is supplied, delay is applied to both hide/show</p>
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
</td>
</tr>
</tbody>
</table>
<p><span class="label notice">Notice</span> Individual popover instance options can alternatively be specified through the use of data attributes.</code></p>
<h3>Markup</h3>
<p>
For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a the selector option.
</p>
<h3>Methods</h3>
<h4>$().popover(options)</h4>
<p>Initializes popovers for an element collection.</p>
<h4>.popover('show')</h4>
<p>Reveals an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('show')</pre>
<h4>.popover('hide')</h4>
<p>Hides an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('hide')</pre>
</div>
</div>
</section>
<!-- Alert
================================================== -->
<section id="alerts">
<div class="page-header">
<h1>Alert messages <small>bootstrap-alert.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About alerts</h3>
<p>The alert plugin is a tiny class for adding close functionality to alerts.</p>
<a href="../js/bootstrap-alerts.js" target="_blank" class="btn">Download</a>
</div>
<div class="span9 columns">
<h2>Example alerts</h2>
<p>The alerts plugin works on regular alert messages, and block messages.</p>
<div class="alert fade in">
<a class="close" data-dismiss="alert" href="#">&times;</a>
<strong>Holy guacamole!</strong> Best check yo self, youre not looking too good.
</div>
<div class="alert alert-block alert-error fade in">
<a class="close" data-dismiss="alert" href="#">&times;</a>
<h4 class="alert-heading">Oh snap! You got an error!</h4>
<p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
<p>
<a class="btn danger small" href="#">Take this action</a> <a class="btn small" href="#">Or do this</a>
</p>
</div>
<hr>
<h2>Using bootstrap-alerts.js</h2>
<p>Enable dismissal of an alert via javascript:</p>
<pre class="prettyprint linenums">$(".alert-message").alert()</pre>
<h3>Markup</h3>
<p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
<pre class="prettyprint linenums">&lt;a class="close" data-dismiss="alert" href="#"&gt;&amp;times;&lt;/a&gt;</pre>
<h3>Methods</h3>
<h4>$().alert()</h4>
<p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>
<h4>.alert('close')</h4>
<p>Closes an alert.</p>
<pre class="prettyprint linenums">$(".alert-message").alert('close')</pre>
<h3>Events</h3>
<p>Bootstrap's alert class exposes a few events for hooking into alert functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>close</td>
<td>This event fires immediately when the <code>close</code> instance method is called.</td>
</tr>
<tr>
<td>closed</td>
<td>This event is fired when the alert has been closed (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<pre class="prettyprint linenums">
$('#my-alert').bind('closed', function () {
// do something ...
})</pre>
</div>
</div>
</section>
<!-- Buttons
================================================== -->
<section id="buttons">
<div class="page-header">
<h1>Buttons <small>bootstrap-button.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
<a href="../js/bootstrap-button.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example uses</h2>
<p>Use the buttons plugin for states and toggles.</p>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>Stateful</td>
<td>
<button id="fat-btn" data-loading-text="loading..." class="btn primary">
Loading State
</button>
</td>
</tr>
<tr>
<td>Single toggle</td>
<td>
<button class="btn primary" data-toggle="button">Single Toggle</button>
</td>
</tr>
<tr>
<td>Checkbox</td>
<td>
<div class="btn-group" data-toggle="buttons-checkbox">
<button class="btn primary">Left</button>
<button class="btn primary">Middle</button>
<button class="btn primary">Right</button>
</div>
</td>
</tr>
<tr>
<td>Radio</td>
<td>
<div class="btn-group" data-toggle="buttons-radio">
<button class="btn primary">Left</button>
<button class="btn primary">Middle</button>
<button class="btn primary">Right</button>
</div>
</td>
</tr>
</tbody>
</table>
<hr>
<h2>Using bootstrap-button.js</h2>
<p>Enable buttons via javascript:</p>
<pre class="prettyprint linenums">$('.tabs').button()</pre>
<h3>Markup</h3>
<p>Data attributes are integral to the button plugin. Check out the example code below for the various markup types.</p>
<pre class="prettyprint linenums">
&lt;!-- Add data-toggle="button" to activate toggling on a single button --&gt;
&lt;button class="btn" data-toggle="button"&gt;Single Toggle&lt;/button&gt;
&lt;!-- Add data-toggle="buttons-checkbox" for checkbox style toggling on btn-group --&gt;
&lt;div class="btn-group" data-toggle="buttons-checkbox"&gt;
&lt;button class="btn"&gt;Left&lt;/button&gt;
&lt;button class="btn"&gt;Middle&lt;/button&gt;
&lt;button class="btn"&gt;Right&lt;/button&gt;
&lt;/div&gt;
&lt;!-- Add data-toggle="buttons-radio" for radio style toggling on btn-group --&gt;
&lt;div class="btn-group" data-toggle="buttons-radio"&gt;
&lt;button class="btn"&gt;Left&lt;/button&gt;
&lt;button class="btn"&gt;Middle&lt;/button&gt;
&lt;button class="btn"&gt;Right&lt;/button&gt;
&lt;/div&gt;
</pre>
<h3>Methods</h3>
<h4>$().button('toggle')</h4>
<p>Toggles push state. Gives btn the look that it's been activated.</p>
<p><span class="label notice">Notice</span> You can enable auto toggling of a button by using the <code>data-toggle</code> attribute.</p>
<pre class="prettyprint linenums">&lt;button class="btn" data-toggle="button" &gt;...&lt;/button&gt;</pre>
<h4>$().button('loading')</h4>
<p>Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute <code>data-loading-text</code>.
</p>
<pre class="prettyprint linenums">&lt;button class="btn" data-loading-text="loading stuff..." &gt;...&lt;/button&gt;</pre>
<p>
<span class="label notice">Notice</span> Firefox persists the disabled state across page loads. A workaround for this is to use: <code>autocomplete="off"</code>. More info can be found <a href="https://github.com/twitter/bootstrap/issues/793">here</a>.
</p>
<h4>$().button('reset')</h4>
<p>Resets button state - swaps text to original text.</p>
<h4>$().button(string)</h4>
<p>Resets button state - swaps text to any data defined text state.</p>
<pre class="prettyprint linenums">&lt;button class="btn" data-complete-text="finished!" &gt;...&lt;/button&gt;
&lt;script&gt;
$('.btn').button('complete')
&lt;/script&gt;</pre>
</div>
</div>
</section>
<!-- Collapse
================================================== -->
<section id="collapse">
<div class="page-header">
<h1>Collapse <small>bootstrap-collapse.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>Get base styles and flexible support for collapsible components like accordions and navigation.</p>
<a href="../js/bootstrap-collapse.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example accordion</h2>
<p>Using the collapse plugin, we built a simple accordion style widget:</p>
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
Collapsible Group Item #3
</a>
</div>
<div id="collapseThree" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
<hr>
<h2>Using bootstrap-collapse.js</h2>
<p>Enable via javascript:</p>
<pre class="prettyprint linenums">$(".collapse").collapse()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parent</td>
<td>selector</td>
<td>false</td>
<td>If selector then all collapsible elements under the specified parent will be closed when this collasabile item is shown. (similar to traditional accordion behavior)</td>
</tr>
<tr>
<td>toggle</td>
<td>boolean</td>
<td>true</td>
<td>Toggles the collapsible element on invocation</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>Just add <code>data-toggle="collapse"</code> and a <code>data-target</code> to element to automatically assign control of a collapsible element. The <code>data-target</code> attribute accepts a css selector to apply the collapse to. Be sure to add the class <code>collapse</code> to the collapsible element. If you'd like it to default open, add the additional class <code>in</code>.</p>
<pre class="prettyprint linenums">
&lt;button class="btn danger" data-toggle="collapse" data-target="#demo"&gt;
simple collapsible
&lt;/button&gt;
&lt;div id="demo" class="collapse in"&gt; … &lt;/div&gt;</pre>
<p><span class="label notice">Notice</span> To add accordion like group management to a collapsible control just add the additional data attribute <code>data-parent="#selector"</code>. Refer to the demo below to see this in action.</p>
<h3>Methods</h3>
<h4>.collapse(options)</h4>
<p>Activates your content as a collapsible element. Accepts an optional options <code>object</code>.
<pre class="prettyprint linenums">
$('#myCollapsible').collapse({
toggle: false
})</pre>
<h4>.collapse('toggle')</h4>
<p>Toggles a collapsible element to shown or hidden.</p>
<h4>.collapse('show')</h4>
<p>Shows a collapsible element.</p>
<h4>.collapse('hide')</h4>
<p>Hides a collapsible element.</p>
<h3>Events</h3>
<p>
Bootstrap's collapse class exposes a few events for hooking into collapse functionality.
</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show</td>
<td>This event fires immediately when the <code>show</code> instance method is called.</td>
</tr>
<tr>
<td>shown</td>
<td>This event is fired when a collapse element has been made visible to the user (will wait for css transitions to complete).</td>
</tr>
<tr>
<td>hide</td>
<td>
This event is fired immediately when the <code>hide</code> method has been called.
</td>
</tr>
<tr>
<td>hidden</td>
<td>This event is fired when a collapse element has been hidden from the user (will wait for css transitions to complete).</td>
</tr>
</tbody>
</table>
<pre class="prettyprint linenums">
$('#myCollapsible').on('hidden', function () {
// do something ...
})</pre>
</div>
</div>
</section>
<!-- Carousel
================================================== -->
<section id="carousel">
<div class="page-header">
<h1>Carousel <small>bootstrap-carousel.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>A generic plugin for cycling through elements. A merry-go-round.</p>
<a href="../js/bootstrap-carousel.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example carousel</h2>
<p>Watch the slideshow below.</p>
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="item active">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>First Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>Second Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1000x500" alt="">
<div class="carousel-caption">
<h4>Third Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>
</div>
<hr>
<h2>Using bootstrap-carousel.js</h2>
<p>Call via javascript:</p>
<pre class="prettyprint linenums">$('.carousel').carousel()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>interval</td>
<td>number</td>
<td>5000</td>
<td>The amount of type to delay between automatically cycling an item.</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>Data attributes are integral to the carousel plugin. Check out the example code below for the various markup types.</p>
<pre class="prettyprint linenums">
&lt;div class="carousel"&gt;
&lt;!-- Carousel items --&gt;
&lt;div class="carousel-inner"&gt;
...
&lt;/div&gt;
&lt;!-- Carousel nav --&gt;
&lt;a class="carousel-control left" href="#myCarousel" data-slide="prev"&gt;&amp;lsaquo;&lt;/a&gt;
&lt;a class="carousel-control right" href="#myCarousel" data-slide="next"&gt;&amp;rsaquo;&lt;/a&gt;
&lt;/div&gt;
</pre>
<h3>Methods</h3>
<h4>.carousel(options)</h4>
<p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p>
<pre class="prettyprint linenums">
$('.myCarousel').carousel({
interval: 2000
})
</pre>
<h4>.carousel('cycle')</h4>
<p>Cycles through the carousel items from left to right.</p>
<h4>.carousel('pause')</h4>
<p>Stops the carousel from cycling through items.</p>
<h4>.carousel(number)</h4>
<p>Cycles the carousel to a particular frame (0 based, similar to an array).</p>
<h4>.carousel('prev')</h4>
<p>Cycles to the previous item.</p>
<h4>.carousel('next')</h4>
<p>Cycles to the next item.</p>
<h3>Events</h3>
<p>Bootstrap's modal class exposes a few events for hooking into modal functionality. </p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>slide</td>
<td>This event fires immediately when the <code>slide</code> instance method is invoked.</td>
</tr>
<tr>
<td>slid</td>
<td>This event is fired when the carousel has completed it's slide transition.</td>
</tr>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- Typeahead
================================================== -->
<section id="typeahead">
<div class="page-header">
<h1>Typeahead <small>bootstrap-typeahead.js</small></h1>
</div>
<div class="row">
<div class="span3 columns">
<h3>About</h3>
<p>A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.</p>
<a href="../js/bootstrap-typeahead.js" target="_blank" class="btn">Download file</a>
</div>
<div class="span9 columns">
<h2>Example</h2>
<p>Start typing in the field below to show the typeahead results.</p>
<div class="well">
<input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-data='["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"]'>
</div>
<hr>
<h2>Using bootstrap-typeahead.js</h2>
<p>Call the typeahead via javascript:</p>
<pre class="prettyprint linenums">$('.typeahead').typeahead()</pre>
<h3>Options</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>items</td>
<td>number</td>
<td>8</td>
<td>The max number of items to display in the dropdown.</td>
</tr>
</tbody>
</table>
<h3>Markup</h3>
<p>Add data attributes to register an element with typeahead functionality.</p>
<pre class="prettyprint linenums">
&lt;input type="text" data-provide="typeahead"&gt;
</pre>
</div>
</div>
</section>

406
docs/templates/pages/less.mustache vendored Normal file
View File

@ -0,0 +1,406 @@
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Using LESS with Bootstrap</h1>
<p class="lead">Customize and extend Bootstrap with <a href="http://lesscss.org" target="_blank">LESS</a>, a CSS preprocessor, to take advantage of the variables, mixins, and more used to build Bootstrap's CSS.</p>
</header>
<!-- BUILT WITH LESS
================================================== -->
<div class="page-header">
<h1>Built with LESS</h1>
</div>
<div class="row">
<div class="span4">
<h3>Why LESS?</h3>
<p>Bootstrap is made with LESS at it's core, a dynamic stylesheet language created by <a href="http://cloudhead.io">Alexis Sellier</a>. It makes developing systems-based CSS faster, easier, and more fun.</p>
</div>
<div class="span4">
<h3>What's included?</h3>
<p>As an extension of CSS, LESS includes variables, mixins for reusable snippets of code, operations for simple math, nesting, and even color functions.</p>
</div>
<div class="span4">
<h3>Learn more</h3>
<img style="float: right; height: 36px;" src="assets/img/less-logo-large.png" alt="LESS CSS">
<p>Visit the official website at <a href="http://lesscss.org">http://lesscss.org</a> to learn more.</p>
</div>
</div>
<div class="row">
<div class="span4">
<h3>Variables</h3>
<p>Managing colors and pixel values in CSS can be a bit of a pain, usually full of copy and paste. Not with LESS though&mdash;assign colors or pixel values as variables and change them once.</p>
</div>
<div class="span4">
<h3>Mixins</h3>
<p>Those three border-radius declarations you need to make in regular ol' CSS? Now they're down to one line with the help of mixins, snippets of code you can reuse anywhere.</p>
</div>
<div class="span4">
<h3>Operations</h3>
<p>Make your grid, leading, and more super flexible by doing the math on the fly with operations. Multiple, divide, add, and subtract your way to CSS sanity.</p>
</div>
</div>
<!-- VARIABLES
================================================== -->
<div class="page-header" id="variables">
<h1>Variables <small>from variables.less</small></h1>
</div>
<h3>Hyperlinks</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@linkColor</code></td>
<td>#0069d6</td>
<td>Default link text color</td>
</tr>
<tr>
<td><code>@linkColorHover</code></td>
<td><code>darken(@linkColor, 15)</code></td>
<td>Default link text hover color</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="span6">
<h3>Grayscale colors</h3>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td><code>@black</code></td>
<td>#000</td>
</tr>
<tr>
<td><code>@grayDark</code></td>
<td><code>lighten(@black, 25%)</code></td>
</tr>
<tr>
<td><code>@gray</code></td>
<td><code>lighten(@black, 50%)</code></td>
</tr>
<tr>
<td><code>@grayLight</code></td>
<td><code>lighten(@black, 75%)</code></td>
</tr>
<tr>
<td><code>@grayLighter</code></td>
<td><code>lighten(@black, 90%)</code></td>
</tr>
<tr>
<td><code>@white</code></td>
<td>#fff</td>
</tr>
</tbody>
</table>
</div>
<div class="span6">
<h3>Accent colors</h3>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td><code>@blue</code></td>
<td>#049CDB</td>
</tr>
<tr>
<td><code>@green</code></td>
<td>#46a546</td>
</tr>
<tr>
<td><code>@red</code></td>
<td>#9d261d</td>
</tr>
<tr>
<td><code>@yellow</code></td>
<td>#ffc40d</td>
</tr>
<tr>
<td><code>@orange</code></td>
<td>#f89406</td>
</tr>
<tr>
<td><code>@pink</code></td>
<td>#c3325f</td>
</tr>
<tr>
<td><code>@purple</code></td>
<td>#7a43b6</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="span6">
<h3>Grid system</h3>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td><code>@gridColumns</code></td>
<td>12</td>
</tr>
<tr>
<td><code>@gridColumnWidth</code></td>
<td>60px</td>
</tr>
<tr>
<td><code>@gridGutterWidth</code></td>
<td>20px</td>
</tr>
<tr>
<td><code>@siteWidth</code></td>
<td><code>(@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1))</code></td>
</tr>
</tbody>
</table>
</div>
<div class="span6">
<h3>Typography</h3>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td><code>@baseFontSize</code></td>
<td>13px</td>
</tr>
<tr>
<td><code>@baseFontFamily</code></td>
<td><code>"Helvetica Neue", Helvetica, Arial, sans-serif</code></td>
<td></td>
</tr>
<tr>
<td><code>@baseLineHeight</code></td>
<td>18px</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="span3">
<h3>Visuals</h3>
</div>
<div class="span9">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td><code>@primaryButtonColor</code></td>
<td><code>@blue</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- MIXINS
================================================== -->
<div class="page-header" id="mixins">
<h1>Mixins <small>from mixins.less</small></h1>
</div>
<!-- OPERATIONS
================================================== -->
<div class="page-header" id="operations">
<h1>Operations</h1>
</div>
<!-- COMPILING LESS AND BOOTSTRAP
================================================== -->
<div class="page-header" id="compiling">
<h1>Compiling LESS and Bootstrap</h1>
</div>
<!-- Using Bootstrap w/ Less
================================================== -->
<section id="less">
<div class="page-header">
<h1>Using Bootstrap with Less <small>Supercharge your CSS with variables, mixins, and functions</small></h1>
</div>
<div class="row">
<div class="span3">
<p>Bootstrap was built with <a href="http://markdotto.com/bootstrap/">Preboot</a>, an open-source pack of mixins and variables to be used in conjunction with <a href="http://lesscss.org" target="_blank">Less</a>, a CSS preprocessor for faster and easier web development.</p>
<p>Check out how we used Preboot in Bootstrap and how you can make use of it should you choose to run Less on your next project.</p>
</div>
<div class="span9">
<h2>How to use it</h2>
<p>Use this option to make full use of Bootstraps Less variables, mixins, and nesting in CSS via javascript in your browser.</p>
<pre class="prettyprint linenums">
&lt;link rel="stylesheet/less" href="less/bootstrap.less" media="all" /&gt;
&lt;script src="js/less-1.1.3.min.js"&gt;&lt;/script&gt;</pre>
<p>Not feeling the .js solution? <a href="http://incident57.com/less" target="_blank">Try the Less Mac app</a> or <a href="http://lesscss.org/#-client-side-usage" target="_blank">use Node.js</a> to compile when you deploy your code.</p>
<h2>Whats included</h2>
<p>Here are some of the highlights of whats included in Twitter Bootstrap as part of Bootstrap. Head over to the Bootstrap website or Github project page to download and learn more.</p>
<h3>Variables</h3>
<p>Variables in Less are perfect for maintaining and updating your CSS headache free. When you want to change a color value or a frequently used value, update it in one spot and youre set.</p>
<pre class="prettyprint linenums">
// Links
@linkColor: #8b59c2;
@linkColorHover: darken(@linkColor, 10);
// Grays
@black: #000;
@grayDark: lighten(@black, 25%);
@gray: lighten(@black, 50%);
@grayLight: lighten(@black, 70%);
@grayLighter: lighten(@black, 90%);
@white: #fff;
// Accent Colors
@blue: #08b5fb;
@green: #46a546;
@red: #9d261d;
@yellow: #ffc40d;
@orange: #f89406;
@pink: #c3325f;
@purple: #7a43b6;
// Baseline grid
@basefont: 13px;
@baseline: 18px;
</pre>
<h3>Commenting</h3>
<p>Less also provides another style of commenting in addition to CSSs normal <code>/* ... */</code> syntax.</p>
<pre class="prettyprint linenums">
// This is a comment
/* This is also a comment */
</pre>
<h3>Mixins up the wazoo</h3>
<p>Mixins are basically includes or partials for CSS, allowing you to combine a block of code into one. Theyre great for vendor prefixed properties like <code>box-shadow</code>, cross-browser gradients, font stacks, and more. Below is a sample of the mixins that are included with Bootstrap.</p>
<h4>Font stacks</h4>
<pre class="prettyprint linenums">
#font {
.shorthand(@weight: normal, @size: 14px, @lineHeight: 20px) {
font-size: @size;
font-weight: @weight;
line-height: @lineHeight;
}
.sans-serif(@weight: normal, @size: 14px, @lineHeight: 20px) {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: @size;
font-weight: @weight;
line-height: @lineHeight;
}
...
}
</pre>
<h4>Gradients</h4>
<pre class="prettyprint linenums">
#gradient {
...
.vertical (@startColor: #555, @endColor: #333) {
background-color: @endColor;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(@startColor), to(@endColor)); // Konqueror
background-image: -moz-linear-gradient(@startColor, @endColor); // FF 3.6+
background-image: -ms-linear-gradient(@startColor, @endColor); // IE10
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+
background-image: -webkit-linear-gradient(@startColor, @endColor); // Safari 5.1+, Chrome 10+
background-image: -o-linear-gradient(@startColor, @endColor); // Opera 11.10
background-image: linear-gradient(@startColor, @endColor); // The standard
}
...
}
</pre>
<h3>Operations</h3>
<p>Get fancy and perform some math to generate flexible and powerful mixins like the one below.</p>
<pre class="prettyprint linenums">
// Griditude
@gridColumns: 16;
@gridColumnWidth: 40px;
@gridGutterWidth: 20px;
@siteWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
// Make some columns
.columns(@columnSpan: 1) {
width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1));
}
</pre>
<h2 id="compiling">Compiling Less</h2>
<p>After modifying the <code>.less</code> files in /lib/, you'll need to recompile them in order to regenerate the bootstrap-*.*.*.css and bootstrap-*.*.*.min.css files. If you're submitting a pull request to GitHub, you must always recompile.</p>
<h3>Ways to compile</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 120px;">Method</th>
<th>Steps</th>
</tr>
</thead>
<tbody>
<tr>
<td>Node with makefile</td>
<td>
<p>Install the LESS command line compiler with npm by running the following command:</p>
<pre>$ npm install less</pre>
<p>Once installed just run <code>make</code> from the root of your bootstrap directory and you're all set.</p>
<p>Additionally, if you have <a href="https://github.com/mynyml/watchr">watchr</a> installed, you may run <code>make watch</code> to have bootstrap automatically rebuilt every time you edit a file in the bootstrap lib (this isn't required, just a convenience method).</p>
</td>
</tr>
<td>Javascript</td>
<td>
<p><a href="http://lesscss.org/">Download the latest Less.js</a> and include the path to it (and Bootstrap) in the <code>&lt;head&gt;</code>.</p>
<pre class="prettyprint">
&lt;link rel="stylesheet/less" href="/path/to/bootstrap.less"&gt;
&lt;script src="/path/to/less.js"&gt;&lt;/script&gt;
</pre>
<p>To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.</p>
</td>
</tr>
<tr>
<td>Command line</td>
<td>
<p>Install the LESS command line tool via Node and run the following command:</p>
<pre>$ lessc ./lib/bootstrap.less > bootstrap.css</pre>
<p>Be sure to include <code>--compress</code> in that command if you're trying to save some bytes!</p>
</td>
</tr>
<tr>
<td><a href="http://incident57.com/less/" target="_blank">Unofficial Mac app</a></td>
<td>
<p><a href="http://incident57.com/less/">The unofficial Mac app</a> watches directories of .less files and compiles the code to local files after every save of a watched .less file.</p>
<p>If you like, you can toggle preferences in the app for automatic minifying and which directory the compiled files end up in.</p>
</td>
</tr>
<tr>
<td><a href="http://crunchapp.net/" target="_blank">Crunch</a></td>
<td>Crunch is a great looking LESS editor and compiler built on Adobe Air.</td>
</tr>
<tr>
<td><a href="http://incident57.com/codekit/" target="_blank">CodeKit</a></td>
<td>Created by the same guy as the unofficial Mac app, CodeKit is a Mac app that compiles LESS, SASS, Stylus, and CoffeeScript.</td>
</tr>
<tr>
<td><a href="http://wearekiss.com/simpless" target="_blank">Simpless</a></td>
<td>Mac, Linux, and PC app for drag and drop compiling of LESS files. Plus, the <a href="https://github.com/Paratron/SimpLESS" target="_blank">source code is on GitHub</a>.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>

View File

@ -0,0 +1,311 @@
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Scaffolding</h1>
<p class="lead">Bootstrap is built on a responsive 12-column grid. We've also included fixed- and fluid-width layouts based on that system.</p>
</header>
<!-- Grid system
================================================== -->
<section id="grid-system">
<div class="page-header">
<h1>Grid system <small>12 columns with a responsive twist</small></h1>
</div>
<h2>Default 940px grid</h2>
<div class="row show-grid">
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
</div>
<div class="row show-grid">
<div class="span4">4</div>
<div class="span4">4</div>
<div class="span4">4</div>
</div>
<div class="row show-grid">
<div class="span4">4</div>
<div class="span8">8</div>
</div>
<div class="row show-grid">
<div class="span6">6</div>
<div class="span6">6</div>
</div>
<div class="row show-grid">
<div class="span12">12</div>
</div>
<div class="row">
<div class="span4">
<p>The default grid system provided as part of Bootstrap is a <strong>940px-wide, 12-column grid</strong>.</p>
<p>It also has three responsive variations for various devices and resolutions: phone, tablet, and large widescreen desktops.</p>
</div>
<div class="span4">
<pre class="prettyprint linenums">
&lt;div class="row"&gt;
&lt;div class="span4"&gt;...&lt;/div&gt;
&lt;div class="span8"&gt;...&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
<div class="span4">
<p>As shown here, a basic layout can be created with two "columns," each spanning a number of the 12 foundational columns we defined as part of our grid system.</p>
</div>
</div><!-- /row -->
<h2>Offsetting columns</h2>
<div class="row show-grid">
<div class="span4">4</div>
<div class="span4 offset4">4 offset 4</div>
</div><!-- /row -->
<div class="row show-grid">
<div class="span3 offset3">3 offset 3</div>
<div class="span3 offset3">3 offset 3</div>
</div><!-- /row -->
<div class="row show-grid">
<div class="span8 offset4">8 offset 4</div>
</div><!-- /row -->
<br>
<h2>Nesting columns</h2>
<div class="row">
<div class="span6">
<p>With the static (non-fluid) grid system in Bootstrap, nesting is easy. To nest your content, just add a new <code>.row</code> and set of <code>.span*</code> columns within an existing <code>.span*</code> column.</p>
<h4>Example</h4>
<div class="row show-grid">
<div class="span6">
Level 1 of column
<div class="row show-grid">
<div class="span3">
Level 2
</div>
<div class="span3">
Level 2
</div>
</div>
</div>
</div>
</div>
<div class="span6">
<pre class="prettyprint linenums">
&lt;div class="row"&gt;
&lt;div class="span12"&gt;
Level 1 of column
&lt;div class="row"&gt;
&lt;div class="span6"&gt;Level 2&lt;/div&gt;
&lt;div class="span6"&gt;Level 2&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
</div>
</div>
<h2>Grid customization</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Variable</th>
<th>Default value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@gridColumns</code></td>
<td>12</td>
<td>Number of columns</td>
</tr>
<tr>
<td><code>@gridColumnWidth</code></td>
<td>60px</td>
<td>Width of each column</td>
</tr>
<tr>
<td><code>@gridGutterWidth</code></td>
<td>20px</td>
<td>Negative space between columns</td>
</tr>
<tr>
<td><code>@siteWidth</code></td>
<td><em>Computed sum of all columns and gutters</em></td>
<td>Counts number of columns and gutters to set width of the <code>.fixed-container()</code> mixin</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="span4">
<h3>Variables in LESS</h3>
<p>Built into Bootstrap are a handful of variables for customizing the default 940px grid system, documented above. All variables for the grid are stored in variables.less.</p>
</div>
<div class="span4">
<h3>How to customize</h3>
<p>Modifying the grid means changing the three <code>@grid*</code> variables and recompiling Bootstrap. Change the grids in the preboot.less file and use one of the <a href="#compiling">four ways documented to recompile</a>.</p>
</div>
<div class="span4">
<h3>Staying responsive</h3>
<p>Customization of the grid only works at the default level, the 940px grid. To maintain the responsive aspects of Bootstrap, you'll also have to customize the grids in responsive.less.</p>
</div>
</div><!-- /row -->
</section>
<!-- Layouts (Default and fluid)
================================================== -->
<section id="layouts">
<div class="page-header">
<h1>Layouts <small>Basic templates to create webpages</small></h1>
</div>
<div class="row">
<div class="span6">
<h2>Fixed layout</h2>
<p>The default and simple 940px-wide, centered layout for just about any website or page provided by a single <code>&lt;div class="container"&gt;</code>.</p>
<div class="mini-layout">
<div class="mini-layout-body"></div>
</div>
<pre class="prettyprint linenums">
&lt;body&gt;
&lt;div class="container"&gt;
...
&lt;/div&gt;
&lt;/body&gt;
</pre>
</div><!-- /col -->
<div class="span6">
<h2>Fluid layout</h2>
<p><code>&lt;div class="fluid-container"&gt;</code> gives flexible page structure, min- and max-widths, and a left-hand sidebar. It's great for apps and docs.</p>
<div class="mini-layout fluid">
<div class="mini-layout-sidebar"></div>
<div class="mini-layout-body"></div>
</div>
<pre class="prettyprint linenums">
&lt;body&gt;
&lt;div class="fluid-container sidebar-left"&gt;
&lt;div class="fluid-sidebar"&gt;
...
&lt;/div&gt;
&lt;div class="fluid-content"&gt;
...
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
</pre>
</div><!-- /col -->
</div><!-- /row -->
</section>
<!-- Responsive design
================================================== -->
<section id="responsive">
<div class="page-header">
<h1>Responsive design <small>Media queries for various devices and resolutions</small></h1>
</div>
<!-- Supported devices -->
<div class="row">
<div class="span4">
<img src="assets/img/responsive-illustrations.png" alt="Responsive devices">
</div>
<div class="span8">
<h2>Supported devices</h2>
<p>Bootstrap supports a handful of media queries to help make your projects more appropriate on different devices and screen resolutions. Here's what's included:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Label</th>
<th>Layout width</th>
<th>Column width</th>
<th>Gutter width</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smartphones</td>
<td>480px and below</td>
<td class="muted" colspan="2">Fluid columns, no fixed widths</td>
</tr>
<tr>
<td>Portrait tablets</td>
<td>480px to 768px</td>
<td class="muted" colspan="2">Fluid columns, no fixed widths</td>
</tr>
<tr>
<td>Landscape tablets</td>
<td>768px to 940px</td>
<td>44px</td>
<td>20px</td>
</tr>
<tr>
<td>Default</td>
<td>940px and up</td>
<td>60px</td>
<td>20px</td>
</tr>
<tr>
<td>Large display</td>
<td>1210px and up</td>
<td>70px</td>
<td>30px</td>
</tr>
</tbody>
</table>
<h3>What they do</h3>
<p>Media queries allow for custom CSS based on a number of conditions&mdash;ratios, widths, display type, etc&mdash;but usually focuses around <code>min-width</code> and <code>max-width</code>.</p>
<ul>
<li>Modify the width of column in our grid</li>
<li>Stack elements instead of float wherever necessary</li>
<li>Resize headings and text to be more appropriate for devices</li>
</ul>
</div>
</div>
<br>
<!-- Media query code -->
<h2>Using the media queries</h2>
<div class="row">
<div class="span5">
<p>Bootstrap doesn't automatically include these media queries, but understanding and adding them is very easy and requires minimal setup. You have a few options for including the responsive features of Bootstrap:</p>
<ol>
<li>Use the compiled responsive version, bootstrap.reponsive.css</li>
<li>Add @import "responsive.less" and recompile Bootstrap</li>
<li>Compile responsive.less as a separate file and include that</li>
</ol>
<p><strong>Why not just include it?</strong> Truth be told, not everything needs to be responsive. Instead of encouraging developers to remove this feature, we figure it best to enable it.</p>
</div>
<div class="span7">
<pre class="prettyprint linenums">
// Landscape phones and down
@media (max-width: 480px) { ... }
// Landscape phone to portrait tablet
@media (min-width: 480px) and (max-width: 768px) { ... }
// Portrait tablet to landscape and desktop
@media (min-width: 768px) and (max-width: 940px) { ... }
// Large desktop
@media (min-width: 1210px) { .. }
</pre>
</div>
</div>
</section>

86
docs/templates/pages/upgrading.mustache vendored Normal file
View File

@ -0,0 +1,86 @@
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Upgrading to Bootstrap 2</h1>
<p class="lead">Learn about significant changes and additions since v1.4 with this handy guide.</p>
</header>
<h2>Rough outline</h2>
<ul>
<li>Docs completely overhauled
<ul>
<li>Responsive thanks to new grid system</li>
<li>Now less marketing and more information</li>
<li>Extensive use of tables to share classes and elements of most components</li>
<li>Broken down into several pages for easier consumption</li>
</ul>
</li>
<li>Updated grid system, now only 12 columns
<ul>
<li>Same great classes, but now only 12 columns</li>
<li>Responsive approach means your projects virtually work out of the box on smartphones, tablets, and more</li>
</ul>
</li>
<li>New thumbnails (previously media grids)
<ul>
<li><code>.media-grid</code> class has been changed to <code>.thumbnails</code></li>
<li>Individual thumbnails now require <code>.thumbnail</code> class</li>
</ul>
</li>
<li>Updated forms
<ul>
<li>Default form style is now stacked to use less CSS and add flexibility</li>
<li>Exact same markup is required for vertical or horizontal forms&mdash;just swap the classes</li>
<li>New form defaults for search, inline, vertical, and horizontal</li>
</ul>
</li>
<li>Updated tables
<ul>
<li>Table classes made more consistent</li>
<li>Removed unused table color options (too much code for such little impact)</li>
</ul>
</li>
<li>Typography
<ul>
<li>Right-aligned option for blockquotes if float: right;</li>
<li><code>h4</code> elements were dropped from 16px to 14px with a default <code>line-height</code> of 18px</li>
<li><code>h5</code> elements were dropped from 14px to 12px</li>
<li><code>h6</code> elements were dropped from 13px to 11px</li>
</ul>
</li>
<li>Buttons
<ul>
<li>Added button bar options</li>
</ul>
</li>
<li>Examples
<ul>
<li>Fluid examples redone. <code>.fluid-container</code> now requires a <code>.sidebar-left</code> or <code>.sidebar-right</code> as well. Fluid sidebar element has a new class, <code>.fluid-sidebar</code>.</li>
</ul>
</li>
<li>Dropdown menus
<ul>
<li>Updated the <code>.dropdown-menu</code> to tighten up spacing</li>
<li>Now requires you to add a <code>&lt;span class="caret"&gt;&lt;/span&gt;</code> to show the dropdown arrow</li>
<li>The navbar (fixed topbar) has brand new dropdowns. Gone are the dark versions and in their place are the standard white ones with an additional caret at their tops for clarity of position.</li>
</ul>
</li>
<li>Navigation
<ul>
<li>Tabs and pills now require the use of a new base class, <code>.nav</code>, on their <code>&lt;ul&gt;</code></li>
<li>New nav list component added that uses the same base class, <code>.nav</code></li>
<li>Vertical tabs and pills have been added&mdash;just add <code>.stacked</code> to the <code>&lt;ul&gt;</code></li>
<li>Pills were restyled to be less rounded by default</li>
<li>Pills now have dropdown menu support (they share the same markup and styles as tabs)</li>
</ul>
</li>
</ul>
<!--
<li>
<ul>
<li></li>
</ul>
</li>
-->
</ul>

View File

@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter: Upgrading from v1.4 to v2.0</title>
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@ -18,10 +18,11 @@
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" type="image/x-icon" href="assets/ico/favicon.ico">
<link rel="apple-touch-icon" href="assets/ico/bootstrap-apple-57x57.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/ico/bootstrap-apple-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/ico/bootstrap-apple-114x114.png">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
<body>
@ -33,8 +34,8 @@
<div class="container">
<a class="brand" href="./index.html">Bootstrap</a>
<ul class="nav">
<li><a href="./index.html">Overview</a></li>
<li class="dropdown">
<li class=""><a href="./index.html">Overview</a></li>
<li class="dropdown ">
<a href="./scaffolding.html" class="dropdown-toggle" data-toggle="dropdown">
Scaffolding
<b class="caret"></b>
@ -45,7 +46,7 @@
<li><a href="./scaffolding.html#responsive">Responsive design</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./base-css.html" class="dropdown-toggle" data-toggle="dropdown">
Base CSS
<b class="caret"></b>
@ -58,7 +59,7 @@
<li><a href="./base-css.html#icons">Icons by Glyphicons</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./components.html" class="dropdown-toggle" data-toggle="dropdown">
Components
<b class="caret"></b>
@ -75,7 +76,7 @@
<li><a href="./components.html#progress">Progress bars</a></li>
</ul>
</li>
<li class="dropdown">
<li class="dropdown ">
<a href="./javascript.html" class="dropdown-toggle" data-toggle="dropdown">
Javascript plugins
<b class="caret"></b>
@ -95,7 +96,7 @@
<li><a href="./javascript.html#typeahead">Typeahead</a></li>
</ul>
</li>
<li>
<li class="">
<a href="./less.html">
Using LESS
</a>
@ -107,12 +108,12 @@
<div class="container">
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Upgrading to Bootstrap 2</h1>
<p class="lead">Learn about significant changes and additions since v1.4 with this handy guide.</p>
</header>
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>Upgrading to Bootstrap 2</h1>
<p class="lead">Learn about significant changes and additions since v1.4 with this handy guide.</p>
</header>
<h2>Rough outline</h2>
@ -193,8 +194,6 @@
</li>
-->
</ul>
<!-- Footer
================================================== -->
<footer class="footer">
@ -203,14 +202,27 @@
<p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</footer>
</div><!-- /container -->
<!-- Le javascript -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script src="assets/js/application.js"></script>
<!-- <script src="http://code.jquery.com/jquery-1.7.min.js"></script> -->
<script src="../js/tests/vendor/jquery.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="../js/bootstrap-transition.js"></script>
<script src="../js/bootstrap-alert.js"></script>
<script src="../js/bootstrap-modal.js"></script>
<script src="../js/bootstrap-dropdown.js"></script>
<script src="../js/bootstrap-scrollspy.js"></script>
<script src="../js/bootstrap-tab.js"></script>
<script src="../js/bootstrap-tooltip.js"></script>
<script src="../js/bootstrap-popover.js"></script>
<script src="../js/bootstrap-button.js"></script>
<script src="../js/bootstrap-collapse.js"></script>
<script src="../js/bootstrap-carousel.js"></script>
<script src="../js/bootstrap-typeahead.js"></script>
<script src="assets/js/application.js"></script>
</body>
</html>