bridgetown-quick-search 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +38 -0
- data/.rspec +2 -0
- data/.rubocop.yml +22 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +8 -0
- data/bridgetown-quick-search.gemspec +28 -0
- data/components/bridgetown_quick_search/search.liquid +12 -0
- data/content/bridgetown_quick_search/index.json +24 -0
- data/lib/bridgetown-quick-search.rb +9 -0
- data/lib/bridgetown-quick-search/version.rb +7 -0
- data/package.json +21 -0
- data/yarn.lock +32 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4d6686e8ceca29a4613749f14fbf49652cf7a7730c85054828eb8b540cf9d85e
|
4
|
+
data.tar.gz: 1c3880165136aaebc342c26af2fc27302f258d7da588f531e289f3834101c34d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8fec472845e074c35b271c8db1cb28001b47978a292b9ff8260577d5c8ae42bab88a9b9525708bd1163c3fba1fae0e2598cb8eb4ef3b3b9e0b8117e114071bc1
|
7
|
+
data.tar.gz: e7f864194b1a9e328524b61ffcc5d069920d3d08a6a02d619050027b911f426d0b6bf823aae17ec0ed9764614acfc7a42ee5cc6659daed68c1c321b5bbb9b19e
|
data/.gitignore
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
/vendor
|
2
|
+
/.bundle/
|
3
|
+
/.yardoc
|
4
|
+
/Gemfile.lock
|
5
|
+
/_yardoc/
|
6
|
+
/coverage/
|
7
|
+
/doc/
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/tmp/
|
11
|
+
*.bundle
|
12
|
+
*.so
|
13
|
+
*.o
|
14
|
+
*.a
|
15
|
+
mkmf.log
|
16
|
+
*.gem
|
17
|
+
Gemfile.lock
|
18
|
+
.bundle
|
19
|
+
.ruby-version
|
20
|
+
|
21
|
+
# Node
|
22
|
+
node_modules
|
23
|
+
.npm
|
24
|
+
.node_repl_history
|
25
|
+
|
26
|
+
# Yarn
|
27
|
+
yarn-error.log
|
28
|
+
yarn-debug.log*
|
29
|
+
.pnp/
|
30
|
+
.pnp.js
|
31
|
+
|
32
|
+
# Yarn Integrity file
|
33
|
+
.yarn-integrity
|
34
|
+
|
35
|
+
spec/dest
|
36
|
+
.bridgetown-metadata
|
37
|
+
.bridgetown-cache
|
38
|
+
.bridgetown-webpack
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require: rubocop-bridgetown
|
2
|
+
|
3
|
+
inherit_gem:
|
4
|
+
rubocop-bridgetown: .rubocop.yml
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
TargetRubyVersion: 2.5
|
8
|
+
Include:
|
9
|
+
- lib/**/*.rb
|
10
|
+
|
11
|
+
Exclude:
|
12
|
+
- .gitignore
|
13
|
+
- .rspec
|
14
|
+
- .rubocop.yml
|
15
|
+
|
16
|
+
- Gemfile.lock
|
17
|
+
- CHANGELOG.md
|
18
|
+
- LICENSE.txt
|
19
|
+
- README.md
|
20
|
+
|
21
|
+
- script/**/*
|
22
|
+
- vendor/**/*
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020-present
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Bridgetown Quick Search plugin
|
2
|
+
|
3
|
+
_Under active development...check back soon! Requires Bridgetown v0.15 or greater_
|
4
|
+
|
5
|
+
----
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Run this command to add this plugin to your site's Gemfile:
|
10
|
+
|
11
|
+
```shell
|
12
|
+
$ bundle add my-awesome-plugin -g bridgetown_plugins
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
The plugin will…
|
18
|
+
|
19
|
+
### Optional configuration options
|
20
|
+
|
21
|
+
The plugin will automatically use any of the following metadata variables if they are present in your site's `_data/site_metadata.yml` file.
|
22
|
+
|
23
|
+
…
|
24
|
+
|
25
|
+
## Testing
|
26
|
+
|
27
|
+
* Run `bundle exec rspec` to run the test suite
|
28
|
+
* Or run `script/cibuild` to validate with Rubocop and test with rspec together.
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it (https://github.com/username/my-awesome-plugin/fork)
|
33
|
+
2. Clone the fork using `git clone` to your local development machine.
|
34
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
6. Create a new Pull Request
|
38
|
+
|
39
|
+
----
|
40
|
+
|
41
|
+
## Releasing (you can delete this section in your own plugin repo)
|
42
|
+
|
43
|
+
To release a new version of the plugin, simply bump up the version number in both `version.rb` and
|
44
|
+
`package.json`, and then run `script/release`. This will require you to have a registered account
|
45
|
+
with both the [RubyGems.org](https://rubygems.org) and [NPM](https://www.npmjs.com) registries.
|
46
|
+
You can optionally remove the `package.json` and `frontend` folder if you don't need to package frontend
|
47
|
+
assets for Webpack.
|
48
|
+
|
49
|
+
If you run into any problems or need further guidance, please check out our [Bridgetown community resources](https://www.bridgetownrb.com/docs/community)
|
50
|
+
where friendly folks are standing by to help you build and release your plugin or theme.
|
51
|
+
|
52
|
+
**NOTE:** make sure you add the `bridgetown-plugin` [topic](https://github.com/topics/bridgetown-plugin) to your
|
53
|
+
plugin's GitHub repo so the plugin or theme will show up on [Bridgetown's official Plugin Directory](https://www.bridgetownrb.com/plugins)! (There may be a day or so delay before you see it appear.)
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/bridgetown-quick-search/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "bridgetown-quick-search"
|
7
|
+
spec.version = Bridgetown::QuickSearch::VERSION
|
8
|
+
spec.author = "Bridgetown Team"
|
9
|
+
spec.email = "maintainers@bridgetownrb.com"
|
10
|
+
spec.summary = "A Liquid + Web Component for Bridgetown sites which performs search queries with Lunr.js."
|
11
|
+
spec.homepage = "https://github.com/bridgetownrb/bridgetown-quick-search"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features|frontend)/!) }
|
15
|
+
spec.test_files = spec.files.grep(%r!^spec/!)
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
spec.metadata = { "yarn-add" => "bridgetown-quick-search@#{Bridgetown::QuickSearch::VERSION}" }
|
18
|
+
|
19
|
+
spec.required_ruby_version = ">= 2.5.0"
|
20
|
+
|
21
|
+
spec.add_dependency "bridgetown", ">= 0.15.0.beta1", "< 2.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "nokogiri", "~> 1.6"
|
25
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_development_dependency "rubocop-bridgetown", "~> 0.2"
|
28
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
name: Bridgetown Quick Search
|
3
|
+
variables:
|
4
|
+
input_class?: [string, Custom class(es) to apply to the search input control.]
|
5
|
+
placeholder?: [string, Placeholder text for the search input control.]
|
6
|
+
theme: [string, Dark or Light theme ("dark" or "light"). Defaults to light.]
|
7
|
+
snippet_length?: [integer, Length of the result text snippet. Defaults to 142.]
|
8
|
+
---
|
9
|
+
<bridgetown-search-form>
|
10
|
+
<input slot="input" type="search" class="{{ input_class }}" placeholder="{{ placeholder }}" />
|
11
|
+
<bridgetown-search-results {% if snippet_length %}snippetlength="{{ snippet_length }}" {% endif %}theme="{% if theme %}{{ theme }}{% endif %}"></bridgetown-search-results>
|
12
|
+
</bridgetown-search-form>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
[
|
4
|
+
{%- for document in site.documents %}
|
5
|
+
{%- if document.title %}
|
6
|
+
{%- unless document.exclude_from_search %}
|
7
|
+
{
|
8
|
+
"id": "{{ document.url | slugify }}",
|
9
|
+
"title": {{ document.title | jsonify }},
|
10
|
+
{%- if document.collection %}
|
11
|
+
"collection": {
|
12
|
+
"label": {{ document.collection.label | jsonify }},
|
13
|
+
"name": {{ document.collection.name | default: "Posts" | jsonify }}
|
14
|
+
},
|
15
|
+
{%- endif %}
|
16
|
+
"categories": {{ document.categories | join: ", " | jsonify }},
|
17
|
+
"tags": {{ document.tags | join: ", " | jsonify }},
|
18
|
+
"url": {{ document.url | jsonify }},
|
19
|
+
"content": {{ document.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }}
|
20
|
+
}{% unless forloop.last %},{% endunless %}
|
21
|
+
{%- endunless %}
|
22
|
+
{%- endif %}
|
23
|
+
{%- endfor %}
|
24
|
+
]
|
data/package.json
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"name": "bridgetown-quick-search",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"main": "frontend/javascript/index.js",
|
5
|
+
"repository": {
|
6
|
+
"type": "git",
|
7
|
+
"url": "https://github.com/bridgetownrb/bridgetown-quick-search.git"
|
8
|
+
},
|
9
|
+
"author": "Bridgetown Maintainers <maintainers@bridgetownrb.com>",
|
10
|
+
"homepage": "https://www.bridgetownrb.com",
|
11
|
+
"license": "MIT",
|
12
|
+
"private": false,
|
13
|
+
"files": [
|
14
|
+
"frontend"
|
15
|
+
],
|
16
|
+
"dependencies": {
|
17
|
+
"@babel/runtime": "^7.10.1",
|
18
|
+
"lit-element": "^2.3.1",
|
19
|
+
"lunr": "^2.3.8"
|
20
|
+
}
|
21
|
+
}
|
data/yarn.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
2
|
+
# yarn lockfile v1
|
3
|
+
|
4
|
+
|
5
|
+
"@babel/runtime@^7.10.1":
|
6
|
+
version "7.10.1"
|
7
|
+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.1.tgz#b6eb75cac279588d3100baecd1b9894ea2840822"
|
8
|
+
integrity sha512-nQbbCbQc9u/rpg1XCxoMYQTbSMVZjCDxErQ1ClCn9Pvcmv1lGads19ep0a2VsEiIJeHqjZley6EQGEC3Yo1xMA==
|
9
|
+
dependencies:
|
10
|
+
regenerator-runtime "^0.13.4"
|
11
|
+
|
12
|
+
lit-element@^2.3.1:
|
13
|
+
version "2.3.1"
|
14
|
+
resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.3.1.tgz#73343b978fa1e73d60526c6bb6ad60f53a16c343"
|
15
|
+
integrity sha512-tOcUAmeO3BzwiQ7FGWdsshNvC0HVHcTFYw/TLIImmKwXYoV0E7zCBASa8IJ7DiP4cen/Yoj454gS0qqTnIGsFA==
|
16
|
+
dependencies:
|
17
|
+
lit-html "^1.1.1"
|
18
|
+
|
19
|
+
lit-html@^1.1.1:
|
20
|
+
version "1.2.1"
|
21
|
+
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-1.2.1.tgz#1fb933dc1e2ddc095f60b8086277d4fcd9d62cc8"
|
22
|
+
integrity sha512-GSJHHXMGLZDzTRq59IUfL9FCdAlGfqNp/dEa7k7aBaaWD+JKaCjsAk9KYm2V12ItonVaYx2dprN66Zdm1AuBTQ==
|
23
|
+
|
24
|
+
lunr@^2.3.8:
|
25
|
+
version "2.3.8"
|
26
|
+
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.8.tgz#a8b89c31f30b5a044b97d2d28e2da191b6ba2072"
|
27
|
+
integrity sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg==
|
28
|
+
|
29
|
+
regenerator-runtime@^0.13.4:
|
30
|
+
version "0.13.5"
|
31
|
+
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697"
|
32
|
+
integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bridgetown-quick-search
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bridgetown Team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bridgetown
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.15.0.beta1
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.15.0.beta1
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: nokogiri
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.6'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.6'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '12.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '12.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rspec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rubocop-bridgetown
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0.2'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.2'
|
103
|
+
description:
|
104
|
+
email: maintainers@bridgetownrb.com
|
105
|
+
executables: []
|
106
|
+
extensions: []
|
107
|
+
extra_rdoc_files: []
|
108
|
+
files:
|
109
|
+
- ".gitignore"
|
110
|
+
- ".rspec"
|
111
|
+
- ".rubocop.yml"
|
112
|
+
- CHANGELOG.md
|
113
|
+
- Gemfile
|
114
|
+
- LICENSE.txt
|
115
|
+
- README.md
|
116
|
+
- Rakefile
|
117
|
+
- bridgetown-quick-search.gemspec
|
118
|
+
- components/bridgetown_quick_search/search.liquid
|
119
|
+
- content/bridgetown_quick_search/index.json
|
120
|
+
- lib/bridgetown-quick-search.rb
|
121
|
+
- lib/bridgetown-quick-search/version.rb
|
122
|
+
- package.json
|
123
|
+
- yarn.lock
|
124
|
+
homepage: https://github.com/bridgetownrb/bridgetown-quick-search
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata:
|
128
|
+
yarn-add: bridgetown-quick-search@1.0.0
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: 2.5.0
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubygems_version: 3.0.8
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: A Liquid + Web Component for Bridgetown sites which performs search queries
|
148
|
+
with Lunr.js.
|
149
|
+
test_files: []
|