Verified Commit e0e3544c authored by Camil Staps's avatar Camil Staps 🚀

Specialize a tokenizer for snake_case and camelCase for the lunr index (resolves #9)

parent dc33a728
Pipeline #15075 passed with stage
in 1 minute and 8 seconds
# clean-doc
Generate documentation from Clean libraries
\ No newline at end of file
Generate documentation from Clean libraries
To get an idea of what this tool is capable of, for now see the documentation
on [](
var lunr_items;
var lunr_index;
var restoreSessionSettings;
// A tokenizer for snake_case and CamelCase
function lunr_programming_tokenizer(obj, metadata) {
if (obj == null || obj == undefined)
return []
if (Array.isArray(obj)) {
return (t) {
return new lunr.Token(
var str = obj
.replace(/([a-z])([A-Z])/g, '$1 $2') // camelCase
.replace(/_/g, ' '); // snake_case
return lunr.tokenizer(str);
function build_lunr(items) {
lunr_items = items;
lunr_index = lunr(function(){
this.tokenizer = lunr_programming_tokenizer;
for (var i in items) {
items[i].id = i;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment