| 1 | #!/usr/bin/env ysh
|
| 2 |
|
| 3 | # Usage:
|
| 4 | #
|
| 5 | # $0 index
|
| 6 |
|
| 7 | proc index-all(...files;; baseDir) {
|
| 8 | for file in (files) {
|
| 9 | echo Indexing $file >&2
|
| 10 | doctools/search_index.py --base-dir $baseDir $file
|
| 11 | }
|
| 12 | }
|
| 13 |
|
| 14 | proc parse-jsonl(; place) {
|
| 15 | var index = []
|
| 16 | for line in (io.stdin) {
|
| 17 | var parsed = fromJson(line)
|
| 18 | call index->extend(parsed)
|
| 19 | }
|
| 20 |
|
| 21 | call place->setValue(index)
|
| 22 | }
|
| 23 |
|
| 24 | proc index() {
|
| 25 | index-all _release/VERSION/doc/{*,ref/*}.html (baseDir='_release/VERSION') | parse-jsonl (&indices)
|
| 26 | json write (indices) > _release/VERSION/index.json
|
| 27 | }
|
| 28 |
|
| 29 | runproc @ARGV
|