%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/mkdocs/contrib/search/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/mkdocs/contrib/search/prebuild-index.js

var lunr = require('./templates/search/lunr'),
    stdin = process.stdin,
    stdout = process.stdout,
    buffer = [];

stdin.resume();
stdin.setEncoding('utf8');

stdin.on('data', function (data) {
  buffer.push(data);
});

stdin.on('end', function () {
  var data = JSON.parse(buffer.join('')),
      lang = ['en'];

  if (data.config) {
    if (data.config.separator && data.config.separator.length) {
      lunr.tokenizer.separator = new RegExp(data.config.separator);
    }
  }

  var idx = lunr(function () {
    if (lang.length === 1 && lang[0] !== "en" && lunr[lang[0]]) {
      this.use(lunr[lang[0]]);
    } else if (lang.length > 1) {
      this.use(lunr.multiLanguage.apply(null, lang));
    }
    this.field('title');
    this.field('text');
    this.ref('location');

    data.docs.forEach(function (doc) {
      this.add(doc);
    }, this);
  });

  stdout.write(JSON.stringify(idx));
});

Zerion Mini Shell 1.0