-
Notifications
You must be signed in to change notification settings - Fork 18
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
Showing
92 changed files
with
544 additions
and
180 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: e7a1aabf92bfa9dc55e82eafd9c4285a | ||
config: d4779d43d969b5c7b9df3c864c657978 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
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
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,4 @@ | ||
singlestoredb.create\_engine | ||
============================ | ||
.. currentmodule:: singlestoredb | ||
.. autofunction:: create_engine |
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
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
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,129 @@ | ||
/* Highlighting utilities for Sphinx HTML documentation. */ | ||
"use strict"; | ||
const SPHINX_HIGHLIGHT_ENABLED = true | ||
/** | ||
* highlight a given string on a node by wrapping it in | ||
* span elements with the given class name. | ||
*/ | ||
const _highlight = (node, addItems, text, className) => { | ||
if (node.nodeType === Node.TEXT_NODE) { | ||
const val = node.nodeValue; | ||
const parent = node.parentNode; | ||
const pos = val.toLowerCase().indexOf(text); | ||
if ( | ||
pos >= 0 && | ||
!parent.classList.contains(className) && | ||
!parent.classList.contains("nohighlight") | ||
) { | ||
let span; | ||
const closestNode = parent.closest("body, svg, foreignObject"); | ||
const isInSVG = closestNode && closestNode.matches("svg"); | ||
if (isInSVG) { | ||
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); | ||
} else { | ||
span = document.createElement("span"); | ||
span.classList.add(className); | ||
} | ||
span.appendChild(document.createTextNode(val.substr(pos, text.length))); | ||
parent.insertBefore( | ||
span, | ||
parent.insertBefore( | ||
document.createTextNode(val.substr(pos + text.length)), | ||
node.nextSibling | ||
) | ||
); | ||
node.nodeValue = val.substr(0, pos); | ||
if (isInSVG) { | ||
const rect = document.createElementNS( | ||
"http://www.w3.org/2000/svg", | ||
"rect" | ||
); | ||
const bbox = parent.getBBox(); | ||
rect.x.baseVal.value = bbox.x; | ||
rect.y.baseVal.value = bbox.y; | ||
rect.width.baseVal.value = bbox.width; | ||
rect.height.baseVal.value = bbox.height; | ||
rect.setAttribute("class", className); | ||
addItems.push({ parent: parent, target: rect }); | ||
} | ||
} | ||
} else if (node.matches && !node.matches("button, select, textarea")) { | ||
node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); | ||
} | ||
}; | ||
const _highlightText = (thisNode, text, className) => { | ||
let addItems = []; | ||
_highlight(thisNode, addItems, text, className); | ||
addItems.forEach((obj) => | ||
obj.parent.insertAdjacentElement("beforebegin", obj.target) | ||
); | ||
}; | ||
/** | ||
* Small JavaScript module for the documentation. | ||
*/ | ||
const SphinxHighlight = { | ||
/** | ||
* highlight the search words provided in localstorage in the text | ||
*/ | ||
highlightSearchWords: () => { | ||
if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight | ||
// get and clear terms from localstorage | ||
const url = new URL(window.location); | ||
const highlight = | ||
localStorage.getItem("sphinx_highlight_terms") | ||
|| url.searchParams.get("highlight") | ||
|| ""; | ||
localStorage.removeItem("sphinx_highlight_terms") | ||
url.searchParams.delete("highlight"); | ||
window.history.replaceState({}, "", url); | ||
// get individual terms from highlight string | ||
const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); | ||
if (terms.length === 0) return; // nothing to do | ||
// There should never be more than one element matching "div.body" | ||
const divBody = document.querySelectorAll("div.body"); | ||
const body = divBody.length ? divBody[0] : document.querySelector("body"); | ||
window.setTimeout(() => { | ||
terms.forEach((term) => _highlightText(body, term, "highlighted")); | ||
}, 10); | ||
const searchBox = document.getElementById("searchbox"); | ||
if (searchBox === null) return; | ||
searchBox.appendChild( | ||
document | ||
.createRange() | ||
.createContextualFragment( | ||
'<p class="highlight-link">' + | ||
'<a href="javascript:SphinxHighlight.hideSearchWords()">' + | ||
_("Hide Search Matches") + | ||
"</a></p>" | ||
) | ||
); | ||
}, | ||
/** | ||
* helper function to hide the search marks again | ||
*/ | ||
hideSearchWords: () => { | ||
document | ||
.querySelectorAll("#searchbox .highlight-link") | ||
.forEach((el) => el.remove()); | ||
document | ||
.querySelectorAll("span.highlighted") | ||
.forEach((el) => el.classList.remove("highlighted")); | ||
localStorage.removeItem("sphinx_highlight_terms") | ||
}, | ||
initEscapeListener: () => { | ||
// only install a listener if it is really needed | ||
if (!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.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; | ||
if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { | ||
SphinxHighlight.hideSearchWords(); | ||
event.preventDefault(); | ||
} | ||
}); | ||
}, | ||
}; | ||
_ready(SphinxHighlight.highlightSearchWords); | ||
_ready(SphinxHighlight.initEscapeListener); |
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
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
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
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
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
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
Oops, something went wrong.