-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 13d6526
Showing
116 changed files
with
33,894 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
/* | ||
* doctools.js | ||
* ~~~~~~~~~~~ | ||
* | ||
* Base JavaScript utilities for all Sphinx HTML documentation. | ||
* | ||
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. | ||
* :license: BSD, see LICENSE for details. | ||
* | ||
*/ | ||
"use strict"; | ||
|
||
const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ | ||
"TEXTAREA", | ||
"INPUT", | ||
"SELECT", | ||
"BUTTON", | ||
]); | ||
|
||
const _ready = (callback) => { | ||
if (document.readyState !== "loading") { | ||
callback(); | ||
} else { | ||
document.addEventListener("DOMContentLoaded", callback); | ||
} | ||
}; | ||
|
||
/** | ||
* Small JavaScript module for the documentation. | ||
*/ | ||
const Documentation = { | ||
init: () => { | ||
Documentation.initDomainIndexTable(); | ||
Documentation.initOnKeyListeners(); | ||
}, | ||
|
||
/** | ||
* i18n support | ||
*/ | ||
TRANSLATIONS: {}, | ||
PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), | ||
LOCALE: "unknown", | ||
|
||
// gettext and ngettext don't access this so that the functions | ||
// can safely bound to a different name (_ = Documentation.gettext) | ||
gettext: (string) => { | ||
const translated = Documentation.TRANSLATIONS[string]; | ||
switch (typeof translated) { | ||
case "undefined": | ||
return string; // no translation | ||
case "string": | ||
return translated; // translation exists | ||
default: | ||
return translated[0]; // (singular, plural) translation tuple exists | ||
} | ||
}, | ||
|
||
ngettext: (singular, plural, n) => { | ||
const translated = Documentation.TRANSLATIONS[singular]; | ||
if (typeof translated !== "undefined") | ||
return translated[Documentation.PLURAL_EXPR(n)]; | ||
return n === 1 ? singular : plural; | ||
}, | ||
|
||
addTranslations: (catalog) => { | ||
Object.assign(Documentation.TRANSLATIONS, catalog.messages); | ||
Documentation.PLURAL_EXPR = new Function( | ||
"n", | ||
`return (${catalog.plural_expr})` | ||
); | ||
Documentation.LOCALE = catalog.locale; | ||
}, | ||
|
||
/** | ||
* helper function to focus on search bar | ||
*/ | ||
focusSearchBar: () => { | ||
document.querySelectorAll("input[name=q]")[0]?.focus(); | ||
}, | ||
|
||
/** | ||
* Initialise the domain index toggle buttons | ||
*/ | ||
initDomainIndexTable: () => { | ||
const toggler = (el) => { | ||
const idNumber = el.id.substr(7); | ||
const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); | ||
if (el.src.substr(-9) === "minus.png") { | ||
el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; | ||
toggledRows.forEach((el) => (el.style.display = "none")); | ||
} else { | ||
el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; | ||
toggledRows.forEach((el) => (el.style.display = "")); | ||
} | ||
}; | ||
|
||
const togglerElements = document.querySelectorAll("img.toggler"); | ||
togglerElements.forEach((el) => | ||
el.addEventListener("click", (event) => toggler(event.currentTarget)) | ||
); | ||
togglerElements.forEach((el) => (el.style.display = "")); | ||
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); | ||
}, | ||
|
||
initOnKeyListeners: () => { | ||
// only install a listener if it is really needed | ||
if ( | ||
!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && | ||
!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS | ||
) | ||
return; | ||
|
||
document.addEventListener("keydown", (event) => { | ||
// bail for input elements | ||
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; | ||
// bail with special keys | ||
if (event.altKey || event.ctrlKey || event.metaKey) return; | ||
|
||
if (!event.shiftKey) { | ||
switch (event.key) { | ||
case "ArrowLeft": | ||
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; | ||
|
||
const prevLink = document.querySelector('link[rel="prev"]'); | ||
if (prevLink && prevLink.href) { | ||
window.location.href = prevLink.href; | ||
event.preventDefault(); | ||
} | ||
break; | ||
case "ArrowRight": | ||
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; | ||
|
||
const nextLink = document.querySelector('link[rel="next"]'); | ||
if (nextLink && nextLink.href) { | ||
window.location.href = nextLink.href; | ||
event.preventDefault(); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
// some keyboard layouts may need Shift to get / | ||
switch (event.key) { | ||
case "/": | ||
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; | ||
Documentation.focusSearchBar(); | ||
event.preventDefault(); | ||
} | ||
}); | ||
}, | ||
}; | ||
|
||
// quick alias for translations | ||
const _ = Documentation.gettext; | ||
|
||
_ready(Documentation.init); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const DOCUMENTATION_OPTIONS = { | ||
VERSION: '', | ||
LANGUAGE: 'en', | ||
COLLAPSE_INDEX: false, | ||
BUILDER: 'html', | ||
FILE_SUFFIX: '.html', | ||
LINK_SUFFIX: '.html', | ||
HAS_SOURCE: true, | ||
SOURCELINK_SUFFIX: '.txt', | ||
NAVIGATION_WITH_KEYS: false, | ||
SHOW_SEARCH_SUMMARY: true, | ||
ENABLE_SEARCH_SHORTCUTS: true, | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
/* | ||
* language_data.js | ||
* ~~~~~~~~~~~~~~~~ | ||
* | ||
* This script contains the language-specific data used by searchtools.js, | ||
* namely the list of stopwords, stemmer, scorer and splitter. | ||
* | ||
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. | ||
* :license: BSD, see LICENSE for details. | ||
* | ||
*/ | ||
|
||
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; | ||
|
||
|
||
/* Non-minified version is copied as a separate JS file, is available */ | ||
|
||
/** | ||
* Porter Stemmer | ||
*/ | ||
var Stemmer = function() { | ||
|
||
var step2list = { | ||
ational: 'ate', | ||
tional: 'tion', | ||
enci: 'ence', | ||
anci: 'ance', | ||
izer: 'ize', | ||
bli: 'ble', | ||
alli: 'al', | ||
entli: 'ent', | ||
eli: 'e', | ||
ousli: 'ous', | ||
ization: 'ize', | ||
ation: 'ate', | ||
ator: 'ate', | ||
alism: 'al', | ||
iveness: 'ive', | ||
fulness: 'ful', | ||
ousness: 'ous', | ||
aliti: 'al', | ||
iviti: 'ive', | ||
biliti: 'ble', | ||
logi: 'log' | ||
}; | ||
|
||
var step3list = { | ||
icate: 'ic', | ||
ative: '', | ||
alize: 'al', | ||
iciti: 'ic', | ||
ical: 'ic', | ||
ful: '', | ||
ness: '' | ||
}; | ||
|
||
var c = "[^aeiou]"; // consonant | ||
var v = "[aeiouy]"; // vowel | ||
var C = c + "[^aeiouy]*"; // consonant sequence | ||
var V = v + "[aeiou]*"; // vowel sequence | ||
|
||
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 | ||
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 | ||
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 | ||
var s_v = "^(" + C + ")?" + v; // vowel in stem | ||
|
||
this.stemWord = function (w) { | ||
var stem; | ||
var suffix; | ||
var firstch; | ||
var origword = w; | ||
|
||
if (w.length < 3) | ||
return w; | ||
|
||
var re; | ||
var re2; | ||
var re3; | ||
var re4; | ||
|
||
firstch = w.substr(0,1); | ||
if (firstch == "y") | ||
w = firstch.toUpperCase() + w.substr(1); | ||
|
||
// Step 1a | ||
re = /^(.+?)(ss|i)es$/; | ||
re2 = /^(.+?)([^s])s$/; | ||
|
||
if (re.test(w)) | ||
w = w.replace(re,"$1$2"); | ||
else if (re2.test(w)) | ||
w = w.replace(re2,"$1$2"); | ||
|
||
// Step 1b | ||
re = /^(.+?)eed$/; | ||
re2 = /^(.+?)(ed|ing)$/; | ||
if (re.test(w)) { | ||
var fp = re.exec(w); | ||
re = new RegExp(mgr0); | ||
if (re.test(fp[1])) { | ||
re = /.$/; | ||
w = w.replace(re,""); | ||
} | ||
} | ||
else if (re2.test(w)) { | ||
var fp = re2.exec(w); | ||
stem = fp[1]; | ||
re2 = new RegExp(s_v); | ||
if (re2.test(stem)) { | ||
w = stem; | ||
re2 = /(at|bl|iz)$/; | ||
re3 = new RegExp("([^aeiouylsz])\\1$"); | ||
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); | ||
if (re2.test(w)) | ||
w = w + "e"; | ||
else if (re3.test(w)) { | ||
re = /.$/; | ||
w = w.replace(re,""); | ||
} | ||
else if (re4.test(w)) | ||
w = w + "e"; | ||
} | ||
} | ||
|
||
// Step 1c | ||
re = /^(.+?)y$/; | ||
if (re.test(w)) { | ||
var fp = re.exec(w); | ||
stem = fp[1]; | ||
re = new RegExp(s_v); | ||
if (re.test(stem)) | ||
w = stem + "i"; | ||
} | ||
|
||
// Step 2 | ||
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; | ||
if (re.test(w)) { | ||
var fp = re.exec(w); | ||
stem = fp[1]; | ||
suffix = fp[2]; | ||
re = new RegExp(mgr0); | ||
if (re.test(stem)) | ||
w = stem + step2list[suffix]; | ||
} | ||
|
||
// Step 3 | ||
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; | ||
if (re.test(w)) { | ||
var fp = re.exec(w); | ||
stem = fp[1]; | ||
suffix = fp[2]; | ||
re = new RegExp(mgr0); | ||
if (re.test(stem)) | ||
w = stem + step3list[suffix]; | ||
} | ||
|
||
// Step 4 | ||
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; | ||
re2 = /^(.+?)(s|t)(ion)$/; | ||
if (re.test(w)) { | ||
var fp = re.exec(w); | ||
stem = fp[1]; | ||
re = new RegExp(mgr1); | ||
if (re.test(stem)) | ||
w = stem; | ||
} | ||
else if (re2.test(w)) { | ||
var fp = re2.exec(w); | ||
stem = fp[1] + fp[2]; | ||
re2 = new RegExp(mgr1); | ||
if (re2.test(stem)) | ||
w = stem; | ||
} | ||
|
||
// Step 5 | ||
re = /^(.+?)e$/; | ||
if (re.test(w)) { | ||
var fp = re.exec(w); | ||
stem = fp[1]; | ||
re = new RegExp(mgr1); | ||
re2 = new RegExp(meq1); | ||
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); | ||
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) | ||
w = stem; | ||
} | ||
re = /ll$/; | ||
re2 = new RegExp(mgr1); | ||
if (re.test(w) && re2.test(w)) { | ||
re = /.$/; | ||
w = w.replace(re,""); | ||
} | ||
|
||
// and turn initial Y back to y | ||
if (firstch == "y") | ||
w = firstch.toLowerCase() + w.substr(1); | ||
return w; | ||
} | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.