cjk_index 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +9 -6
- data/lib/cjk_index/jekyll.rb +11 -2
- data/lib/cjk_index/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d360872de9c0b91daee9a5c74034fbdda1f4013be23018added03567c44ce8a
|
|
4
|
+
data.tar.gz: f3629c78f9e73291d6d6f7b2697705f4b639835e5142b3897be7e17f7e861552
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82646c281e575cf065d6ec78e2f568864e795e20353f425a73931202264b7de47dc794757299adf4a42e2547a16413f7e67e1f814b8544b088984957a71dda50
|
|
7
|
+
data.tar.gz: 727c2f0aac48eedfa8f0d04bad65ce28c4b4cc918d9c1053a6a5f7a39f0505cb00603c310616b5496e87d3028caa674bcc88646e57687a5ebec8222c4b48adbe
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.2 (2026-11-14)
|
|
4
|
+
|
|
5
|
+
- Jekyll: on a CollectionBuilder site (one with `_data/config-search.csv`),
|
|
6
|
+
the `search` index with `preset: collectionbuilder` and `variants: [ja]` is
|
|
7
|
+
built by default when `_config.yml` has no `cjk_index` section (or when
|
|
8
|
+
`cjk_index` sets only options such as `variants`). Set `cjk_index: false`
|
|
9
|
+
(or `enabled: false`) to turn it off.
|
|
10
|
+
|
|
3
11
|
## 1.1.1 (2026-10-28)
|
|
4
12
|
|
|
5
13
|
- Variation selectors (U+FE00–U+FE0F and the ideographic U+E0100–U+E01EF)
|
data/README.md
CHANGED
|
@@ -39,7 +39,7 @@ even when it is an exact title. cjk_index instead:
|
|
|
39
39
|
- splits a large index into a small manifest and shards that the browser
|
|
40
40
|
fetches only when a query needs them.
|
|
41
41
|
|
|
42
|
-
The browser script is about
|
|
42
|
+
The browser script is about 11 KB gzipped with the Japanese table, 28 KB
|
|
43
43
|
with the Chinese table as well. Index it from Ruby, Jekyll, Bridgetown, a
|
|
44
44
|
Rake task or the command line.
|
|
45
45
|
|
|
@@ -256,11 +256,14 @@ lunr.js: [docs/migrating-from-lunr.md](docs/migrating-from-lunr.md).
|
|
|
256
256
|
|
|
257
257
|
### CollectionBuilder
|
|
258
258
|
|
|
259
|
+
On a CollectionBuilder site (one with `_data/config-search.csv`), adding the
|
|
260
|
+
gem to `Gemfile` is enough: `assets/cjk-index/search.json` is built by default
|
|
261
|
+
with `preset: collectionbuilder` and `variants: [ja]`. Set `cjk_index:` in
|
|
262
|
+
`_config.yml` only to change options such as `variants`:
|
|
263
|
+
|
|
259
264
|
```yaml
|
|
260
265
|
cjk_index:
|
|
261
|
-
|
|
262
|
-
- name: search
|
|
263
|
-
preset: collectionbuilder
|
|
266
|
+
variants: [ja, zh]
|
|
264
267
|
```
|
|
265
268
|
|
|
266
269
|
The preset follows CollectionBuilder's own search settings: fields with
|
|
@@ -397,8 +400,8 @@ To read such an index from another folder in Ruby, pass the normalizer:
|
|
|
397
400
|
Wide lists merge more than spelling: a list that puts 燕 with 宴 makes
|
|
398
401
|
a search for 燕 (swallow) find 宴 (banquet). Check a list against your own material first.
|
|
399
402
|
|
|
400
|
-
Browser script size, gzipped
|
|
401
|
-
|
|
403
|
+
Browser script size, gzipped (level 9, 1.1.1; KB = 1,024 bytes): no table
|
|
404
|
+
8.8 KB, `ja` 11.4 KB, `ja, zh-safe` 26.2 KB, `ja, zh` 27.8 KB, `ja, ko` 38.0 KB.
|
|
402
405
|
|
|
403
406
|
The tables are UTF-8 TSV files in `data/` ("variant<TAB>folded", an optional
|
|
404
407
|
comment column, `#` comments); `script/variant_tables.rb` generates them from
|
data/lib/cjk_index/jekyll.rb
CHANGED
|
@@ -37,6 +37,7 @@ module CJKIndex
|
|
|
37
37
|
module Jekyll
|
|
38
38
|
DEFAULT_OUTPUT = "assets/cjk-index"
|
|
39
39
|
RUNTIME_NAME = "cjk-index.js"
|
|
40
|
+
CB_DEFAULT_INDEXES = [{ "name" => "search", "preset" => "collectionbuilder" }].freeze
|
|
40
41
|
|
|
41
42
|
# A file whose content is produced at build time (no source file, no Liquid).
|
|
42
43
|
class GeneratedFile < ::Jekyll::StaticFile
|
|
@@ -61,12 +62,20 @@ module CJKIndex
|
|
|
61
62
|
|
|
62
63
|
def generate(site)
|
|
63
64
|
config = site.config["cjk_index"]
|
|
64
|
-
|
|
65
|
+
config = {} if config.nil? && site.data.key?("config-search")
|
|
66
|
+
return unless config.is_a?(Hash) && config["enabled"] != false
|
|
65
67
|
|
|
66
68
|
output = config.fetch("output", DEFAULT_OUTPUT).sub(%r{\A/+}, "").sub(%r{/+\z}, "")
|
|
67
69
|
normalizer = Normalizer.new(tables: Array(config.fetch("variants", Normalizer::DEFAULT_TABLES)), base: site.source)
|
|
68
70
|
site.static_files << GeneratedFile.new(site, output, RUNTIME_NAME, Runtime.source(normalizer: normalizer))
|
|
69
|
-
|
|
71
|
+
indexes = if config.key?("indexes")
|
|
72
|
+
Array(config["indexes"])
|
|
73
|
+
elsif site.data.key?("config-search")
|
|
74
|
+
CB_DEFAULT_INDEXES
|
|
75
|
+
else
|
|
76
|
+
[]
|
|
77
|
+
end
|
|
78
|
+
indexes.each do |spec|
|
|
70
79
|
builder = build(site, spec, normalizer)
|
|
71
80
|
if spec["split"]
|
|
72
81
|
dir = "#{output}/#{spec.fetch('name')}"
|
data/lib/cjk_index/version.rb
CHANGED