From c5f7a3ef926c2b53d2412e95659eaa7e51cfcd67 Mon Sep 17 00:00:00 2001 From: Breck Yunits Date: Thu, 3 Oct 2024 04:52:21 -1000 Subject: [PATCH] Better search. #598. Thank you Zireael07 for the bug report. --- Computer.js | 18 +++++++--------- ...int-debugging-in-over-300-languages.scroll | 2 +- code/browser/client.js | 4 ++-- footer.scroll | 3 +++ header.scroll | 2 +- lists/keywords.scroll | 21 ------------------- package.json | 2 +- search.scroll | 15 +++++++++++++ searchForm.scroll | 2 +- 9 files changed, 32 insertions(+), 37 deletions(-) delete mode 100644 lists/keywords.scroll create mode 100644 search.scroll diff --git a/Computer.js b/Computer.js index 4d952faf625e..02f785cc4c6b 100644 --- a/Computer.js +++ b/Computer.js @@ -768,7 +768,7 @@ table git clone ${mainRepo}` : "" - return `import ../header.scroll + return `../header.scroll baseUrl https://pldb.io/concepts/ title ${title} - ${lodash.upperFirst(primaryTagName)} @@ -779,7 +779,7 @@ printTitle ${title} viewSourceUrl ${this.sourceUrl} -wideColumns 1 +container 800px @@ -799,7 +799,7 @@ ${this.descriptionSection} ${this.factsArray.map(fact => `- ${fact}\n inlineMarkupsOn none`).join("\n")} -
+br ${this.exampleSection} @@ -1477,18 +1477,18 @@ class Feature { const description = this.measure.Description if (description) descriptionText = `* This question asks: ${description}` - return `import header.scroll + return `header.scroll title ${title} - language feature +tags Feature printTitle ${title} -html - < - > +< +> viewSourceUrl https://github.com/breck7/pldb/blob/main/Computer.js -mediumColumns 1 +container 600px ${examplesText} @@ -1496,8 +1496,6 @@ ${examplesText} ${[positiveText, negativeText, descriptionText, explorerLinks, referencesText].filter(i => i).join("\n\n***\n\n")} -endColumns - keyboardNav ${previous.permalink} ${next.permalink} ../footer.scroll diff --git a/blog/print-debugging-in-over-300-languages.scroll b/blog/print-debugging-in-over-300-languages.scroll index 7819863e6423..faf7157bc1bc 100644 --- a/blog/print-debugging-in-over-300-languages.scroll +++ b/blog/print-debugging-in-over-300-languages.scroll @@ -3,7 +3,7 @@ authors Breck Yunits date 2022.07.15 replace PD print("debugging") tags All -title "print() debugging" in over 300 languages +title print() debugging in over 300 languages postHeader.scroll printTitle diff --git a/code/browser/client.js b/code/browser/client.js index 2cbfa88f0e14..25b7e32e600b 100644 --- a/code/browser/client.js +++ b/code/browser/client.js @@ -27,7 +27,7 @@ const initAutocomplete = elementId => { const htmlEncodedQuery = query.replace(/ { onSelect: item => { const { url, id } = item if (id) window.location = url - else window.location = normalizeUrl("/lists/explorer.html#q=" + encodeURIComponent(input.value)) + else window.location = normalizeUrl("/search.html#q=" + encodeURIComponent(input.value)) } }) } diff --git a/footer.scroll b/footer.scroll index 0f58ecbffc92..0bdaf281ba3b 100644 --- a/footer.scroll +++ b/footer.scroll @@ -17,6 +17,9 @@ stumpNoSnippet a About href BASE_URL/pages/about.html span · + a Search + href BASE_URL/search.html + span · a Keywords href BASE_URL/lists/keywords.html span · diff --git a/header.scroll b/header.scroll index 49fa1346e6dc..a6798093f19c 100644 --- a/header.scroll +++ b/header.scroll @@ -23,7 +23,7 @@ stumpNoSnippet form style display:inline-block; method get - action BASE_URL/lists/explorer.html + action BASE_URL/search.html input type search id trueBaseThemeHeaderSearch diff --git a/lists/keywords.scroll b/lists/keywords.scroll deleted file mode 100644 index d962774a42f6..000000000000 --- a/lists/keywords.scroll +++ /dev/null @@ -1,21 +0,0 @@ -replaceNodejs - const {Tables} = require("../Computer.js") - module.exports = Tables.keywordsImports -tags All -title List of all keywords used in all programming languages - -header.scroll -printTitle - -Here is the list of NUM_KEYWORDS keywords for the LANGS_WITH_KEYWORD_DATA languages that PLDB has that information. This list is case insensitive. Refer to the DB for case information. - -// - You can also download keywordsOneHot.csv which contains a one-hot encoding of this data. - link ../keywordsOneHot.csv keywordsOneHot.csv - -endSnippet - -KEYWORDS_TABLE - -footer.scroll -tableSearch diff --git a/package.json b/package.json index 51403ae4abbe..638608b751f4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "lodash": "^4.17.21", "monaco-editor": "^0.34.1", "numeral": "^2.0.6", - "scroll-cli": "^136.4.1", + "scroll-cli": "^136.11.1", "scrollsdk": "^87.0.0", "semver": "^7.6.2" }, diff --git a/search.scroll b/search.scroll new file mode 100644 index 000000000000..0df6917d7e20 --- /dev/null +++ b/search.scroll @@ -0,0 +1,15 @@ +title Search PLDB + +rootHeader.scroll + +printTitle + +// Todo: this is pretty amazing that we can just dump plain text versions of over 5,000 files in one HTML table and use DataTables to search...BUT...let's improve (make build speed faster, for example) + +container +printSearchTable blog/All features/All concepts/ +tableSearch + +endColumns + +footer.scroll diff --git a/searchForm.scroll b/searchForm.scroll index aa91e5cb212f..3b059c509e89 100644 --- a/searchForm.scroll +++ b/searchForm.scroll @@ -1,6 +1,6 @@ html
-
+