Skip to content

Commit

Permalink
crsearch.json: JSONPに対応
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jun 5, 2022
1 parent f697e94 commit 187bfd5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ boostjp/boostjp.relative/
settings.*.cache

/crsearch.json/crsearch.json
/crsearch.json/crsearch.js
/cpprefjp/static/static/kunai
/cpprefjp/static/static/crsearch/*

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ popd
mkdir -p cpprefjp/static/static/crsearch
pushd cpprefjp/static/static/crsearch
ln -s ../../../../crsearch.json/crsearch.json crsearch.json
ln -s ../../../../crsearch.json/crsearch.js crsearch.js # Optional (ローカル file:///... で閲覧する場合に必要)
popd

# site_generator 用の docker イメージを生成する
Expand Down
5 changes: 4 additions & 1 deletion crsearch.json/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,11 @@ def main():
paths = chain.from_iterable([get_files(d) for d in _KNOWN_DIRS])
all_paths = list(get_files('site'))
result = Generator().generate('site', paths, all_paths)
crsearch_json = json.dumps(result, separators=(',', ':'), ensure_ascii=False, sort_keys=True)
with open('crsearch.json', 'wb') as f:
f.write(json.dumps(result, separators=(',', ':'), ensure_ascii=False, sort_keys=True).encode('utf-8'))
f.write(crsearch_json.encode('utf-8'))
with open('crsearch.js', 'wb') as f:
f.write(('callback(%s)' % crsearch_json).encode('utf-8'))


if __name__ == '__main__':
Expand Down

0 comments on commit 187bfd5

Please sign in to comment.