42 |
43 |
44 |
45 |
46 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Table of Contents jQuery Plugin - jquery.toc
2 |
3 | A minimal, tiny jQuery plugin that will generate a table of contents, drawing from headings on the
4 | page.
5 |
6 | The generated TOCs are semantic, nested lists (`ul` or `ol`) with hash-link anchors to the headings.
7 |
8 | ## Usage
9 |
10 | You can [download the latest release](http://ndabas.github.com/toc/assets/jquery.toc.zip), or
11 | install with NPM: `npm install jquery.toc`.
12 |
13 | Include jQuery (>= 1.6) and jquery.toc.js/jquery.toc.min.js on your page. The plugin can then be
14 | used either via HTML5 data attributes, or via the programmatic API. See below for the available
15 | options.
16 |
17 | ### Via data attributes
18 |
19 | Minimal example:
20 |
21 |
22 |
23 | With options:
24 |
25 |
26 |
27 | ### Via the JavaScript programmatic API
28 |
29 | Minimal example:
30 |
31 |
32 | ...
33 |
36 |
37 | With options:
38 |
39 |
40 | ...
41 |
44 |
45 | ### Options
46 |
47 |
48 |
49 | $(...).toc({content: "body", headings: "h1,h2,h3"});
50 |
51 | The plugin has two options:
52 |
53 | * `content` is a selector where the plugin will look for headings to build up the TOC. The default
54 | value is `"body"`.
55 | * `headings` is a string with a comma-separated list of selectors to be used as headings, in the
56 | order which defines their relative hierarchy level. The default value of `"h1,h2,h3"` will select
57 | all `h1`, `h2`, and `h3` elements to build the TOC, with `h1` being a level 1, `h2` a level 2, and
58 | so on. You can use any valid list of jQuery selectors; for example, if you just want `h1` tags
59 | with a specific class, and no `h3` tags, you could use `"h1.title,h2"` for this parameter.
60 |
61 | In addition, the plugin will create nested lists of the same type (`ul` or `ol`) as the element that
62 | it is called on.
63 |
64 | ### Automatic ID generation
65 |
66 | The plugin generates hash-links to the headings on the page, to allow users to jump to the heading
67 | by clicking in the generated table of contents. This feature requires that the headings have IDs
68 | assigned; if they do not, the plugin will generate and assign IDs automatically.
69 |
70 | The generated IDs are based on the text inside the headings, and uses two simple rules:
71 |
72 | * Space characters are converted to underscores. Multiple spaces are replaced with a single
73 | underscore.
74 | * If the ID already exists, a suffix like "_1", "_2", etc. is tried till we get a unique ID.
75 |
76 | For example, a heading like `
Heading 2.1
` will get the ID `Heading_2.1`.
77 |
78 | ## Alternatives
79 |
80 | If you're looking for a jQuery plugin that does more than just generate a minimal table of contents,
81 | the project wiki [lists some more plugins](https://github.com/ndabas/toc/wiki/Alternatives).
82 |
83 | ## License
84 |
85 | Licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
86 |
87 | ## Credits
88 |
89 | Created by [Nikhil Dabas](http://www.nikhildabas.com/).
90 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | title: Table of Contents jQuery Plugin — jquery.toc
4 | ---
5 |
6 |
Table of Contents jQuery Plugin
7 |
8 |
9 | A minimal, tiny jQuery plugin that will generate a table of contents, using
10 | semantic, nested lists with hash-link anchors to headings.
36 | Include jQuery (>= 1.6) and jquery.toc.js/jquery.toc.min.js on your page. The plugin can
37 | then be used either via HTML5 data attributes, or via the programmatic API. See below for
38 | the available options.
78 | content is a selector where the plugin will look for headings to build up
79 | the TOC. The default value is "body".
80 |
81 | headings is a string with a comma-separated list of selectors to be used as
82 | headings, in the order which defines their relative hierarchy level. The default value
83 | of "h1,h2,h3" will select all h1, h2, and
84 | h3 elements to build the TOC, with h1 being a level 1,
85 | h2 a level 2, and so on. You can use any valid list of jQuery selectors;
86 | for example, if you just want h1 tags with a specific class, and no
87 | h3 tags, you could use "h1.title,h2" for this parameter.
88 |
89 |
90 |
91 | In addition, the plugin will create nested lists of the same type (ul or
92 | ol) as the element that it is called on.
93 |
94 |
Automatic ID generation
95 |
96 |
97 | The plugin generates hash-links to the headings on the page, to allow users to jump to the
98 | heading by clicking in the generated table of contents. This feature requires that the
99 | headings have IDs assigned; if they do not, the plugin will generate and assign IDs
100 | automatically.
101 |
102 |
The generated IDs are based on the text inside the headings, and uses two simple rules:
103 |
104 |
105 |
106 | Space characters are converted to underscores. Multiple spaces are replaced with a
107 | single underscore.
108 |
If the ID already exists, a suffix like "_1", "_2", etc. is tried till we get a unique
109 | ID.
110 |
111 |
112 |
113 | For example, a heading like <h2>Heading 2.1</h2> will get the ID
114 | Heading_2.1.
115 |
116 |
Alternatives
117 |
118 |
119 | If you're looking for a jQuery plugin that does more than just generate a minimal table of
120 | contents, the project wiki lists
121 | some more plugins.
133 |
--------------------------------------------------------------------------------
/jquery.toc.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Table of Contents jQuery Plugin - jquery.toc
3 | *
4 | * Copyright 2013-2016 Nikhil Dabas
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7 | * in compliance with the License. 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 distributed under the License
12 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 | * or implied. See the License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | (function ($) {
18 | "use strict";
19 |
20 | // Builds a list with the table of contents in the current selector.
21 | // options:
22 | // content: where to look for headings
23 | // headings: string with a comma-separated list of selectors to be used as headings, ordered
24 | // by their relative hierarchy level
25 | var toc = function (options) {
26 | return this.each(function () {
27 | var root = $(this),
28 | data = root.data(),
29 | thisOptions,
30 | stack = [root], // The upside-down stack keeps track of list elements
31 | listTag = this.tagName,
32 | currentLevel = 0,
33 | headingSelectors;
34 |
35 | // Defaults: plugin parameters override data attributes, which override our defaults
36 | thisOptions = $.extend(
37 | {content: "body", headings: "h1,h2,h3"},
38 | {content: data.toc || undefined, headings: data.tocHeadings || undefined},
39 | options
40 | );
41 | headingSelectors = thisOptions.headings.split(",");
42 |
43 | // Set up some automatic IDs if we do not already have them
44 | $(thisOptions.content).find(thisOptions.headings).attr("id", function (index, attr) {
45 | // In HTML5, the id attribute must be at least one character long and must not
46 | // contain any space characters.
47 | //
48 | // We just use the HTML5 spec now because all browsers work fine with it.
49 | // https://mathiasbynens.be/notes/html5-id-class
50 | var generateUniqueId = function (text) {
51 | // Generate a valid ID. Spaces are replaced with underscores. We also check if
52 | // the ID already exists in the document. If so, we append "_1", "_2", etc.
53 | // until we find an unused ID.
54 |
55 | if (text.length === 0) {
56 | text = "?";
57 | }
58 |
59 | var baseId = text.replace(/\s+/g, "_"), suffix = "", count = 1;
60 |
61 | while (document.getElementById(baseId + suffix) !== null) {
62 | suffix = "_" + count++;
63 | }
64 |
65 | return baseId + suffix;
66 | };
67 |
68 | return attr || generateUniqueId($(this).text());
69 | }).each(function () {
70 | // What level is the current heading?
71 | var elem = $(this), level = $.map(headingSelectors, function (selector, index) {
72 | return elem.is(selector) ? index : undefined;
73 | })[0];
74 |
75 | if (level > currentLevel) {
76 | // If the heading is at a deeper level than where we are, start a new nested
77 | // list, but only if we already have some list items in the parent. If we do
78 | // not, that means that we're skipping levels, so we can just add new list items
79 | // at the current level.
80 | // In the upside-down stack, unshift = push, and stack[0] = the top.
81 | var parentItem = stack[0].children("li:last")[0];
82 | if (parentItem) {
83 | stack.unshift($("<" + listTag + "/>").appendTo(parentItem));
84 | }
85 | } else {
86 | // Truncate the stack to the current level by chopping off the 'top' of the
87 | // stack. We also need to preserve at least one element in the stack - that is
88 | // the containing element.
89 | stack.splice(0, Math.min(currentLevel - level, Math.max(stack.length - 1, 0)));
90 | }
91 |
92 | // Add the list item
93 | $("").appendTo(stack[0]).append(
94 | $("").text(elem.text()).attr("href", "#" + elem.attr("id"))
95 | );
96 |
97 | currentLevel = level;
98 | });
99 | });
100 | }, old = $.fn.toc;
101 |
102 | $.fn.toc = toc;
103 |
104 | $.fn.toc.noConflict = function () {
105 | $.fn.toc = old;
106 | return this;
107 | };
108 |
109 | // Data API
110 | $(function () {
111 | toc.call($("[data-toc]"));
112 | });
113 | }(window.jQuery));
114 |
--------------------------------------------------------------------------------
/docs/lib/jquery.toc/jquery.toc.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Table of Contents jQuery Plugin - jquery.toc
3 | *
4 | * Copyright 2013-2016 Nikhil Dabas
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7 | * in compliance with the License. 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 distributed under the License
12 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 | * or implied. See the License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | (function ($) {
18 | "use strict";
19 |
20 | // Builds a list with the table of contents in the current selector.
21 | // options:
22 | // content: where to look for headings
23 | // headings: string with a comma-separated list of selectors to be used as headings, ordered
24 | // by their relative hierarchy level
25 | var toc = function (options) {
26 | return this.each(function () {
27 | var root = $(this),
28 | data = root.data(),
29 | thisOptions,
30 | stack = [root], // The upside-down stack keeps track of list elements
31 | listTag = this.tagName,
32 | currentLevel = 0,
33 | headingSelectors;
34 |
35 | // Defaults: plugin parameters override data attributes, which override our defaults
36 | thisOptions = $.extend(
37 | {content: "body", headings: "h1,h2,h3"},
38 | {content: data.toc || undefined, headings: data.tocHeadings || undefined},
39 | options
40 | );
41 | headingSelectors = thisOptions.headings.split(",");
42 |
43 | // Set up some automatic IDs if we do not already have them
44 | $(thisOptions.content).find(thisOptions.headings).attr("id", function (index, attr) {
45 | // In HTML5, the id attribute must be at least one character long and must not
46 | // contain any space characters.
47 | //
48 | // We just use the HTML5 spec now because all browsers work fine with it.
49 | // https://mathiasbynens.be/notes/html5-id-class
50 | var generateUniqueId = function (text) {
51 | // Generate a valid ID. Spaces are replaced with underscores. We also check if
52 | // the ID already exists in the document. If so, we append "_1", "_2", etc.
53 | // until we find an unused ID.
54 |
55 | if (text.length === 0) {
56 | text = "?";
57 | }
58 |
59 | var baseId = text.replace(/\s+/g, "_"), suffix = "", count = 1;
60 |
61 | while (document.getElementById(baseId + suffix) !== null) {
62 | suffix = "_" + count++;
63 | }
64 |
65 | return baseId + suffix;
66 | };
67 |
68 | return attr || generateUniqueId($(this).text());
69 | }).each(function () {
70 | // What level is the current heading?
71 | var elem = $(this), level = $.map(headingSelectors, function (selector, index) {
72 | return elem.is(selector) ? index : undefined;
73 | })[0];
74 |
75 | if (level > currentLevel) {
76 | // If the heading is at a deeper level than where we are, start a new nested
77 | // list, but only if we already have some list items in the parent. If we do
78 | // not, that means that we're skipping levels, so we can just add new list items
79 | // at the current level.
80 | // In the upside-down stack, unshift = push, and stack[0] = the top.
81 | var parentItem = stack[0].children("li:last")[0];
82 | if (parentItem) {
83 | stack.unshift($("<" + listTag + "/>").appendTo(parentItem));
84 | }
85 | } else {
86 | // Truncate the stack to the current level by chopping off the 'top' of the
87 | // stack. We also need to preserve at least one element in the stack - that is
88 | // the containing element.
89 | stack.splice(0, Math.min(currentLevel - level, Math.max(stack.length - 1, 0)));
90 | }
91 |
92 | // Add the list item
93 | $("").appendTo(stack[0]).append(
94 | $("").text(elem.text()).attr("href", "#" + elem.attr("id"))
95 | );
96 |
97 | currentLevel = level;
98 | });
99 | });
100 | }, old = $.fn.toc;
101 |
102 | $.fn.toc = toc;
103 |
104 | $.fn.toc.noConflict = function () {
105 | $.fn.toc = old;
106 | return this;
107 | };
108 |
109 | // Data API
110 | $(function () {
111 | toc.call($("[data-toc]"));
112 | });
113 | }(window.jQuery));
114 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/docs/lib/google-code-prettify/prettify.js:
--------------------------------------------------------------------------------
1 | !function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
2 | (function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
3 | b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;ah[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
10 | q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
11 | /^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
12 | s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
13 | q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
14 | c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
19 | O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
20 | Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
21 | V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^]+/],["dec",/^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
22 | /^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^