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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 615a0f6d44d6e04e21f66aeb15778e39adf566ec078f11c69ceecf41473e1388
4
- data.tar.gz: 7a106a769e2cc57e382727c8ada1afbba691fbdb7620c0f487eddbe31610abf8
3
+ metadata.gz: 8d360872de9c0b91daee9a5c74034fbdda1f4013be23018added03567c44ce8a
4
+ data.tar.gz: f3629c78f9e73291d6d6f7b2697705f4b639835e5142b3897be7e17f7e861552
5
5
  SHA512:
6
- metadata.gz: 2783f62f61930fbd740261d552d7b8092b098b1e15a4fe28741b37f766b9670f5e66045c994da3bcff2b16644f28772b681b8f6fd70b28440f8dd58571e0759e
7
- data.tar.gz: c1faf175e55309bf62568d7215bee743fe7a4f0942d9621e1ad8f846e9082393dd51c38ef2ef141bdada33ce887a253d4ae533e812abe6e07cf59423901e3638
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 9 KB gzipped with the Japanese table, 24 KB
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
- indexes:
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: no table 6.3 KB, `ja` 9.0 KB, `ja, zh-safe`
401
- 24.1 KB, `ja, zh` 25.9 KB, `ja, ko` 36.1 KB.
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
@@ -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
- return unless config.is_a?(Hash)
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
- Array(config["indexes"]).each do |spec|
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')}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CJKIndex
4
- VERSION = "1.1.1"
4
+ VERSION = "1.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cjk_index
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoru Nakamura