";
65 | var match;
66 | var tagpaired = [];
67 | var tagremove = [];
68 | var needsRemoval = false;
69 |
70 | // loop through matched tags in forward order
71 | for (var ctag = 0; ctag < tagcount; ctag++) {
72 | tagname = tags[ctag].replace(/<\/?(\w+).*/, "$1");
73 | // skip any already paired tags
74 | // and skip tags in our ignore list; assume they're self-closed
75 | if (tagpaired[ctag] || ignoredtags.search("<" + tagname + ">") > -1)
76 | continue;
77 |
78 | tag = tags[ctag];
79 | match = -1;
80 |
81 | if (!/^<\//.test(tag)) {
82 | // this is an opening tag
83 | // search forwards (next tags), look for closing tags
84 | for (var ntag = ctag + 1; ntag < tagcount; ntag++) {
85 | if (!tagpaired[ntag] && tags[ntag] == "" + tagname + ">") {
86 | match = ntag;
87 | break;
88 | }
89 | }
90 | }
91 |
92 | if (match == -1)
93 | needsRemoval = tagremove[ctag] = true; // mark for removal
94 | else
95 | tagpaired[match] = true; // mark paired
96 | }
97 |
98 | if (!needsRemoval)
99 | return html;
100 |
101 | // delete all orphaned tags from the string
102 |
103 | var ctag = 0;
104 | html = html.replace(re, function (match) {
105 | var res = tagremove[ctag] ? "" : match;
106 | ctag++;
107 | return res;
108 | });
109 | return html;
110 | }
111 | })();
112 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | PageDown-Bootstrap
2 | ==================
3 |
4 | This is a fork of http://code.google.com/p/pagedown/ changed to use Twitter Bootstrap for styling the editor and modal popups.
5 |
6 | The demo is viewable here: http://samwillis.co.uk/pagedown-bootstrap/demo/browser/demo.html
7 |
8 | New icons based on http://glyphicons.com/, http://dribbble.com/shots/365544-Mini-glyphs-12-px-Free-PSD and the origional icons.
9 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2012 Twitter, Inc.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/demo/browser/bootstrap/Makefile:
--------------------------------------------------------------------------------
1 | BOOTSTRAP = ./docs/assets/css/bootstrap.css
2 | BOOTSTRAP_LESS = ./less/bootstrap.less
3 | BOOTSTRAP_RESPONSIVE = ./docs/assets/css/bootstrap-responsive.css
4 | BOOTSTRAP_RESPONSIVE_LESS = ./less/responsive.less
5 | LESS_COMPRESSOR ?= `which lessc`
6 | WATCHR ?= `which watchr`
7 |
8 | #
9 | # BUILD DOCS
10 | #
11 |
12 | docs: bootstrap
13 | rm docs/assets/bootstrap.zip
14 | zip -r docs/assets/bootstrap.zip bootstrap
15 | rm -r bootstrap
16 | lessc ${BOOTSTRAP_LESS} > ${BOOTSTRAP}
17 | lessc ${BOOTSTRAP_RESPONSIVE_LESS} > ${BOOTSTRAP_RESPONSIVE}
18 | node docs/build
19 | cp img/* docs/assets/img/
20 | cp js/*.js docs/assets/js/
21 | cp js/tests/vendor/jquery.js docs/assets/js/
22 |
23 | #
24 | # BUILD SIMPLE BOOTSTRAP DIRECTORY
25 | # lessc & uglifyjs are required
26 | #
27 |
28 | bootstrap:
29 | mkdir -p bootstrap/img
30 | mkdir -p bootstrap/css
31 | mkdir -p bootstrap/js
32 | cp img/* bootstrap/img/
33 | lessc ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.css
34 | lessc --compress ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.min.css
35 | lessc ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.css
36 | lessc --compress ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.min.css
37 | cat js/bootstrap-transition.js js/bootstrap-alert.js js/bootstrap-button.js js/bootstrap-carousel.js js/bootstrap-collapse.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-tooltip.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tab.js js/bootstrap-typeahead.js > bootstrap/js/bootstrap.js
38 | uglifyjs -nc bootstrap/js/bootstrap.js > bootstrap/js/bootstrap.min.js
39 |
40 | #
41 | # MAKE FOR GH-PAGES 4 FAT & MDO ONLY (O_O )
42 | #
43 |
44 | gh-pages: docs
45 | rm -f ../bootstrap-gh-pages/assets/bootstrap.zip
46 | node docs/build production
47 | cp -r docs/* ../bootstrap-gh-pages
48 |
49 | #
50 | # WATCH LESS FILES
51 | #
52 |
53 | watch:
54 | echo "Watching less files..."; \
55 | watchr -e "watch('less/.*\.less') { system 'make' }"
56 |
57 |
58 | .PHONY: dist docs watch gh-pages
59 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/README.md:
--------------------------------------------------------------------------------
1 | TWITTER BOOTSTRAP
2 | =================
3 |
4 | Bootstrap is Twitter's toolkit for kickstarting CSS for websites, apps, and more. It includes base CSS styles for typography, forms, buttons, tables, grids, navigation, alerts, and more.
5 |
6 | To get started -- checkout http://twitter.github.com/bootstrap!
7 |
8 |
9 | Versioning
10 | ----------
11 |
12 | For transparency and insight into our release cycle, and for striving to maintain backward compatibility, Bootstrap will be maintained under the Semantic Versioning guidelines as much as possible.
13 |
14 | Releases will be numbered with the follow format:
15 |
16 | `..`
17 |
18 | And constructed with the following guidelines:
19 |
20 | * Breaking backward compatibility bumps the major
21 | * New additions without breaking backward compatibility bumps the minor
22 | * Bug fixes and misc changes bump the patch
23 |
24 | For more information on SemVer, please visit http://semver.org/.
25 |
26 |
27 | Bug tracker
28 | -----------
29 |
30 | Have a bug? Please create an issue here on GitHub!
31 |
32 | https://github.com/twitter/bootstrap/issues
33 |
34 |
35 | Twitter account
36 | ---------------
37 |
38 | Keep up to date on announcements and more by following Bootstrap on Twitter, @TwBootstrap.
39 |
40 |
41 | Mailing list
42 | ------------
43 |
44 | Have a question? Ask on our mailing list!
45 |
46 | twitter-bootstrap@googlegroups.com
47 |
48 | http://groups.google.com/group/twitter-bootstrap
49 |
50 |
51 | IRC
52 | ---
53 |
54 | Server: irc.freenode.net
55 |
56 | Channel: ##twitter-bootstrap (the double ## is not a typo)
57 |
58 |
59 | Developers
60 | ----------
61 |
62 | We have included a makefile with convenience methods for working with the Bootstrap library.
63 |
64 | + **build** - `make`
65 | Runs the LESS compiler to rebuild the `/less` files and compiles the docs pages. Requires lessc and uglify-js. Read more in our docs »
66 |
67 | + **watch** - `make watch`
68 | This is a convenience method for watching just Less files and automatically building them whenever you save. Requires the Watchr gem.
69 |
70 |
71 | Authors
72 | -------
73 |
74 | **Mark Otto**
75 |
76 | + http://twitter.com/mdo
77 | + http://github.com/markdotto
78 |
79 | **Jacob Thornton**
80 |
81 | + http://twitter.com/fat
82 | + http://github.com/fat
83 |
84 |
85 | Copyright and license
86 | ---------------------
87 |
88 | Copyright 2012 Twitter, Inc.
89 |
90 | Licensed under the Apache License, Version 2.0 (the "License");
91 | you may not use this work except in compliance with the License.
92 | You may obtain a copy of the License in the LICENSE file, or at:
93 |
94 | http://www.apache.org/licenses/LICENSE-2.0
95 |
96 | Unless required by applicable law or agreed to in writing, software
97 | distributed under the License is distributed on an "AS IS" BASIS,
98 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99 | See the License for the specific language governing permissions and
100 | limitations under the License.
101 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/bootstrap.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/bootstrap.zip
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/ico/bootstrap-apple-114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/ico/bootstrap-apple-114x114.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/ico/bootstrap-apple-57x57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/ico/bootstrap-apple-57x57.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/ico/bootstrap-apple-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/ico/bootstrap-apple-72x72.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/ico/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/ico/favicon.ico
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/bird.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/bird.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-01.jpg
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-02.jpg
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-03.jpg
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/browsers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/browsers.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-diagram-01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-diagram-01.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-diagram-02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-diagram-02.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-diagram-03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-diagram-03.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-sites/bartop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-sites/bartop.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-sites/fleetio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-sites/fleetio.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-sites/jshint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-sites/jshint.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-sites/kippt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-sites/kippt.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-sites/railwayjs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-sites/railwayjs.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/example-sites/totalwireframe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/example-sites/totalwireframe.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/examples/bootstrap-example-fluid.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/examples/bootstrap-example-fluid.jpg
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/examples/bootstrap-example-hero.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/examples/bootstrap-example-hero.jpg
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/examples/bootstrap-example-starter.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/examples/bootstrap-example-starter.jpg
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/github-16px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/github-16px.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_009_magic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_009_magic.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_042_group.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_042_group.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_079_podium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_079_podium.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_082_roundabout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_082_roundabout.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_155_show_thumbnails.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_155_show_thumbnails.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_163_iphone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_163_iphone.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_214_resize_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_214_resize_small.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_266_book_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/glyphicons/glyphicons_266_book_open.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/grid-18px-masked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/grid-18px-masked.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/icon-css3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/icon-css3.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/icon-github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/icon-github.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/icon-html5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/icon-html5.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/icon-twitter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/icon-twitter.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/less-logo-large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/less-logo-large.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/less-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/less-small.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/img/responsive-illustrations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/assets/img/responsive-illustrations.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/README.md:
--------------------------------------------------------------------------------
1 | ## 2.0 BOOTSTRAP JS PHILOSOPHY
2 | These are the high-level design rules which guide the development of Bootstrap's plugin apis.
3 |
4 | ---
5 |
6 | ### DATA-ATTRIBUTE API
7 |
8 | We believe you should be able to use all plugins provided by Bootstrap purely through the markup API without writing a single line of javascript.
9 |
10 | We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this:
11 |
12 | $('body').off('.data-api')
13 |
14 | To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:
15 |
16 | $('body').off('.alert.data-api')
17 |
18 | ---
19 |
20 | ### PROGRAMATIC API
21 |
22 | We also believe you should be able to use all plugins provided by Bootstrap purely through the JS API.
23 |
24 | All public APIs should be single, chainable methods, and return the collection acted upon.
25 |
26 | $(".btn.danger").button("toggle").addClass("fat")
27 |
28 | All methods should accept an optional options object, a string which targets a particular method, or null which initiates the default behavior:
29 |
30 | $("#myModal").modal() // initialized with defaults
31 | $("#myModal").modal({ keyboard: false }) // initialized with now keyboard
32 | $("#myModal").modal('show') // initializes and invokes show immediately afterqwe2
33 |
34 | ---
35 |
36 | ### OPTIONS
37 |
38 | Options should be sparse and add universal value. We should pick the right defaults.
39 |
40 | All plugins should have a default object which can be modified to effect all instance's default options. The defaults object should be available via `$.fn.plugin.defaults`.
41 |
42 | $.fn.modal.defaults = { … }
43 |
44 | An options definition should take the following form:
45 |
46 | *noun*: *adjective* - describes or modifies a quality of an instance
47 |
48 | examples:
49 |
50 | backdrop: true
51 | keyboard: false
52 | placement: 'top'
53 |
54 | ---
55 |
56 | ### EVENTS
57 |
58 | All events should have an infinitive and past participle form. The infinitive is fired just before an action takes place, the past participle on completion of the action.
59 |
60 | show | shown
61 | hide | hidden
62 |
63 | ---
64 |
65 | ### CONSTRUCTORS
66 |
67 | Each plugin should expose it's raw constructor on a `Constructor` property -- accessed in the following way:
68 |
69 |
70 | $.fn.popover.Constructor
71 |
72 | ---
73 |
74 | ### DATA ACCESSOR
75 |
76 | Each plugin stores a copy of the invoked class on an object. This class instance can be accessed directly through jQuery's data API like this:
77 |
78 | $('[rel=popover]').data('popover') instanceof $.fn.popover.Constructor
79 |
80 | ---
81 |
82 | ### DATA ATTRIBUTES
83 |
84 | Data attributes should take the following form:
85 |
86 | - data-{{verb}}={{plugin}} - defines main interaction
87 | - data-target || href^=# - defined on "control" element (if element controls an element other than self)
88 | - data-{{noun}} - defines class instance options
89 |
90 | examples:
91 |
92 | // control other targets
93 | data-toggle="modal" data-target="#foo"
94 | data-toggle="collapse" data-target="#foo" data-parent="#bar"
95 |
96 | // defined on element they control
97 | data-spy="scroll"
98 |
99 | data-dismiss="modal"
100 | data-dismiss="alert"
101 |
102 | data-toggle="dropdown"
103 |
104 | data-toggle="button"
105 | data-toggle="buttons-checkbox"
106 | data-toggle="buttons-radio"
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/bootstrap-alert.js:
--------------------------------------------------------------------------------
1 | /* ==========================================================
2 | * bootstrap-alert.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#alerts
4 | * ==========================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ========================================================== */
19 |
20 |
21 | !function( $ ){
22 |
23 | "use strict"
24 |
25 | /* ALERT CLASS DEFINITION
26 | * ====================== */
27 |
28 | var dismiss = '[data-dismiss="alert"]'
29 | , Alert = function ( el ) {
30 | $(el).on('click', dismiss, this.close)
31 | }
32 |
33 | Alert.prototype = {
34 |
35 | constructor: Alert
36 |
37 | , close: function ( e ) {
38 | var $this = $(this)
39 | , selector = $this.attr('data-target')
40 | , $parent
41 |
42 | if (!selector) {
43 | selector = $this.attr('href')
44 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
45 | }
46 |
47 | $parent = $(selector)
48 | $parent.trigger('close')
49 |
50 | e && e.preventDefault()
51 |
52 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
53 |
54 | $parent
55 | .trigger('close')
56 | .removeClass('in')
57 |
58 | function removeElement() {
59 | $parent
60 | .trigger('closed')
61 | .remove()
62 | }
63 |
64 | $.support.transition && $parent.hasClass('fade') ?
65 | $parent.on($.support.transition.end, removeElement) :
66 | removeElement()
67 | }
68 |
69 | }
70 |
71 |
72 | /* ALERT PLUGIN DEFINITION
73 | * ======================= */
74 |
75 | $.fn.alert = function ( option ) {
76 | return this.each(function () {
77 | var $this = $(this)
78 | , data = $this.data('alert')
79 | if (!data) $this.data('alert', (data = new Alert(this)))
80 | if (typeof option == 'string') data[option].call($this)
81 | })
82 | }
83 |
84 | $.fn.alert.Constructor = Alert
85 |
86 |
87 | /* ALERT DATA-API
88 | * ============== */
89 |
90 | $(function () {
91 | $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
92 | })
93 |
94 | }( window.jQuery );
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/bootstrap-button.js:
--------------------------------------------------------------------------------
1 | /* ============================================================
2 | * bootstrap-button.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#buttons
4 | * ============================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ============================================================ */
19 |
20 | !function( $ ){
21 |
22 | "use strict"
23 |
24 | /* BUTTON PUBLIC CLASS DEFINITION
25 | * ============================== */
26 |
27 | var Button = function ( element, options ) {
28 | this.$element = $(element)
29 | this.options = $.extend({}, $.fn.button.defaults, options)
30 | }
31 |
32 | Button.prototype = {
33 |
34 | constructor: Button
35 |
36 | , setState: function ( state ) {
37 | var d = 'disabled'
38 | , $el = this.$element
39 | , data = $el.data()
40 | , val = $el.is('input') ? 'val' : 'html'
41 |
42 | state = state + 'Text'
43 | data.resetText || $el.data('resetText', $el[val]())
44 |
45 | $el[val](data[state] || this.options[state])
46 |
47 | // push to event loop to allow forms to submit
48 | setTimeout(function () {
49 | state == 'loadingText' ?
50 | $el.addClass(d).attr(d, d) :
51 | $el.removeClass(d).removeAttr(d)
52 | }, 0)
53 | }
54 |
55 | , toggle: function () {
56 | var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
57 |
58 | $parent && $parent
59 | .find('.active')
60 | .removeClass('active')
61 |
62 | this.$element.toggleClass('active')
63 | }
64 |
65 | }
66 |
67 |
68 | /* BUTTON PLUGIN DEFINITION
69 | * ======================== */
70 |
71 | $.fn.button = function ( option ) {
72 | return this.each(function () {
73 | var $this = $(this)
74 | , data = $this.data('button')
75 | , options = typeof option == 'object' && option
76 | if (!data) $this.data('button', (data = new Button(this, options)))
77 | if (option == 'toggle') data.toggle()
78 | else if (option) data.setState(option)
79 | })
80 | }
81 |
82 | $.fn.button.defaults = {
83 | loadingText: 'loading...'
84 | }
85 |
86 | $.fn.button.Constructor = Button
87 |
88 |
89 | /* BUTTON DATA-API
90 | * =============== */
91 |
92 | $(function () {
93 | $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
94 | var $btn = $(e.target)
95 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
96 | $btn.button('toggle')
97 | })
98 | })
99 |
100 | }( window.jQuery );
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/bootstrap-dropdown.js:
--------------------------------------------------------------------------------
1 | /* ============================================================
2 | * bootstrap-dropdown.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns
4 | * ============================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ============================================================ */
19 |
20 |
21 | !function( $ ){
22 |
23 | "use strict"
24 |
25 | /* DROPDOWN CLASS DEFINITION
26 | * ========================= */
27 |
28 | var toggle = '[data-toggle="dropdown"]'
29 | , Dropdown = function ( element ) {
30 | var $el = $(element).on('click.dropdown.data-api', this.toggle)
31 | $('html').on('click.dropdown.data-api', function () {
32 | $el.parent().removeClass('open')
33 | })
34 | }
35 |
36 | Dropdown.prototype = {
37 |
38 | constructor: Dropdown
39 |
40 | , toggle: function ( e ) {
41 | var $this = $(this)
42 | , selector = $this.attr('data-target')
43 | , $parent
44 | , isActive
45 |
46 | if (!selector) {
47 | selector = $this.attr('href')
48 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
49 | }
50 |
51 | $parent = $(selector)
52 | $parent.length || ($parent = $this.parent())
53 |
54 | isActive = $parent.hasClass('open')
55 |
56 | clearMenus()
57 | !isActive && $parent.toggleClass('open')
58 |
59 | return false
60 | }
61 |
62 | }
63 |
64 | function clearMenus() {
65 | $(toggle).parent().removeClass('open')
66 | }
67 |
68 |
69 | /* DROPDOWN PLUGIN DEFINITION
70 | * ========================== */
71 |
72 | $.fn.dropdown = function ( option ) {
73 | return this.each(function () {
74 | var $this = $(this)
75 | , data = $this.data('dropdown')
76 | if (!data) $this.data('dropdown', (data = new Dropdown(this)))
77 | if (typeof option == 'string') data[option].call($this)
78 | })
79 | }
80 |
81 | $.fn.dropdown.Constructor = Dropdown
82 |
83 |
84 | /* APPLY TO STANDARD DROPDOWN ELEMENTS
85 | * =================================== */
86 |
87 | $(function () {
88 | $('html').on('click.dropdown.data-api', clearMenus)
89 | $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
90 | })
91 |
92 | }( window.jQuery );
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/bootstrap-popover.js:
--------------------------------------------------------------------------------
1 | /* ===========================================================
2 | * bootstrap-popover.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#popovers
4 | * ===========================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * =========================================================== */
19 |
20 |
21 | !function( $ ) {
22 |
23 | "use strict"
24 |
25 | var Popover = function ( element, options ) {
26 | this.init('popover', element, options)
27 | }
28 |
29 | /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
30 | ========================================== */
31 |
32 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
33 |
34 | constructor: Popover
35 |
36 | , setContent: function () {
37 | var $tip = this.tip()
38 | , title = this.getTitle()
39 | , content = this.getContent()
40 |
41 | $tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
42 | $tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
43 |
44 | $tip.removeClass('fade top bottom left right in')
45 | }
46 |
47 | , hasContent: function () {
48 | return this.getTitle() || this.getContent()
49 | }
50 |
51 | , getContent: function () {
52 | var content
53 | , $e = this.$element
54 | , o = this.options
55 |
56 | content = $e.attr('data-content')
57 | || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
58 |
59 | content = content.toString().replace(/(^\s*|\s*$)/, "")
60 |
61 | return content
62 | }
63 |
64 | , tip: function() {
65 | if (!this.$tip) {
66 | this.$tip = $(this.options.template)
67 | }
68 | return this.$tip
69 | }
70 |
71 | })
72 |
73 |
74 | /* POPOVER PLUGIN DEFINITION
75 | * ======================= */
76 |
77 | $.fn.popover = function ( option ) {
78 | return this.each(function () {
79 | var $this = $(this)
80 | , data = $this.data('popover')
81 | , options = typeof option == 'object' && option
82 | if (!data) $this.data('popover', (data = new Popover(this, options)))
83 | if (typeof option == 'string') data[option]()
84 | })
85 | }
86 |
87 | $.fn.popover.Constructor = Popover
88 |
89 | $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
90 | placement: 'right'
91 | , content: ''
92 | , template: '
'
93 | })
94 |
95 | }( window.jQuery );
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/bootstrap-scrollspy.js:
--------------------------------------------------------------------------------
1 | /* =============================================================
2 | * bootstrap-scrollspy.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#scrollspy
4 | * =============================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ============================================================== */
19 |
20 | !function ( $ ) {
21 |
22 | "use strict"
23 |
24 | /* SCROLLSPY CLASS DEFINITION
25 | * ========================== */
26 |
27 | function ScrollSpy( element, options) {
28 | var process = $.proxy(this.process, this)
29 | , $element = $(element).is('body') ? $(window) : $(element)
30 | , href
31 | this.options = $.extend({}, $.fn.scrollspy.defaults, options)
32 | this.$scrollElement = $element.on('scroll.scroll.data-api', process)
33 | this.selector = (this.options.target
34 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
35 | || '') + ' .nav li > a'
36 | this.$body = $('body').on('click.scroll.data-api', this.selector, process)
37 | this.refresh()
38 | this.process()
39 | }
40 |
41 | ScrollSpy.prototype = {
42 |
43 | constructor: ScrollSpy
44 |
45 | , refresh: function () {
46 | this.targets = this.$body
47 | .find(this.selector)
48 | .map(function () {
49 | var href = $(this).attr('href')
50 | return /^#\w/.test(href) && $(href).length ? href : null
51 | })
52 |
53 | this.offsets = $.map(this.targets, function (id) {
54 | return $(id).position().top
55 | })
56 | }
57 |
58 | , process: function () {
59 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
60 | , offsets = this.offsets
61 | , targets = this.targets
62 | , activeTarget = this.activeTarget
63 | , i
64 |
65 | for (i = offsets.length; i--;) {
66 | activeTarget != targets[i]
67 | && scrollTop >= offsets[i]
68 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
69 | && this.activate( targets[i] )
70 | }
71 | }
72 |
73 | , activate: function (target) {
74 | var active
75 |
76 | this.activeTarget = target
77 |
78 | this.$body
79 | .find(this.selector).parent('.active')
80 | .removeClass('active')
81 |
82 | active = this.$body
83 | .find(this.selector + '[href="' + target + '"]')
84 | .parent('li')
85 | .addClass('active')
86 |
87 | if ( active.parent('.dropdown-menu') ) {
88 | active.closest('li.dropdown').addClass('active')
89 | }
90 | }
91 |
92 | }
93 |
94 |
95 | /* SCROLLSPY PLUGIN DEFINITION
96 | * =========================== */
97 |
98 | $.fn.scrollspy = function ( option ) {
99 | return this.each(function () {
100 | var $this = $(this)
101 | , data = $this.data('scrollspy')
102 | , options = typeof option == 'object' && option
103 | if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
104 | if (typeof option == 'string') data[option]()
105 | })
106 | }
107 |
108 | $.fn.scrollspy.Constructor = ScrollSpy
109 |
110 | $.fn.scrollspy.defaults = {
111 | offset: 10
112 | }
113 |
114 |
115 | /* SCROLLSPY DATA-API
116 | * ================== */
117 |
118 | $(function () {
119 | $('[data-spy="scroll"]').each(function () {
120 | var $spy = $(this)
121 | $spy.scrollspy($spy.data())
122 | })
123 | })
124 |
125 | }( window.jQuery );
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/bootstrap-tab.js:
--------------------------------------------------------------------------------
1 | /* ========================================================
2 | * bootstrap-tab.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#tabs
4 | * ========================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ======================================================== */
19 |
20 |
21 | !function( $ ){
22 |
23 | "use strict"
24 |
25 | /* TAB CLASS DEFINITION
26 | * ==================== */
27 |
28 | var Tab = function ( element ) {
29 | this.element = $(element)
30 | }
31 |
32 | Tab.prototype = {
33 |
34 | constructor: Tab
35 |
36 | , show: function () {
37 | var $this = this.element
38 | , $ul = $this.closest('ul:not(.dropdown-menu)')
39 | , selector = $this.attr('data-target')
40 | , previous
41 | , $target
42 |
43 | if (!selector) {
44 | selector = $this.attr('href')
45 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
46 | }
47 |
48 | if ( $this.parent('li').hasClass('active') ) return
49 |
50 | previous = $ul.find('.active a').last()[0]
51 |
52 | $this.trigger({
53 | type: 'show'
54 | , relatedTarget: previous
55 | })
56 |
57 | $target = $(selector)
58 |
59 | this.activate($this.parent('li'), $ul)
60 | this.activate($target, $target.parent(), function () {
61 | $this.trigger({
62 | type: 'shown'
63 | , relatedTarget: previous
64 | })
65 | })
66 | }
67 |
68 | , activate: function ( element, container, callback) {
69 | var $active = container.find('> .active')
70 | , transition = callback
71 | && $.support.transition
72 | && $active.hasClass('fade')
73 |
74 | function next() {
75 | $active
76 | .removeClass('active')
77 | .find('> .dropdown-menu > .active')
78 | .removeClass('active')
79 |
80 | element.addClass('active')
81 |
82 | if (transition) {
83 | element[0].offsetWidth // reflow for transition
84 | element.addClass('in')
85 | } else {
86 | element.removeClass('fade')
87 | }
88 |
89 | if ( element.parent('.dropdown-menu') ) {
90 | element.closest('li.dropdown').addClass('active')
91 | }
92 |
93 | callback && callback()
94 | }
95 |
96 | transition ?
97 | $active.one($.support.transition.end, next) :
98 | next()
99 |
100 | $active.removeClass('in')
101 | }
102 | }
103 |
104 |
105 | /* TAB PLUGIN DEFINITION
106 | * ===================== */
107 |
108 | $.fn.tab = function ( option ) {
109 | return this.each(function () {
110 | var $this = $(this)
111 | , data = $this.data('tab')
112 | if (!data) $this.data('tab', (data = new Tab(this)))
113 | if (typeof option == 'string') data[option]()
114 | })
115 | }
116 |
117 | $.fn.tab.Constructor = Tab
118 |
119 |
120 | /* TAB DATA-API
121 | * ============ */
122 |
123 | $(function () {
124 | $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
125 | e.preventDefault()
126 | $(this).tab('show')
127 | })
128 | })
129 |
130 | }( window.jQuery );
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/bootstrap-transition.js:
--------------------------------------------------------------------------------
1 | /* ===================================================
2 | * bootstrap-transition.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#transitions
4 | * ===================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ========================================================== */
19 |
20 | !function( $ ) {
21 |
22 | $(function () {
23 |
24 | "use strict"
25 |
26 | /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
27 | * ======================================================= */
28 |
29 | $.support.transition = (function () {
30 | var thisBody = document.body || document.documentElement
31 | , thisStyle = thisBody.style
32 | , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
33 |
34 | return support && {
35 | end: (function () {
36 | var transitionEnd = "TransitionEnd"
37 | if ( $.browser.webkit ) {
38 | transitionEnd = "webkitTransitionEnd"
39 | } else if ( $.browser.mozilla ) {
40 | transitionEnd = "transitionend"
41 | } else if ( $.browser.opera ) {
42 | transitionEnd = "oTransitionEnd"
43 | }
44 | return transitionEnd
45 | }())
46 | }
47 | })()
48 |
49 | })
50 |
51 | }( window.jQuery );
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/assets/js/google-code-prettify/prettify.css:
--------------------------------------------------------------------------------
1 | .com { color: #93a1a1; }
2 | .lit { color: #195f91; }
3 | .pun, .opn, .clo { color: #93a1a1; }
4 | .fun { color: #dc322f; }
5 | .str, .atv { color: #D14; }
6 | .kwd, .linenums .tag { color: #1e347b; }
7 | .typ, .atn, .dec, .var { color: teal; }
8 | .pln { color: #48484c; }
9 |
10 | .prettyprint {
11 | padding: 8px;
12 | background-color: #f7f7f9;
13 | border: 1px solid #e1e1e8;
14 | }
15 | .prettyprint.linenums {
16 | -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
17 | -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
18 | box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
19 | }
20 |
21 | /* Specify class=linenums on a pre to get line numbering */
22 | ol.linenums {
23 | margin: 0 0 0 33px; /* IE indents via margin-left */
24 | }
25 | ol.linenums li {
26 | padding-left: 12px;
27 | color: #bebec5;
28 | line-height: 18px;
29 | text-shadow: 0 1px 0 #fff;
30 | }
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/index.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | var hogan = require('hogan.js')
3 | , fs = require('fs')
4 | , prod = process.argv[2] == 'production'
5 |
6 | var layout, pages
7 |
8 | // compile layout template
9 | layout = fs.readFileSync(__dirname + '/../templates/layout.mustache', 'utf-8')
10 | layout = hogan.compile(layout, { sectionTags: [{o:'_i', c:'i'}] })
11 |
12 | // retrieve pages
13 | pages = fs.readdirSync(__dirname + '/../templates/pages')
14 |
15 | // iterate over pages
16 | pages.forEach(function (name) {
17 |
18 | if (!name.match(/\.mustache$/)) return
19 |
20 | var page = fs.readFileSync(__dirname + '/../templates/pages/' + name, 'utf-8')
21 | , context = {}
22 |
23 | context[name.replace(/\.mustache$/, '')] = 'active'
24 | context._i = true
25 | context.production = prod
26 |
27 | page = hogan.compile(page, { sectionTags: [{o:'_i', c:'i'}] })
28 | page = layout.render(context, {
29 | body: page
30 | })
31 |
32 | fs.writeFileSync(__dirname + '/../' + name.replace(/mustache$/, 'html'), page, 'utf-8')
33 | })
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/.bin/hulk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | * Copyright 2011 Twitter, Inc.
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | var hogan = require('../lib/hogan.js'),
19 | path = require('path'),
20 | fs = require('fs');
21 |
22 | var specials = ['/', '.', '*', '+', '?', '|','(', ')', '[', ']', '{', '}', '\\'],
23 | specialsRegExp = new RegExp('(\\' + specials.join('|\\') + ')', 'g'),
24 | templates;
25 |
26 |
27 | // Escape special regexp characters
28 | function esc(text) {
29 | return text.replace(specialsRegExp, '\\$1');
30 | }
31 |
32 |
33 | // Check for dirs and correct ext (<3 for windows)
34 | function extractFiles(args) {
35 | var usage = 'USAGE: hulk ./templates/*.mustaches\n' +
36 | 'NOTE: hulk supports the "*" wildcard and allows you to target specific extensions too',
37 | files = [];
38 |
39 | if (!args.length) {
40 | console.log(usage);
41 | process.exit(-1);
42 | }
43 |
44 | args.forEach(function (arg) {
45 |
46 | if (/\*/.test(arg)) {
47 | arg = arg.split('*');
48 | return files = files.concat(
49 | fs.readdirSync(arg[0] || '.')
50 | .map(function (f) {
51 | return new RegExp(esc(arg[1]) + '$').test(f) && path.join(arg[0], f);
52 | })
53 | .filter(function (f) {
54 | return f;
55 | })
56 | );
57 | }
58 |
59 | files.push(arg);
60 |
61 | })
62 |
63 | return files;
64 | }
65 |
66 |
67 | // Remove utf-8 byte order mark, http://en.wikipedia.org/wiki/Byte_order_mark
68 | function removeByteOrderMark(text) {
69 | if (text.charCodeAt(0) === 0xfeff) {
70 | return text.substring(1);
71 | }
72 | return text;
73 | }
74 |
75 |
76 | // Write a template foreach file that matches template extension
77 | templates = extractFiles(process.argv.slice(2))
78 | .map(function (file) {
79 | var openedFile = fs.readFileSync(file, 'utf-8'), name;
80 | if (!openedFile) return;
81 | name = file.replace(/\..*$/, '');
82 | openedFile = removeByteOrderMark(openedFile.trim());
83 | return 'templates.' + name + ' = new Hogan.Template(' + hogan.compile(openedFile, { asString: 1 }) + ');';
84 | })
85 | .filter(function (t) {
86 | return t;
87 | });
88 |
89 |
90 | // Output templates
91 | if (!templates.length) return;
92 | console.log('var templates = {};');
93 | console.log(templates.join('\n'));
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/.git_ignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "test/spec"]
2 | path = test/spec
3 | url = https://github.com/mustache/spec.git
4 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/Makefile:
--------------------------------------------------------------------------------
1 | REPO = git@github.com:twitter/hogan.js.git
2 | BUILD := build
3 | VERSION = ${shell node -e 'var s = JSON.parse(require("fs").readFileSync("package.json").toString()).version; console.log(s.substring(0, s.indexOf("-")));'}
4 |
5 | #
6 | # Run command line tests
7 | #
8 | test:
9 | @ node test/index.js
10 |
11 | #
12 | # Run Mustache spec tests
13 | #
14 | spec:
15 | @ node test/spec.js
16 |
17 | #
18 | # Run benchmark
19 | #
20 | benchmark:
21 | @ node benchmark/console/index.js
22 |
23 | clean:
24 | @ rm -rf dist/*
25 | #
26 | # Make a new version of Hogan from the current dev version.
27 | #
28 | release: clean
29 | @ echo "Creating a new version of Hogan."
30 | @ mkdir -p dist/nodejs
31 | @ cp -R lib dist/nodejs/lib
32 | @ node tools/release.js
33 | @ mkdir -p web/builds/$(VERSION)
34 | @ cp dist/*.* web/builds/$(VERSION)/.
35 | #
36 | # Make the gh-pages website
37 | #
38 | # This target builds the hogan.js github website using hogan.js.
39 | #
40 | # cd into build/gh-pages to check in the new site.
41 | #
42 | GH_PAGES = $(BUILD)/gh-pages
43 | web: | pages
44 | @cp -R web/* $(GH_PAGES)
45 | @@ node tools/web_templates.js
46 | @echo
47 | @echo "Website built in $(GH_PAGES)."
48 |
49 | #
50 | # Checkout the gh-pages branch.
51 | #
52 | pages: | $(BUILD)
53 | @if [ ! -d "$(GH_PAGES)" ]; then \
54 | git clone -b gh-pages $(REPO) $(GH_PAGES); \
55 | rm -rf $(GH_PAGES)/*; \
56 | fi;
57 | @mkdir -p $(GH_PAGES)/images
58 |
59 | $(BUILD):
60 | mkdir -p $(BUILD)
61 |
62 | .PHONY: test spec benchmark web release
63 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/README.md:
--------------------------------------------------------------------------------
1 | ## Hogan.js - A mustache compiler.
2 |
3 | [Hogan.js](http://twitter.github.com/hogan.js/) is a compiler for the
4 | [Mustache](http://mustache.github.com/) templating language. For information
5 | on Mustache, see the [manpage](http://mustache.github.com/mustache.5.html) and
6 | the [spec](https://github.com/mustache/spec).
7 |
8 | ## Basics
9 |
10 | Hogan compiles templates to HoganTemplate objects, which have a render method.
11 |
12 | ```js
13 | var data = {
14 | screenName: "dhg",
15 | };
16 |
17 | var template = Hogan.compile("Follow @{{screenName}}.");
18 | var output = template.render(data);
19 |
20 | // prints "Follow @dhg."
21 | console.log(output);
22 | ```
23 |
24 | ## Features
25 |
26 | Hogan is fast--try it on your workload.
27 |
28 | Hogan has separate scanning, parsing and code generation phases. This way it's
29 | possible to add new features without touching the scanner at all, and many
30 | different code generation techniques can be tried without changing the parser.
31 |
32 | Hogan exposes scan and parse methods. These can be useful for
33 | pre-processing templates on the server.
34 |
35 | ```js
36 | var text = "{{^check}}{{i18n}}No{{/i18n}}{{/check}}";
37 | text += "{{#check}}{{i18n}}Yes{{/i18n}}{{/check}}";
38 | var tree = Hogan.parse(Hogan.scan(text));
39 |
40 | // outputs "# check"
41 | console.log(tree[0].tag + " " + tree[0].name);
42 |
43 | // outputs "Yes"
44 | console.log(tree[1].nodes[0].nodes[0]);
45 | ```
46 |
47 | It's also possible to use HoganTemplate objects without the Hogan compiler
48 | present. That means you can pre-compile your templates on the server, and
49 | avoid shipping the compiler. However, the optional lambda features from the
50 | Mustache spec do require the compiler to be present.
51 |
52 | ## Why Hogan.js?
53 |
54 | Why another templating library?
55 |
56 | Hogan.js was written to meet three templating library requirements: good
57 | performance, standalone template objects, and a parser API.
58 |
59 | ## Issues
60 |
61 | Have a bug? Please create an issue here on GitHub!
62 |
63 | https://github.com/twitter/hogan.js/issues
64 |
65 | ## Versioning
66 |
67 | For transparency and insight into our release cycle, releases will be numbered with the follow format:
68 |
69 | `..`
70 |
71 | And constructed with the following guidelines:
72 |
73 | * Breaking backwards compatibility bumps the major
74 | * New additions without breaking backwards compatibility bumps the minor
75 | * Bug fixes and misc changes bump the patch
76 |
77 | For more information on semantic versioning, please visit http://semver.org/.
78 |
79 | ## Authors
80 |
81 | **Robert Sayre**
82 |
83 | + http://github.com/sayrer
84 |
85 | **Jacob Thornton**
86 |
87 | + http://github.com/fat
88 |
89 | ## License
90 |
91 | Copyright 2011 Twitter, Inc.
92 |
93 | Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/bin/hulk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | * Copyright 2011 Twitter, Inc.
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | var hogan = require('../lib/hogan.js'),
19 | path = require('path'),
20 | fs = require('fs');
21 |
22 | var specials = ['/', '.', '*', '+', '?', '|','(', ')', '[', ']', '{', '}', '\\'],
23 | specialsRegExp = new RegExp('(\\' + specials.join('|\\') + ')', 'g'),
24 | templates;
25 |
26 |
27 | // Escape special regexp characters
28 | function esc(text) {
29 | return text.replace(specialsRegExp, '\\$1');
30 | }
31 |
32 |
33 | // Check for dirs and correct ext (<3 for windows)
34 | function extractFiles(args) {
35 | var usage = 'USAGE: hulk ./templates/*.mustaches\n' +
36 | 'NOTE: hulk supports the "*" wildcard and allows you to target specific extensions too',
37 | files = [];
38 |
39 | if (!args.length) {
40 | console.log(usage);
41 | process.exit(-1);
42 | }
43 |
44 | args.forEach(function (arg) {
45 |
46 | if (/\*/.test(arg)) {
47 | arg = arg.split('*');
48 | return files = files.concat(
49 | fs.readdirSync(arg[0] || '.')
50 | .map(function (f) {
51 | return new RegExp(esc(arg[1]) + '$').test(f) && path.join(arg[0], f);
52 | })
53 | .filter(function (f) {
54 | return f;
55 | })
56 | );
57 | }
58 |
59 | files.push(arg);
60 |
61 | })
62 |
63 | return files;
64 | }
65 |
66 |
67 | // Remove utf-8 byte order mark, http://en.wikipedia.org/wiki/Byte_order_mark
68 | function removeByteOrderMark(text) {
69 | if (text.charCodeAt(0) === 0xfeff) {
70 | return text.substring(1);
71 | }
72 | return text;
73 | }
74 |
75 |
76 | // Write a template foreach file that matches template extension
77 | templates = extractFiles(process.argv.slice(2))
78 | .map(function (file) {
79 | var openedFile = fs.readFileSync(file, 'utf-8'), name;
80 | if (!openedFile) return;
81 | name = file.replace(/\..*$/, '');
82 | openedFile = removeByteOrderMark(openedFile.trim());
83 | return 'templates.' + name + ' = new Hogan.Template(' + hogan.compile(openedFile, { asString: 1 }) + ');';
84 | })
85 | .filter(function (t) {
86 | return t;
87 | });
88 |
89 |
90 | // Output templates
91 | if (!templates.length) return;
92 | console.log('var templates = {};');
93 | console.log(templates.join('\n'));
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/lib/hogan.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | // This file is for use with Node.js. See dist/ for browser files.
17 |
18 | var Hogan = require('./compiler');
19 | Hogan.Template = require('./template').Template;
20 | module.exports = Hogan;
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hogan.js"
3 | , "description": "A mustache compiler."
4 | , "version": "1.0.5-dev"
5 | , "keywords": ["mustache", "template"]
6 | , "main": "./lib/hogan.js"
7 | , "homepage": "http://twitter.github.com/hogan.js/"
8 | , "author": "Twitter Inc."
9 | , "repository": {
10 | "type": "git"
11 | , "url": "https://github.com/twitter/hogan.js.git"
12 | }
13 | , "licenses": [
14 | { "type": "Apache-2.0"
15 | , "url": "http://www.apache.org/licenses/LICENSE-2.0"
16 | }
17 | ]
18 | , "devDependencies": { "uglify-js": "*" }
19 | , "bin" : { "hulk" : "./bin/hulk" }
20 | }
21 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/html/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | test
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/mustache.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | var doc = this['document'];
17 | var fs = require('fs');
18 |
19 | var passed = 0;
20 | var failed = 0;
21 |
22 | if (!this['output']) {
23 | var output = function (string) {
24 | return doc ? doc.write(string + ' ') : console.log(string);
25 | };
26 | }
27 |
28 | var Hogan = require(__dirname + '/../lib/hogan');
29 | var template = fs.readFileSync(__dirname + '/../lib/template.js').toString();
30 | var compiler = fs.readFileSync(__dirname + '/../lib/compiler.js').toString();
31 | var mustache_wrapper = fs.readFileSync(__dirname + '/../wrappers/mustache.js.mustache').toString();
32 |
33 | // Create a Mustache.js emulator from the distribution template
34 | var engines = (new Function(Hogan.compile(mustache_wrapper).render({template: template, compiler: compiler}) +
35 | '; return {Hogan: Hogan, Mustache: Mustache};'))();
36 |
37 | var Mustache = engines.Mustache;
38 | var Hogan2 = engines.Hogan;
39 |
40 |
41 | // sanity check
42 | is(Mustache.hasOwnProperty('to_html'), true, 'Mustache has to_html method.');
43 |
44 | // Check for Mustache.js partial resolution behavior.
45 | var context = {
46 | foo: 'bar',
47 | mypartial: {
48 | baz: 'qux'
49 | }
50 | }
51 | var text = 'abc {{foo}} def {{>mypartial}} ghi';
52 | var partialText = '{{baz}}';
53 | var s = Mustache.to_html(text, context, {'mypartial': partialText});
54 | is(s, 'abc bar def qux ghi', 'Correct emulation of Mustache.js partial-name-in-context resolution.');
55 |
56 | // Now check to see that the Hogan resolution is unaffected.
57 | var t = Hogan2.compile(text);
58 | s = t.render(context, {'mypartial': partialText});
59 | is(s, 'abc bar def ghi', 'Hogan behavior not changed by Mustache.js emulation.');
60 |
61 | // Check for sendFun behavior
62 | var buf = "";
63 | function send(s) {
64 | buf += "-FOO " + s + " FOO-";
65 | }
66 | var s = Mustache.to_html(text, context, {'mypartial': partialText}, send);
67 | is(buf, '-FOO abc bar def qux ghi FOO-', 'Correct emulation of Mustache.js sendFun.');
68 |
69 |
70 | function is(got, expected, msg) {
71 | if (got === expected) {
72 | output("OK: " + msg);
73 | ++passed;
74 | } else {
75 | output("FAIL: " + msg);
76 | output("Expected |" + expected + "|");
77 | output(" Got |" + got + "|");
78 | ++failed;
79 | }
80 | }
81 |
82 | function complete() {
83 | output("\nTests Complete");
84 | output("--------------");
85 | output("Passed: " + passed);
86 | output("Failed: " + failed);
87 | output("\n");
88 | }
89 |
90 | complete();
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | var Hogan = Hogan || require('../lib/hogan');
17 | var doc = this["document"];
18 | var fs = require('fs');
19 |
20 | var passed = 0;
21 | var failed = 0;
22 |
23 | if (!this["output"]) {
24 | var output = function (string) {
25 | return doc ? doc.write(string + ' ') : console.log(string);
26 | };
27 | }
28 |
29 | function runTest(tests) {
30 | tests.forEach(function(test) {
31 | var partials = {};
32 | for (var i in test.partials) {
33 | partials[i] = Hogan.compile(test.partials[i]);
34 | }
35 | var t = Hogan.compile(test.template);
36 |
37 | if (test.data.lambda) {
38 | var func = (new Function ('return ' + test.data.lambda.js)());
39 | test.data.lambda = function() { return func; };
40 | }
41 |
42 | var s = t.render(test.data, partials);
43 | is(s, test.expected, test.name + ': ' + test.desc);
44 | });
45 | }
46 |
47 | var testDir = './test/spec/specs';
48 | var files = fs.readdirSync(testDir)
49 | .filter(function(f) { return f.indexOf('.json') > 0; })
50 | .map(function(f) { return testDir + '/' + f});
51 |
52 | for (var i = 0; i < files.length; i++) {
53 | var test = JSON.parse(fs.readFileSync(files[i]).toString());
54 | runTest(test.tests);
55 | }
56 |
57 | function is(got, expected, msg) {
58 | if (got === expected) {
59 | output("OK: " + msg);
60 | ++passed;
61 | } else {
62 | output("FAIL: " + msg);
63 | output("Expected |" + expected + "|");
64 | output(" Got |" + got + "|");
65 | ++failed;
66 | }
67 | }
68 |
69 | function complete() {
70 | output("\nTests Complete");
71 | output("--------------");
72 | output("Passed: " + passed);
73 | output("Failed: " + failed);
74 | output("\n");
75 | }
76 |
77 | complete();
78 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/Changes:
--------------------------------------------------------------------------------
1 | 2011-03-20: v1.1.2
2 | Added tests for standalone tags at string boundaries.
3 | Added tests for rendering lambda returns after delimiter changes.
4 |
5 | 2011-03-20: v1.0.3
6 | Added tests for standalone tags at string boundaries.
7 | Added tests for rendering lambda returns after delimiter changes.
8 |
9 | 2011-03-05: v1.1.1
10 | Added tests for indented inline sections.
11 | Added tests for Windows-style newlines.
12 |
13 | 2011-03-05: v1.0.2
14 | Added tests for indented inline sections.
15 | Added tests for Windows-style newlines.
16 |
17 | 2011-03-04: v1.1.0
18 | Implicit iterators.
19 | A single period (`.`) may now be used as a name in Interpolation tags,
20 | which represents the top of stack (cast as a String).
21 | Dotted names.
22 | Names containing one or more periods should be resolved as chained
23 | properties; naïvely, this is like nesting section tags, but with some
24 | built-in scoping protections.
25 |
26 | 2011-03-02: v1.0.1
27 | Clarifying a point in the README about version compliance.
28 | Adding high-level documentation to each spec file.
29 |
30 | 2011-02-28: v1.0.0
31 | Initial Release
32 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/README.md:
--------------------------------------------------------------------------------
1 | The repository at https://github.com/mustache/spec is the formal standard for
2 | Mustache. It defines both normal usage and edge-case behavior for libraries
3 | parsing the Mustache templating language (or a superset thereof).
4 |
5 | The specification is developed as a series of YAML files, under the `specs`
6 | directory.
7 |
8 | Versioning
9 | ----------
10 | This specification is being [semantically versioned](http://semver.org).
11 | Roughly described, major version changes will always represent backwards
12 | incompatible changes, minor version changes will always represent new language
13 | features and will be backwards compatible, and patch ('tiny') version changes
14 | will always be bug fixes. For the purposes of semantic versioning, the public
15 | API is the contents of the `specs` directory and the algorithm for testing
16 | against it.
17 |
18 | Mustache implementations SHOULD report the most recent version of the spec
19 | (major and minor version numbers). If an implementation has support for any
20 | optional modules, they SHOULD indicate so with a remark attached to the
21 | version number (e.g. "vX.Y, including lambdas" or "v.X.Y+λ"). It is
22 | RECOMMENDED that implementations not supporting at least v1.0.0 of this spec
23 | refer to themselves as "Mustache-like", or "Mustache-inspired".
24 |
25 | Alternate Formats
26 | -----------------
27 |
28 | Since YAML is a reasonably complex format that not every language has good
29 | tools for working with, we also provide JSON versions of the specs on a
30 | best-effort basis.
31 |
32 | These should be identical to the YAML specifications, but if you find the need
33 | to regenerate them, they can be trivially rebuilt by invoking `rake build`.
34 |
35 | It is also worth noting that some specifications (notably, the lambda module)
36 | rely on YAML "tags" to denote special types of data (e.g. source code). Since
37 | JSON offers no way to denote this, a special key ("`__tag__`") is injected
38 | with the name of the tag as its value. See `TESTING.md` for more information
39 | about handling tagged data.
40 |
41 | Optional Modules
42 | ----------------
43 |
44 | Specification files beginning with a tilde (`~`) describe optional modules.
45 | At present, the only module being described as optional is regarding support
46 | for lambdas. As a guideline, a module may be a candidate for optionality
47 | when:
48 |
49 | * It does not affect the core syntax of the language.
50 | * It does not significantly affect the output of rendered templates.
51 | * It concerns implementation language features or data types that are not
52 | common to or core in every targeted language.
53 | * The lack of support by an implementation does not diminish the usage of
54 | Mustache in the target language.
55 |
56 | As an example, the lambda module is primarily concerned with the handling of a
57 | particular data type (code). This is a type of data that may be difficult to
58 | support in some languages, and users of those languages will not see the lack
59 | as an 'inconsistency' between implementations.
60 |
61 | Support for specific pragmas or syntax extensions, however, are best managed
62 | outside this core specification, as adjunct specifications.
63 |
64 | Implementors are strongly encouraged to support any and all modules they are
65 | reasonably capable of supporting.
66 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/Rakefile:
--------------------------------------------------------------------------------
1 | require 'json'
2 | require 'yaml'
3 |
4 | # Our custom YAML tags must retain their magic.
5 | %w[ code ].each do |tag|
6 | YAML::add_builtin_type(tag) { |_,val| val.merge(:__tag__ => tag) }
7 | end
8 |
9 | desc 'Build all alternate versions of the specs.'
10 | multitask :build => [ 'build:json' ]
11 |
12 | namespace :build do
13 | note = 'Do not edit this file; changes belong in the appropriate YAML file.'
14 |
15 | desc 'Build JSON versions of the specs.'
16 | task :json do
17 | rm(Dir['specs/*.json'], :verbose => false)
18 | Dir.glob('specs/*.yml').each do |filename|
19 | json_file = filename.gsub('.yml', '.json')
20 |
21 | File.open(json_file, 'w') do |file|
22 | doc = YAML.load_file(filename)
23 | file << doc.merge(:__ATTN__ => note).to_json()
24 | end
25 | end
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/TESTING.md:
--------------------------------------------------------------------------------
1 | Testing your Mustache implementation against this specification should be
2 | relatively simple. If you have a readily available testing framework on your
3 | platform, your task may be even simpler.
4 |
5 | In general, the process for each `.yml` file is as follows:
6 |
7 | 1. Use a YAML parser to load the file.
8 |
9 | 2. For each test in the 'tests' array:
10 |
11 | 1. Ensure that each element of the 'partials' hash (if it exists) is
12 | stored in a place where the interpreter will look for it.
13 |
14 | 2. If your implementation will not support lambdas, feel free to skip over
15 | the optional '~lambdas.yml' file.
16 |
17 | 2.1. If your implementation will support lambdas, ensure that each member of
18 | 'data' tagged with '!code' is properly processed into a language-
19 | specific lambda reference.
20 |
21 | * e.g. Given this YAML data hash:
22 |
23 | `{ x: !code { ruby: 'proc { "x" }', perl: 'sub { "x" }' } }`
24 |
25 | a Ruby-based Mustache implementation would process it such that it
26 | was equivalent to this Ruby hash:
27 |
28 | `{ 'x' => proc { "x" } }`
29 |
30 | * If your implementation language does not currently have lambda
31 | examples in the spec, feel free to implement them and send a pull
32 | request.
33 |
34 | * The JSON version of the spec represents these tagged values as a hash
35 | with a '`__tag__`' key of 'code'.
36 |
37 | 3. Render the template (stored in the 'template' key) with the given 'data'
38 | hash.
39 |
40 | 4. Compare the results of your rendering against the 'expected' value; any
41 | differences should be reported, along with any useful debugging
42 | information.
43 |
44 | * Of note, the 'desc' key contains a rough one-line description of the
45 | behavior being tested -- this is most useful in conjunction with the
46 | file name and test 'name'.
47 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/specs/comments.json:
--------------------------------------------------------------------------------
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."}]}
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/specs/comments.yml:
--------------------------------------------------------------------------------
1 | overview: |
2 | Comment tags represent content that should never appear in the resulting
3 | output.
4 |
5 | The tag's content may contain any substring (including newlines) EXCEPT the
6 | closing delimiter.
7 |
8 | Comment tags SHOULD be treated as standalone when appropriate.
9 | tests:
10 | - name: Inline
11 | desc: Comment blocks should be removed from the template.
12 | data: { }
13 | template: '12345{{! Comment Block! }}67890'
14 | expected: '1234567890'
15 |
16 | - name: Multiline
17 | desc: Multiline comments should be permitted.
18 | data: { }
19 | template: |
20 | 12345{{!
21 | This is a
22 | multi-line comment...
23 | }}67890
24 | expected: |
25 | 1234567890
26 |
27 | - name: Standalone
28 | desc: All standalone comment lines should be removed.
29 | data: { }
30 | template: |
31 | Begin.
32 | {{! Comment Block! }}
33 | End.
34 | expected: |
35 | Begin.
36 | End.
37 |
38 | - name: Indented Standalone
39 | desc: All standalone comment lines should be removed.
40 | data: { }
41 | template: |
42 | Begin.
43 | {{! Indented Comment Block! }}
44 | End.
45 | expected: |
46 | Begin.
47 | End.
48 |
49 | - name: Standalone Line Endings
50 | desc: '"\r\n" should be considered a newline for standalone tags.'
51 | data: { }
52 | template: "|\r\n{{! Standalone Comment }}\r\n|"
53 | expected: "|\r\n|"
54 |
55 | - name: Standalone Without Previous Line
56 | desc: Standalone tags should not require a newline to precede them.
57 | data: { }
58 | template: " {{! I'm Still Standalone }}\n!"
59 | expected: "!"
60 |
61 | - name: Standalone Without Newline
62 | desc: Standalone tags should not require a newline to follow them.
63 | data: { }
64 | template: "!\n {{! I'm Still Standalone }}"
65 | expected: "!\n"
66 |
67 | - name: Multiline Standalone
68 | desc: All standalone comment lines should be removed.
69 | data: { }
70 | template: |
71 | Begin.
72 | {{!
73 | Something's going on here...
74 | }}
75 | End.
76 | expected: |
77 | Begin.
78 | End.
79 |
80 | - name: Indented Multiline Standalone
81 | desc: All standalone comment lines should be removed.
82 | data: { }
83 | template: |
84 | Begin.
85 | {{!
86 | Something's going on here...
87 | }}
88 | End.
89 | expected: |
90 | Begin.
91 | End.
92 |
93 | - name: Indented Inline
94 | desc: Inline comments should not strip whitespace
95 | data: { }
96 | template: " 12 {{! 34 }}\n"
97 | expected: " 12 \n"
98 |
99 | - name: Surrounding Whitespace
100 | desc: Comment removal should preserve surrounding whitespace.
101 | data: { }
102 | template: '12345 {{! Comment Block! }} 67890'
103 | expected: '12345 67890'
104 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/specs/delimiters.json:
--------------------------------------------------------------------------------
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."}]}
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/specs/partials.json:
--------------------------------------------------------------------------------
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>","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":"[]"}}]}
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/spec/specs/partials.yml:
--------------------------------------------------------------------------------
1 | overview: |
2 | Partial tags are used to expand an external template into the current
3 | template.
4 |
5 | The tag's content MUST be a non-whitespace character sequence NOT containing
6 | the current closing delimiter.
7 |
8 | This tag's content names the partial to inject. Set Delimiter tags MUST NOT
9 | affect the parsing of a partial. The partial MUST be rendered against the
10 | context stack local to the tag. If the named partial cannot be found, the
11 | empty string SHOULD be used instead, as in interpolations.
12 |
13 | Partial tags SHOULD be treated as standalone when appropriate. If this tag
14 | is used standalone, any whitespace preceding the tag should treated as
15 | indentation, and prepended to each line of the partial before rendering.
16 | tests:
17 | - name: Basic Behavior
18 | desc: The greater-than operator should expand to the named partial.
19 | data: { }
20 | template: '"{{>text}}"'
21 | partials: { text: 'from partial' }
22 | expected: '"from partial"'
23 |
24 | - name: Failed Lookup
25 | desc: The empty string should be used when the named partial is not found.
26 | data: { }
27 | template: '"{{>text}}"'
28 | partials: { }
29 | expected: '""'
30 |
31 | - name: Context
32 | desc: The greater-than operator should operate within the current context.
33 | data: { text: 'content' }
34 | template: '"{{>partial}}"'
35 | partials: { partial: '*{{text}}*' }
36 | expected: '"*content*"'
37 |
38 | - name: Recursion
39 | desc: The greater-than operator should properly recurse.
40 | data: { content: "X", nodes: [ { content: "Y", nodes: [] } ] }
41 | template: '{{>node}}'
42 | partials: { node: '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>' }
43 | expected: 'X>'
44 |
45 | # Whitespace Sensitivity
46 |
47 | - name: Surrounding Whitespace
48 | desc: The greater-than operator should not alter surrounding whitespace.
49 | data: { }
50 | template: '| {{>partial}} |'
51 | partials: { partial: "\t|\t" }
52 | expected: "| \t|\t |"
53 |
54 | - name: Inline Indentation
55 | desc: Whitespace should be left untouched.
56 | data: { data: '|' }
57 | template: " {{data}} {{> partial}}\n"
58 | partials: { partial: ">\n>" }
59 | expected: " | >\n>\n"
60 |
61 | - name: Standalone Line Endings
62 | desc: '"\r\n" should be considered a newline for standalone tags.'
63 | data: { }
64 | template: "|\r\n{{>partial}}\r\n|"
65 | partials: { partial: ">" }
66 | expected: "|\r\n>|"
67 |
68 | - name: Standalone Without Previous Line
69 | desc: Standalone tags should not require a newline to precede them.
70 | data: { }
71 | template: " {{>partial}}\n>"
72 | partials: { partial: ">\n>"}
73 | expected: " >\n >>"
74 |
75 | - name: Standalone Without Newline
76 | desc: Standalone tags should not require a newline to follow them.
77 | data: { }
78 | template: ">\n {{>partial}}"
79 | partials: { partial: ">\n>" }
80 | expected: ">\n >\n >"
81 |
82 | - name: Standalone Indentation
83 | desc: Each line of the partial should be indented before rendering.
84 | data: { content: "<\n->" }
85 | template: |
86 | \
87 | {{>partial}}
88 | /
89 | partials:
90 | partial: |
91 | |
92 | {{{content}}}
93 | |
94 | expected: |
95 | \
96 | |
97 | <
98 | ->
99 | |
100 | /
101 |
102 | # Whitespace Insensitivity
103 |
104 | - name: Padding Whitespace
105 | desc: Superfluous in-tag whitespace should be ignored.
106 | data: { boolean: true }
107 | template: "|{{> partial }}|"
108 | partials: { partial: "[]" }
109 | expected: '|[]|'
110 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/test/templates/list.mustache:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/tools/release.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | var fs = require('fs');
17 | var path = require('path');
18 | var Hogan = require(__dirname + '/../lib/hogan');
19 | var minlicense = '/**\n* @preserve Copyright 2012 Twitter, Inc.\n* @license http://www.apache.org/licenses/LICENSE-2.0.txt\n*/\n';
20 |
21 | function read(path) {
22 | return fs.readFileSync(path).toString()
23 | }
24 |
25 | // Good enough for little js files
26 | function copy(src, dst) {
27 | return fs.writeFileSync(dst, read(src));
28 | }
29 |
30 | function uglify(src, dst) {
31 | var jsp = require("uglify-js").parser;
32 | var pro = require("uglify-js").uglify;
33 | var orig_code = read(src);
34 | var ast = jsp.parse(orig_code); // parse code and get the initial AST
35 | ast = pro.ast_mangle(ast); // get a new AST with mangled names
36 | ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
37 | fs.writeFileSync(dst, minlicense + pro.gen_code(ast));
38 | }
39 |
40 | var packageJSON = JSON.parse(read('package.json'));
41 | var version = packageJSON.version.substring(0, packageJSON.version.indexOf('-'));
42 |
43 | function removeFirstComment(text) {
44 | return text.substring(text.indexOf('*/') + 2);
45 | }
46 |
47 | var context = {
48 | template: removeFirstComment(read(__dirname + '/../lib/template.js')),
49 | compiler: removeFirstComment(read(__dirname + '/../lib/compiler.js'))
50 | };
51 |
52 | var wrapperPath = '/../wrappers/';
53 | var wrappers = fs.readdirSync(__dirname + wrapperPath).map(function(f) {
54 | return __dirname + wrapperPath + f;
55 | });
56 |
57 | var distPath = __dirname + '/../dist/';
58 | wrappers.forEach(function(wrapper) {
59 | var tail = path.basename(wrapper, '.mustache');
60 | var target = distPath + 'hogan-' + version + '.' + tail;
61 | var uglified = distPath + 'hogan-' + version + '.min.' + tail;
62 | fs.writeFileSync(target, Hogan.compile(read(wrapper)).render(context));
63 | uglify(target, uglified);
64 | });
65 |
66 | // Also release Hogan.Template on its own.
67 | var templateTarget = distPath + 'template-' + version + '.js';
68 | fs.writeFileSync(templateTarget, read(__dirname + '/../lib/template.js'));
69 | uglify(templateTarget, distPath + 'template-' + version + '.min.js');
70 |
71 | // Add packageJSON to node distribution
72 | packageJSON.version = version;
73 | fs.writeFileSync(__dirname + '/../dist/nodejs/package.json',
74 | JSON.stringify(packageJSON, null, " "));
75 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/tools/web_templates.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | var Hogan = require(__dirname + '/../lib/hogan.js');
17 | var fs = require('fs');
18 | var path = require('path');
19 |
20 | // Substitute variables in the homepage with values from package.json
21 | var homeTemplatePath = __dirname + '/../build/gh-pages/index.html.mustache';
22 | var contextPath = __dirname + '/../dist/nodejs/package.json';
23 |
24 | var homepage = fs.readFileSync(homeTemplatePath).toString();
25 | var context = JSON.parse(fs.readFileSync(contextPath).toString());
26 |
27 | var template = Hogan.compile(homepage);
28 |
29 | fs.writeFileSync(path.dirname(homeTemplatePath) + '/index.html',
30 | template.render(context));
31 |
32 | fs.unlinkSync(homeTemplatePath);
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @preserve Copyright 2012 Twitter, Inc.
3 | * @license http://www.apache.org/licenses/LICENSE-2.0.txt
4 | */
5 | var Hogan={};(function(a){function h(a){return a=String(a===null||a===undefined?"":a),g.test(a)?a.replace(b,"&").replace(c,"<").replace(d,">").replace(e,"'").replace(f,"""):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=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,e=/\'/g,f=/\"/g,g=/[&<>\"\']/,i=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan)
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/favicon.ico
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/images/logo.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/images/noise.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/images/noise.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/images/small-hogan-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/images/small-hogan-icon.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/images/stripes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samwillis/pagedown-bootstrap/e610161c04cddf03a614991d2a8c7617c1c264ab/demo/browser/bootstrap/docs/build/node_modules/hogan.js/web/images/stripes.png
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/wrappers/amd.js.mustache:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | {{{template}}}
17 | {{{compiler}}}
18 |
19 | if (typeof define === 'function' && define.amd) {
20 | define(Hogan);
21 | }
22 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/wrappers/common.js.mustache:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | {{{template}}}
17 | {{{compiler}}}
18 |
19 | if (typeof module !== 'undefined' && module.exports) {
20 | module.exports = Hogan;
21 | }
22 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/wrappers/js.mustache:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | {{{template}}}
17 | {{{compiler}}}
18 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/node_modules/hogan.js/wrappers/mustache.js.mustache:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Twitter, Inc.
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | // A wrapper for compatibility with Mustache.js, quirks and all
17 |
18 | {{{template}}}
19 | {{{compiler}}}
20 |
21 | var Mustache = (function (Hogan) {
22 |
23 | // Mustache.js has non-spec partial context behavior
24 | function mustachePartial(name, context, partials, indent) {
25 | var partialScope = this.f(name, context, partials, 0);
26 | var cx = context;
27 | if (partialScope) {
28 | cx = cx.concat(partialScope);
29 | }
30 |
31 | return Hogan.Template.prototype.rp.call(this, name, cx, partials, indent);
32 | }
33 |
34 | var HoganTemplateWrapper = function(renderFunc, text, compiler){
35 | this.rp = mustachePartial;
36 | Hogan.Template.call(this, renderFunc, text, compiler);
37 | };
38 | HoganTemplateWrapper.prototype = Hogan.Template.prototype;
39 |
40 | // Add a wrapper for Hogan's generate method. Mustache and Hogan keep
41 | // separate caches, and Mustache returns wrapped templates.
42 | var wrapper;
43 | var HoganWrapper = function(){
44 | this.cache = {};
45 | this.generate = function(code, text, options) {
46 | return new HoganTemplateWrapper(new Function('c', 'p', 'i', code), text, wrapper);
47 | }
48 | };
49 | HoganWrapper.prototype = Hogan;
50 | wrapper = new HoganWrapper();
51 |
52 | return {
53 | to_html: function(text, data, partials, sendFun) {
54 | var template = wrapper.compile(text);
55 | var result = template.render(data, partials);
56 | if (!sendFun) {
57 | return result;
58 | }
59 |
60 | sendFun(result);
61 | }
62 | }
63 |
64 | })(Hogan);
65 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/build/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap-doc-builder"
3 | , "version": "0.0.1"
4 | , "description": "build bootstrap docs"
5 | , "dependencies": { "hogan.js": "1.0.5-dev" }
6 | }
7 |
--------------------------------------------------------------------------------
/demo/browser/bootstrap/docs/examples/starter-template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Bootstrap, from Twitter
6 |
7 |
8 |
9 |
10 |
11 |
12 |
17 |
18 |
19 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
{{_i}}We've included a few basic examples as starting points for your work with Bootstrap. We encourage folks to iterate on these examples and not simply use them as an end result.{{/i}}
'
25 | , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
26 |
27 | ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
28 | })
29 |
30 | test("should remove open class if body clicked", function () {
31 | var dropdownHTML = '