brockfanning / docpad-plugin-lunr

Adds support for client-side search with Lunr, full-text and faceted.
MIT License
8 stars 7 forks source link

Wrong script markup being generated #9

Open derberg opened 9 years ago

derberg commented 9 years ago

Hi,

I think one loop in the https://github.com/brockfanning/docpad-plugin-lunr/blob/master/out/lunrdoc.js must be changed.

In my project I'm getting the following html markup generated to reference scripts:

<script src="/lunr/lunr.min.js" type="text/javascript"></script>
<script src="/lunr/lunr-data-myindex.js" type="text/javascript"></script>
<script src="/lunr/lunr-ui.min.js" type="text/javascript"></script>
<script src="/lunr/function () {
    var key, output, value, _i, _ref, _results;
    output = {};
    for (key = _i = 0, _ref = this.length; 0 &lt;= _ref ? _i &lt; _ref : _i &gt; _ref; key = 0 &lt;= _ref ? ++_i : --_i) {
      output[this[key]] = this[key];
    }
    _results = [];
    for (key in output) {
      value = output[key];
      _results.push(value);
    }
    return _results;
  }" type="text/javascript"></script>

obviously the 4th element is wrong. I suggest to change the for loop in lunrdoc.js file in line 227 instead of:

for (var i in scripts)

should be

for (var i = 0; i<scripts.length; i++)