This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 43d605a  publish documentation
43d605a is described below

commit 43d605a70fdb8837d30fa352d59be7ae2c574952
Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Mar 13 16:46:41 2023 +0000

    publish documentation
---
 main/.buildinfo                  |  2 +-
 main/_static/copybutton.css      |  3 ++-
 main/_static/copybutton.js       | 42 +++++++++++++++++++++++++++++++++-------
 main/_static/copybutton_funcs.js | 17 +++++++++++++++-
 4 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/main/.buildinfo b/main/.buildinfo
index 3b0d3ef..4976088 100644
--- a/main/.buildinfo
+++ b/main/.buildinfo
@@ -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: a4fea9d671e47c1f5be9479f6a60107a
+config: e62dc7c92ea1c3a298ae1b4606960344
 tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/main/_static/copybutton.css b/main/_static/copybutton.css
index 40eafe5..f1916ec 100644
--- a/main/_static/copybutton.css
+++ b/main/_static/copybutton.css
@@ -35,7 +35,8 @@ div.highlight  {
     position: relative;
 }
 
-.highlight:hover button.copybtn {
+/* Show the copybutton */
+.highlight:hover button.copybtn, button.copybtn.success {
        opacity: 1;
 }
 
diff --git a/main/_static/copybutton.js b/main/_static/copybutton.js
index 40ac331..02c5c82 100644
--- a/main/_static/copybutton.js
+++ b/main/_static/copybutton.js
@@ -102,18 +102,25 @@ const clearSelection = () => {
   }
 }
 
-// Changes tooltip text for two seconds, then changes it back
+// Changes tooltip text for a moment, then changes it back
+// We want the timeout of our `success` class to be a bit shorter than the
+// tooltip and icon change, so that we can hide the icon before changing back.
+var timeoutIcon = 2000;
+var timeoutSuccessClass = 1500;
+
 const temporarilyChangeTooltip = (el, oldText, newText) => {
   el.setAttribute('data-tooltip', newText)
   el.classList.add('success')
-  setTimeout(() => el.setAttribute('data-tooltip', oldText), 2000)
-  setTimeout(() => el.classList.remove('success'), 2000)
+  // Remove success a little bit sooner than we change the tooltip
+  // So that we can use CSS to hide the copybutton first
+  setTimeout(() => el.classList.remove('success'), timeoutSuccessClass)
+  setTimeout(() => el.setAttribute('data-tooltip', oldText), timeoutIcon)
 }
 
 // Changes the copy button icon for two seconds, then changes it back
 const temporarilyChangeIcon = (el) => {
   el.innerHTML = iconCheck;
-  setTimeout(() => {el.innerHTML = iconCopy}, 2000)
+  setTimeout(() => {el.innerHTML = iconCopy}, timeoutIcon)
 }
 
 const addCopyButtonToCodeCells = () => {
@@ -125,7 +132,8 @@ const addCopyButtonToCodeCells = () => {
   }
 
   // Add copybuttons to all of our code cells
-  const codeCells = document.querySelectorAll('div.highlight pre')
+  const COPYBUTTON_SELECTOR = 'div.highlight pre';
+  const codeCells = document.querySelectorAll(COPYBUTTON_SELECTOR)
   codeCells.forEach((codeCell, index) => {
     const id = codeCellId(index)
     codeCell.setAttribute('id', id)
@@ -141,10 +149,25 @@ function escapeRegExp(string) {
     return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the 
whole matched string
 }
 
+/**
+ * Removes excluded text from a Node.
+ *
+ * @param {Node} target Node to filter.
+ * @param {string} exclude CSS selector of nodes to exclude.
+ * @returns {DOMString} Text from `target` with text removed.
+ */
+function filterText(target, exclude) {
+    const clone = target.cloneNode(true);  // clone as to not modify the live 
DOM
+    if (exclude) {
+        // remove excluded nodes
+        clone.querySelectorAll(exclude).forEach(node => node.remove());
+    }
+    return clone.innerText;
+}
+
 // Callback when a copy button is clicked. Will be passed the node that was 
clicked
 // should then grab the text and replace pieces of text that shouldn't be used 
in output
 function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, 
onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, 
lineContinuationChar = "", hereDocDelim = "") {
-
     var regexp;
     var match;
 
@@ -199,7 +222,12 @@ function formatCopyText(textContent, copybuttonPromptText, 
isRegexp = false, onl
 
 var copyTargetText = (trigger) => {
   var target = 
document.querySelector(trigger.attributes['data-clipboard-target'].value);
-  return formatCopyText(target.innerText, '', false, true, true, true, '', '')
+
+  // get filtered text
+  let exclude = '.linenos, .gp';
+
+  let text = filterText(target, exclude);
+  return formatCopyText(text, '', false, true, true, true, '', '')
 }
 
   // Initialize with a callback so we can modify the text before copy
diff --git a/main/_static/copybutton_funcs.js b/main/_static/copybutton_funcs.js
index b9168c5..dbe1aaa 100644
--- a/main/_static/copybutton_funcs.js
+++ b/main/_static/copybutton_funcs.js
@@ -2,10 +2,25 @@ function escapeRegExp(string) {
     return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the 
whole matched string
 }
 
+/**
+ * Removes excluded text from a Node.
+ *
+ * @param {Node} target Node to filter.
+ * @param {string} exclude CSS selector of nodes to exclude.
+ * @returns {DOMString} Text from `target` with text removed.
+ */
+export function filterText(target, exclude) {
+    const clone = target.cloneNode(true);  // clone as to not modify the live 
DOM
+    if (exclude) {
+        // remove excluded nodes
+        clone.querySelectorAll(exclude).forEach(node => node.remove());
+    }
+    return clone.innerText;
+}
+
 // Callback when a copy button is clicked. Will be passed the node that was 
clicked
 // should then grab the text and replace pieces of text that shouldn't be used 
in output
 export function formatCopyText(textContent, copybuttonPromptText, isRegexp = 
false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, 
lineContinuationChar = "", hereDocDelim = "") {
-
     var regexp;
     var match;
 

Reply via email to