Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions docs/cn/_/css/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
border: none;
max-width: 600px;
min-width: 500px;
box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.2), 0 2px 3px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 0 0 rgb(0 0 0 / 20%), 0 2px 3px 0 rgb(0 0 0 / 10%);
}

@media screen and (max-width: 768px) {
Expand Down Expand Up @@ -73,12 +73,12 @@
}

.search-result-document-hit > a:hover {
background-color: rgba(69, 142, 225, 0.05);
background-color: rgb(69 142 225 / 5%);
}

.search-result-document-hit .search-result-highlight {
color: #174d8c;
background: rgba(143, 187, 237, 0.1);
background: rgb(143 187 237 / 10%);
padding: 0.1em 0.05em;
font-weight: 500;
}
Expand All @@ -90,6 +90,14 @@
margin-bottom: 0.25em;
}

.search-result-document-hit .search-result-keywords {
margin-top: 0.25em;
}

.search-result-document-hit .search-result-keywords-field-label {
font-weight: bold;
}

#search-input {
padding: 0.25em;
}
Expand All @@ -103,13 +111,13 @@
}

#search-field .filter {
background: #fff linear-gradient(180deg,#e1e1e1 0,#e1e1e1) no-repeat 0/1px 50%;
background: #fff linear-gradient(180deg, #e1e1e1 0, #e1e1e1) no-repeat 0 / 1px 50%;
border: 1px solid #e1e1e1;
border-left: none;
border-radius: 0 0.1em 0.1em 0;
color: #5d5d5d;
cursor: pointer;
font-size: .875em;
font-size: 0.875em;
display: flex;
align-items: center;
padding: 0 0.5rem;
Expand Down
123 changes: 76 additions & 47 deletions docs/cn/_/js/search-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,29 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.antoraSearch = {}));
})(this, (function (exports) { 'use strict';

/**
* Splitting the text by the given positions.
* The text within the positions getting the type "mark", all other text gets the type "text".
* @param {string} text
* @param {Object[]} positions
* @param {number} positions.start
* @param {number} positions.length
* @param {number} snippetLength Maximum text length for text in the result.
* @returns {[{text: string, type: string}]}
*/
function buildHighlightedText (text, positions, snippetLength) {
const textLength = text.length;
const validPositions = positions
.filter((position) => position.length > 0 && position.start + position.length <= textLength);
const validPositions = positions.filter(
(position) => position.length > 0 && position.start + position.length <= textLength
);

if (validPositions.length === 0) {
return [
{
type: 'text',
text: text.slice(0, snippetLength >= textLength ? textLength : snippetLength) + (snippetLength < textLength ? '...' : ''),
text:
text.slice(0, snippetLength >= textLength ? textLength : snippetLength) +
(snippetLength < textLength ? '...' : ''),
},
]
}
Expand All @@ -40,8 +53,9 @@
});
}
let lastEndPosition = 0;
const positionsWithinRange = orderedPositions
.filter((position) => position.start >= range.start && position.start + position.length <= range.end);
const positionsWithinRange = orderedPositions.filter(
(position) => position.start >= range.start && position.start + position.length <= range.end
);

for (const position of positionsWithinRange) {
const start = position.start;
Expand Down Expand Up @@ -79,29 +93,20 @@
*/
function findTermPosition (lunr, term, text) {
const str = text.toLowerCase();
const len = str.length;

for (let sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) {
const char = str.charAt(sliceEnd);
const sliceLength = sliceEnd - sliceStart;

if ((char.match(lunr.tokenizer.separator) || sliceEnd === len)) {
if (sliceLength > 0) {
const value = str.slice(sliceStart, sliceEnd);
// QUESTION: if we get an exact match without running the pipeline should we stop?
if (value.includes(term)) {
// returns the first match
return {
start: sliceStart,
length: value.length,
}
}
const index = str.indexOf(term);

if (index >= 0) {
// extend term until word boundary to return the entire word
const boundaries = str.substr(index).match(/^[\p{Alpha}]+/u);
if (boundaries !== null && boundaries.length >= 0) {
return {
start: index,
length: boundaries[0].length,
}
sliceStart = sliceEnd + 1;
}
}

// not found!
// Not found
return {
start: 0,
length: 0,
Expand Down Expand Up @@ -142,6 +147,15 @@
return []
}

function highlightKeyword (doc, terms) {
const keyword = doc.keyword;
if (keyword) {
const positions = getTermPosition(keyword, terms);
return buildHighlightedText(keyword, positions, snippetLength)
}
return []
}

function highlightText (doc, terms) {
const text = doc.text;
const positions = getTermPosition(text, terms);
Expand Down Expand Up @@ -172,6 +186,7 @@
pageTitleNodes: highlightPageTitle(doc.title, terms.title || []),
sectionTitleNodes: highlightSectionTitle(sectionTitle, terms.title || []),
pageContentNodes: highlightText(doc, terms.text || []),
pageKeywordNodes: highlightKeyword(doc, terms.keyword || []),
}
}

Expand Down Expand Up @@ -227,29 +242,24 @@
const documentSectionTitle = document.createElement('div');
documentSectionTitle.classList.add('search-result-section-title');
documentHitLink.appendChild(documentSectionTitle);
highlightingResult.sectionTitleNodes.forEach(function (node) {
let element;
if (node.type === 'text') {
element = document.createTextNode(node.text);
} else {
element = document.createElement('span');
element.classList.add('search-result-highlight');
element.innerText = node.text;
}
documentSectionTitle.appendChild(element);
});
highlightingResult.sectionTitleNodes.forEach((node) => createHighlightedText(node, documentSectionTitle));
}
highlightingResult.pageContentNodes.forEach((node) => createHighlightedText(node, documentHitLink));

// only show keyword when we got a hit on them
if (doc.keyword && highlightingResult.pageKeywordNodes.length > 1) {
const documentKeywords = document.createElement('div');
documentKeywords.classList.add('search-result-keywords');
const documentKeywordsFieldLabel = document.createElement('span');
documentKeywordsFieldLabel.classList.add('search-result-keywords-field-label');
documentKeywordsFieldLabel.innerText = 'keywords: ';
const documentKeywordsList = document.createElement('span');
documentKeywordsList.classList.add('search-result-keywords-list');
highlightingResult.pageKeywordNodes.forEach((node) => createHighlightedText(node, documentKeywordsList));
documentKeywords.appendChild(documentKeywordsFieldLabel);
documentKeywords.appendChild(documentKeywordsList);
documentHitLink.appendChild(documentKeywords);
}
highlightingResult.pageContentNodes.forEach(function (node) {
let element;
if (node.type === 'text') {
element = document.createTextNode(node.text);
} else {
element = document.createElement('span');
element.classList.add('search-result-highlight');
element.innerText = node.text;
}
documentHitLink.appendChild(element);
});
const searchResultItem = document.createElement('div');
searchResultItem.classList.add('search-result-item');
searchResultItem.appendChild(documentTitle);
Expand All @@ -260,6 +270,25 @@
return searchResultItem
}

/**
* Creates an element from a highlightingResultNode and add it to the targetNode.
* @param {Object} highlightingResultNode
* @param {String} highlightingResultNode.type - type of the node
* @param {String} highlightingResultNode.text
* @param {Node} targetNode
*/
function createHighlightedText (highlightingResultNode, targetNode) {
let element;
if (highlightingResultNode.type === 'text') {
element = document.createTextNode(highlightingResultNode.text);
} else {
element = document.createElement('span');
element.classList.add('search-result-highlight');
element.innerText = highlightingResultNode.text;
}
targetNode.appendChild(element);
}

function createNoResult (text) {
const searchResultItem = document.createElement('div');
searchResultItem.classList.add('search-result-item');
Expand All @@ -278,7 +307,7 @@
}

function filter (result, documents) {
const facetFilter = facetFilterInput && facetFilterInput.checked && facetFilterInput.dataset.facetFilter;
const facetFilter = facetFilterInput?.checked && facetFilterInput.dataset.facetFilter;
if (facetFilter) {
const [field, value] = facetFilter.split(':');
return result.filter((item) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/cn/_/js/vendor/lunr-languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
* only CommonJS-like environments that support module.exports,
* like Node.
*/
module.exports = factory(require('nodejieba'))
module.exports = factory(require('@node-rs/jieba'))
} else {
// Browser globals (root is window)
factory()(root.lunr);
Expand Down
6 changes: 3 additions & 3 deletions docs/cn/_/js/vendor/lunr.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/cn/ivorysql-doc/v1.0/v1.0/11.html
Original file line number Diff line number Diff line change
Expand Up @@ -6546,7 +6546,7 @@ <h4 id="环境-14"><a class="anchor" href="#环境-14"></a>2.18.4. 环境</h4>
</ul>
</div>
<div class="paragraph">
<p>当 <code>\e</code>、 <code>\ef</code> 或者 <code>\ev</code> 带有一个行号参数时,这个变量指定用于传递起始行号给用户编辑器的命令行参数。对于Emacs或者vi之类的编辑器,这个变量是一个加号。如果需要在选项名称和行号之间有空格,可以在该变量的值中包括一个结尾的空格。例如: <code>PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' ` 在 Unix 系统上默认是 `+</code> (对应于默认编辑器 <code>vi</code> ,且对很多其他常见编辑器可用)。在 Windows 系统上没有默认值。</p>
<p>当 <code>\e</code>、 <code>\ef</code> 或者 <code>\ev</code> 带有一个行号参数时,这个变量指定用于传递起始行号给用户编辑器的命令行参数。对于Emacs或者vi之类的编辑器,这个变量是一个加号。如果需要在选项名称和行号之间有空格,可以在该变量的值中包括一个结尾的空格。例如: <code>PSQL_EDITOR_LINENUMBER_ARG='' PSQL_EDITOR_LINENUMBER_ARG='--line ' ` 在 Unix 系统上默认是 `</code> (对应于默认编辑器 <code>vi</code> ,且对很多其他常见编辑器可用)。在 Windows 系统上没有默认值。</p>
</div>
<div class="ulist">
<ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/cn/ivorysql-doc/v1.1/v1.1/11.html
Original file line number Diff line number Diff line change
Expand Up @@ -6546,7 +6546,7 @@ <h4 id="环境-14"><a class="anchor" href="#环境-14"></a>2.18.4. 环境</h4>
</ul>
</div>
<div class="paragraph">
<p>当 <code>\e</code>、 <code>\ef</code> 或者 <code>\ev</code> 带有一个行号参数时,这个变量指定用于传递起始行号给用户编辑器的命令行参数。对于Emacs或者vi之类的编辑器,这个变量是一个加号。如果需要在选项名称和行号之间有空格,可以在该变量的值中包括一个结尾的空格。例如: <code>PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' ` 在 Unix 系统上默认是 `+</code> (对应于默认编辑器 <code>vi</code> ,且对很多其他常见编辑器可用)。在 Windows 系统上没有默认值。</p>
<p>当 <code>\e</code>、 <code>\ef</code> 或者 <code>\ev</code> 带有一个行号参数时,这个变量指定用于传递起始行号给用户编辑器的命令行参数。对于Emacs或者vi之类的编辑器,这个变量是一个加号。如果需要在选项名称和行号之间有空格,可以在该变量的值中包括一个结尾的空格。例如: <code>PSQL_EDITOR_LINENUMBER_ARG='' PSQL_EDITOR_LINENUMBER_ARG='--line ' ` 在 Unix 系统上默认是 `</code> (对应于默认编辑器 <code>vi</code> ,且对很多其他常见编辑器可用)。在 Windows 系统上没有默认值。</p>
</div>
<div class="ulist">
<ul>
Expand Down
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/10.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/11.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/12.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/13.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/14.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/15.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/16.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/17.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/7.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/8.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/9.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/p1.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/p18.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/p19.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/p2.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/p3.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/p4.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/p5.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/cn/ivorysql-doc/v1.17/_images/p6.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions docs/cn/ivorysql-doc/v1.17/v1.17/3.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ <h3 id="入门指南"><a class="anchor" href="#入门指南"></a>1.1. 入门指
<div class="sect3">
<h4 id="新用户指南"><a class="anchor" href="#新用户指南"></a>1.1.1. 新用户指南</h4>
<div class="paragraph">
<p>如果您刚开始接触IvorySQL,您可以访问我们的 <a href="https://docs.ivorysql.org/cn/ivorysql-doc/beta/beta/1">地址</a>来初步了解IvorySQL的各项特性。您同样可以前往我们的 <a href="https://github.com/IvorySQL/IvorySQL">Github</a>将我们的项目源代码下载到您的终端中。</p>
</div>
<div class="paragraph">
<p>如果您想快速安装IvorySQL并且进行一些数据库体验,您可以参考如下:</p>
</div>
<div class="paragraph">
Expand All @@ -235,19 +232,20 @@ <h4 id="新用户指南"><a class="anchor" href="#新用户指南"></a>1.1.1.
</div>
</div>
<div class="paragraph">
<p><strong>使用git命令下载项目源代码</strong></p>
<p><strong>使用wget命令下载项目源代码</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-asciidoc hljs" data-lang="asciidoc">[highgo@ivorysql ~]$ git clone https://github.com/IvorySQL/IvorySQL.git</code></pre>
<pre class="highlightjs highlight"><code class="language-asciidoc hljs" data-lang="asciidoc">[highgo@ivorysql ~]$ wget https://github.com/IvorySQL/IvorySQL/archive/refs/tags/IvorySQL_1.17.tar.gz
[highgo@ivorysql ~]$ tar -zxvf IvorySQL_1.17.tar.gz</code></pre>
</div>
</div>
<div class="paragraph">
<p><strong>进入下载好的项目目录中</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-asciidoc hljs" data-lang="asciidoc">[highgo@ivorysql ~]$ ls
<pre class="highlightjs highlight"><code class="language-asciidoc hljs" data-lang="asciidoc">[highgo@ivorysql ~]$ mv IvorySQL-IvorySQL_1.17 IvorySQL; ls
IvorySQL
[highgo@ivorysql ~]$ cd IvorySQL/</code></pre>
</div>
Expand Down
Loading