appscms-tools-theme 0.4.0 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -21
  3. data/README.md +52 -52
  4. data/_data/{pages → about/en}/about.json +6 -7
  5. data/_data/blog/alertbar.yml +3 -3
  6. data/_data/blog/authors.yml +11 -11
  7. data/_data/blog/blog.yml +3 -3
  8. data/_data/blog/nav.json +13 -13
  9. data/_data/blog/share.yml +29 -29
  10. data/_data/{pages → contact/en}/contact.json +7 -7
  11. data/_data/feature/en/compress-pdf.json +79 -77
  12. data/_data/feature/en/split-pdf.json +81 -0
  13. data/_data/feature/hi/compress-pdf.json +29 -29
  14. data/_data/footer/en/data.json +84 -84
  15. data/_data/header/en/data.json +136 -58
  16. data/_data/{pages → help/en}/help.json +6 -7
  17. data/_data/home/en/en.json +48 -0
  18. data/_data/home/hi.json +31 -31
  19. data/_data/{pages → termAndCondition/en}/termAndCondition.json +7 -7
  20. data/_includes/author_bio.html +11 -11
  21. data/_includes/custom-head.html +29 -33
  22. data/_includes/disqus_comments.html +10 -10
  23. data/_includes/footer/index.html +53 -75
  24. data/_includes/head/index.html +30 -46
  25. data/_includes/header/blogHeader.html +31 -34
  26. data/_includes/header/index.html +54 -117
  27. data/_includes/paginationBlogPage.html +34 -34
  28. data/_includes/paginationPostPage.html +14 -14
  29. data/_includes/postbox.html +37 -32
  30. data/_includes/script.html +4 -4
  31. data/_includes/section/alertbar.html +11 -11
  32. data/_includes/section/count.html +23 -23
  33. data/_includes/share/socialshare.html +19 -0
  34. data/_layouts/aboutUs.html +17 -24
  35. data/_layouts/blog.html +71 -75
  36. data/_layouts/categories.html +24 -24
  37. data/_layouts/contactUs.html +17 -23
  38. data/_layouts/default.html +1 -1
  39. data/_layouts/feature.html +119 -137
  40. data/_layouts/help.html +18 -23
  41. data/_layouts/home.html +40 -44
  42. data/_layouts/page.html +5 -5
  43. data/_layouts/post.html +63 -68
  44. data/_layouts/termAndCondition.html +17 -23
  45. data/assets/cross.svg +4 -4
  46. data/assets/css/blog.css +464 -464
  47. data/assets/css/tools.css +1336 -1170
  48. data/assets/facebook.svg +4 -4
  49. data/assets/instagram.svg +4 -4
  50. data/assets/js/TopScroll.js +8 -9
  51. data/assets/linkdin.svg +4 -4
  52. data/assets/pdf.svg +20 -20
  53. data/assets/star.svg +4 -4
  54. data/assets/twitter.svg +4 -4
  55. data/assets/youtube.svg +4 -4
  56. metadata +13 -16
  57. data/_data/home/en.json +0 -48
  58. data/_includes/search-lunr.html +0 -16
  59. data/_includes/uploader/index.html +0 -69
  60. data/assets/js/lunr.js +0 -2977
  61. data/assets/js/lunrsearchengine.js +0 -89
data/assets/facebook.svg CHANGED
@@ -1,5 +1,5 @@
1
- <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="M18 4.63h-2.397c-1.69 0-2.182.65-2.182 1.897v2.52h4.395l-.584 3.901H13.42V23H8.81V12.948H5V9.047h3.81V6.175C8.81 2.897 11.117 1 14.559 1c1.444 0 2.612.054 3.442.135v3.496z">
4
- </path>
1
+ <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
+ <path
3
+ d="M18 4.63h-2.397c-1.69 0-2.182.65-2.182 1.897v2.52h4.395l-.584 3.901H13.42V23H8.81V12.948H5V9.047h3.81V6.175C8.81 2.897 11.117 1 14.559 1c1.444 0 2.612.054 3.442.135v3.496z">
4
+ </path>
5
5
  </svg>
data/assets/instagram.svg CHANGED
@@ -1,5 +1,5 @@
1
- <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="M12 2.982c2.937 0 3.285.011 4.445.064 1.072.05 1.655.228 2.043.379.513.2.88.438 1.264.823.385.385.624.751.823 1.265.15.387.33.97.379 2.042.053 1.16.064 1.508.064 4.445 0 2.937-.011 3.285-.064 4.445-.05 1.072-.228 1.655-.379 2.043-.2.513-.438.88-.823 1.264a3.408 3.408 0 01-1.264.823c-.388.15-.97.33-2.043.379-1.16.053-1.508.064-4.445.064-2.937 0-3.285-.011-4.445-.064-1.072-.049-1.655-.228-2.042-.379-.514-.2-.88-.438-1.265-.823a3.408 3.408 0 01-.823-1.264c-.15-.388-.33-.97-.379-2.043-.053-1.16-.064-1.508-.064-4.445 0-2.937.011-3.285.064-4.445.049-1.072.228-1.655.379-2.042.2-.514.438-.88.823-1.265a3.408 3.408 0 011.265-.823c.387-.15.97-.33 2.042-.379 1.16-.053 1.508-.064 4.445-.064zM12 1c-2.987 0-3.362.013-4.535.066-1.171.054-1.97.24-2.67.512a5.392 5.392 0 00-1.949 1.268 5.392 5.392 0 00-1.269 1.949c-.271.7-.457 1.499-.51 2.67C1.012 8.638 1 9.013 1 12c0 2.988.013 3.362.066 4.535.054 1.171.24 1.97.511 2.67a5.392 5.392 0 001.27 1.949 5.392 5.392 0 001.948 1.268c.7.273 1.499.458 2.67.512C8.638 22.987 9.013 23 12 23s3.362-.013 4.535-.066c1.171-.054 1.97-.24 2.67-.512a5.391 5.391 0 001.949-1.268 5.391 5.391 0 001.268-1.948c.272-.7.458-1.5.512-2.67.053-1.174.066-1.549.066-4.536 0-2.987-.013-3.362-.066-4.535-.054-1.171-.24-1.97-.512-2.67a5.39 5.39 0 00-1.268-1.949 5.391 5.391 0 00-1.949-1.268c-.7-.272-1.499-.458-2.67-.512C15.362 1.013 14.987 1 12 1zm0 5.351a5.649 5.649 0 100 11.298A5.649 5.649 0 0012 6.35zm0 9.316a3.667 3.667 0 110-7.334 3.667 3.667 0 010 7.334zm7.192-9.539a1.32 1.32 0 11-2.64 0 1.32 1.32 0 012.64 0z">
4
- </path>
1
+ <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
+ <path
3
+ d="M12 2.982c2.937 0 3.285.011 4.445.064 1.072.05 1.655.228 2.043.379.513.2.88.438 1.264.823.385.385.624.751.823 1.265.15.387.33.97.379 2.042.053 1.16.064 1.508.064 4.445 0 2.937-.011 3.285-.064 4.445-.05 1.072-.228 1.655-.379 2.043-.2.513-.438.88-.823 1.264a3.408 3.408 0 01-1.264.823c-.388.15-.97.33-2.043.379-1.16.053-1.508.064-4.445.064-2.937 0-3.285-.011-4.445-.064-1.072-.049-1.655-.228-2.042-.379-.514-.2-.88-.438-1.265-.823a3.408 3.408 0 01-.823-1.264c-.15-.388-.33-.97-.379-2.043-.053-1.16-.064-1.508-.064-4.445 0-2.937.011-3.285.064-4.445.049-1.072.228-1.655.379-2.042.2-.514.438-.88.823-1.265a3.408 3.408 0 011.265-.823c.387-.15.97-.33 2.042-.379 1.16-.053 1.508-.064 4.445-.064zM12 1c-2.987 0-3.362.013-4.535.066-1.171.054-1.97.24-2.67.512a5.392 5.392 0 00-1.949 1.268 5.392 5.392 0 00-1.269 1.949c-.271.7-.457 1.499-.51 2.67C1.012 8.638 1 9.013 1 12c0 2.988.013 3.362.066 4.535.054 1.171.24 1.97.511 2.67a5.392 5.392 0 001.27 1.949 5.392 5.392 0 001.948 1.268c.7.273 1.499.458 2.67.512C8.638 22.987 9.013 23 12 23s3.362-.013 4.535-.066c1.171-.054 1.97-.24 2.67-.512a5.391 5.391 0 001.949-1.268 5.391 5.391 0 001.268-1.948c.272-.7.458-1.5.512-2.67.053-1.174.066-1.549.066-4.536 0-2.987-.013-3.362-.066-4.535-.054-1.171-.24-1.97-.512-2.67a5.39 5.39 0 00-1.268-1.949 5.391 5.391 0 00-1.949-1.268c-.7-.272-1.499-.458-2.67-.512C15.362 1.013 14.987 1 12 1zm0 5.351a5.649 5.649 0 100 11.298A5.649 5.649 0 0012 6.35zm0 9.316a3.667 3.667 0 110-7.334 3.667 3.667 0 010 7.334zm7.192-9.539a1.32 1.32 0 11-2.64 0 1.32 1.32 0 012.64 0z">
4
+ </path>
5
5
  </svg>
@@ -1,9 +1,8 @@
1
- const alertbar = document.querySelector('.alertbar')
2
- window.addEventListener('scroll', () => {
3
- if (pageYOffset > 200) {
4
- alertbar.style.display = 'block'
5
- } else {
6
- alertbar.style.display = 'none'
7
- }
8
- })
9
- //
1
+ const alertbar = document.querySelector('.alertbar')
2
+ window.addEventListener('scroll', () => {
3
+ if (pageYOffset > 200) {
4
+ alertbar.style.display = 'block'
5
+ } else {
6
+ alertbar.style.display = 'none'
7
+ }
8
+ })
data/assets/linkdin.svg CHANGED
@@ -1,5 +1,5 @@
1
- <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="M23 23h-5.118v-7.339c0-1.92-.8-3.232-2.561-3.232-1.347 0-2.096.885-2.444 1.738-.131.306-.11.732-.11 1.159V23H7.695s.065-13 0-14.182h5.07v2.226c.3-.973 1.92-2.362 4.506-2.362 3.208 0 5.728 2.04 5.728 6.432V23zM3.38 6.773h-.03C1.926 6.773 1 5.72 1 4.388 1 3.03 1.952 2 3.407 2 4.86 2 5.754 3.027 5.783 4.384c0 1.333-.923 2.389-2.404 2.389zM1 8.682h4.783V23H1V8.682z">
4
- </path>
1
+ <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
+ <path
3
+ d="M23 23h-5.118v-7.339c0-1.92-.8-3.232-2.561-3.232-1.347 0-2.096.885-2.444 1.738-.131.306-.11.732-.11 1.159V23H7.695s.065-13 0-14.182h5.07v2.226c.3-.973 1.92-2.362 4.506-2.362 3.208 0 5.728 2.04 5.728 6.432V23zM3.38 6.773h-.03C1.926 6.773 1 5.72 1 4.388 1 3.03 1.952 2 3.407 2 4.86 2 5.754 3.027 5.783 4.384c0 1.333-.923 2.389-2.404 2.389zM1 8.682h4.783V23H1V8.682z">
4
+ </path>
5
5
  </svg>
data/assets/pdf.svg CHANGED
@@ -1,20 +1,20 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="300" height="180" viewBox="0 0 300 180">
2
- <path fill="#F23030" d="M120.99998,19.9999941 L191,20 L215,44 L215,92.7006568 L210,100.778943 L215,108.591421 L210,115.323885 L215,122.91687 L215,137.99999 C215,139.104559 214.104569,139.99999 213,139.99999 L120.99998,139.99999 C119.895411,139.99999 118.99998,139.104559 118.99998,137.99999 C118.99998,137.99999 118.99998,137.99999 118.99998,137.99999 L118.999982,70.6028877 L123.999982,62.598128 L118.999982,56.3413748 L123.999982,49.7409964 L118.999982,44.5417978 L118.99998,21.9999939 C118.99998,20.8954244 119.895411,19.9999938 120.99998,19.9999938 C120.99998,19.9999938 120.99998,19.9999938 120.99998,19.9999938 Z"/>
3
- <path fill="#FFFFFF" d="M191,20 L215,44 L192,44 C191.447715,44 191,43.5522847 191,43 L191,20 Z" opacity=".3"/>
4
- <rect width="60" height="2" x="137" y="72" fill="#FFFFFF"/>
5
- <rect width="60" height="4" x="137" y="58" fill="#FFFFFF"/>
6
- <rect width="60" height="2" x="137" y="84" fill="#FFFFFF"/>
7
- <rect width="26" height="2" x="171" y="96" fill="#FFFFFF"/>
8
- <rect width="26" height="2" x="171" y="108" fill="#FFFFFF"/>
9
- <rect width="26" height="2" x="171" y="120" fill="#FFFFFF"/>
10
- <path fill="#BF2626" d="M110,95 L164,95 C164.552285,95 165,95.4477153 165,96 L165,122 C165,122.552285 164.552285,123 164,123 L110,123 C109.447715,123 109,122.552285 109,122 L109,96 C109,95.4477153 109.447715,95 110,95 Z"/>
11
- <path fill="#FFFFFF" fill-rule="nonzero" d="M118,116 L118,100 L122.886392,100 C126.325843,100 128.88764,101.223242 128.88764,104.941896 C128.88764,108.489297 126.325843,110.12844 122.981273,110.12844 L120.751561,110.12844 L120.751561,116 L118,116 Z M120.751561,107.853211 L122.76779,107.853211 C125.068664,107.853211 126.183521,106.899083 126.183521,104.941896 C126.183521,102.93578 124.973783,102.275229 122.672909,102.275229 L120.751561,102.275229 L120.751561,107.853211 Z M131.805243,116 L131.805243,100 L135.956305,100 C140.700375,100 143.499376,102.642202 143.499376,107.926606 C143.499376,113.235474 140.700375,116 136.098627,116 L131.805243,116 Z M134.556804,113.700306 L135.766542,113.700306 C138.897628,113.700306 140.676654,111.865443 140.676654,107.926606 C140.676654,104.012232 138.897628,102.299694 135.766542,102.299694 L134.556804,102.299694 L134.556804,113.700306 Z M146.630462,116 L146.630462,100 L156,100 L156,102.397554 L149.382022,102.397554 L149.382022,106.923547 L155.027466,106.923547 L155.027466,109.321101 L149.382022,109.321101 L149.382022,116 L146.630462,116 Z"/>
12
- <path fill="#BF2626" d="M93.2157613,143 L158,143 L158,146 L131.75,152 L88,152 L88,158 L93.515549,158 C95.1300717,155.588029 97.8795839,154 101,154 C105.970563,154 110,158.029437 110,163 C110,167.970563 105.970563,172 101,172 C97.4662787,172 94.4082222,169.963437 92.9355196,167 L73.0644804,167 C71.5917778,169.963437 68.5337213,172 65,172 C60.0294373,172 56,167.970563 56,163 C56,158.029437 60.0294373,154 65,154 C68.1204161,154 70.8699283,155.588029 72.484451,158 L79,158 L79,148.174114 L76.6155464,149.041984 C75.5775906,149.419769 74.4299059,148.884595 74.0521209,147.846639 L72.6840403,144.087869 C72.3062553,143.049913 72.8414294,141.902228 73.8793852,141.524443 L92.6732377,134.68404 C93.7111935,134.306255 94.8588782,134.841429 95.2366632,135.879385 L96.6047438,139.638156 C96.9825288,140.676112 96.4473546,141.823796 95.4093988,142.201581 L93.2157613,143 Z M88,17 L88,22.3849597 L92.6732377,20.6840403 C93.7111935,20.3062553 94.8588782,20.8414294 95.2366632,21.8793852 L96.6047438,25.6381557 C96.9825288,26.6761115 96.4473546,27.8237962 95.4093988,28.2015813 L76.6155464,35.0419841 C75.5775906,35.4197691 74.4299059,34.884595 74.0521209,33.8466392 L72.6840403,30.0878687 C72.3062553,29.0499129 72.8414294,27.9022282 73.8793852,27.5244432 L79,25.6606918 L79,8 L88,8 L131.75,8 L158,14 L158,17 L88,17 Z M73.8793852,40.1911098 L92.6732377,33.350707 C93.7111935,32.9729219 94.8588782,33.5080961 95.2366632,34.5460519 L96.6047438,38.3048224 C96.9825288,39.3427782 96.4473546,40.4904629 95.4093988,40.8682479 L76.6155464,47.7086508 C75.5775906,48.0864358 74.4299059,47.5512616 74.0521209,46.5133058 L72.6840403,42.7545353 C72.3062553,41.7165795 72.8414294,40.5688948 73.8793852,40.1911098 Z M73.8793852,52.8577765 L92.6732377,46.0173736 C93.7111935,45.6395886 94.8588782,46.1747628 95.2366632,47.2127186 L96.6047438,50.9714891 C96.9825288,52.0094449 96.4473546,53.1571296 95.4093988,53.5349146 L76.6155464,60.3753175 C75.5775906,60.7531025 74.4299059,60.2179283 74.0521209,59.1799725 L72.6840403,55.421202 C72.3062553,54.3832462 72.8414294,53.2355615 73.8793852,52.8577765 Z M73.8793852,65.5244432 L92.6732377,58.6840403 C93.7111935,58.3062553 94.8588782,58.8414294 95.2366632,59.8793852 L96.6047438,63.6381557 C96.9825288,64.6761115 96.4473546,65.8237962 95.4093988,66.2015813 L76.6155464,73.0419841 C75.5775906,73.4197691 74.4299059,72.884595 74.0521209,71.8466392 L72.6840403,68.0878687 C72.3062553,67.0499129 72.8414294,65.9022282 73.8793852,65.5244432 Z M73.8793852,78.1911098 L92.6732377,71.350707 C93.7111935,70.9729219 94.8588782,71.5080961 95.2366632,72.5460519 L96.6047438,76.3048224 C96.9825288,77.3427782 96.4473546,78.4904629 95.4093988,78.8682479 L76.6155464,85.7086508 C75.5775906,86.0864358 74.4299059,85.5512616 74.0521209,84.5133058 L72.6840403,80.7545353 C72.3062553,79.7165795 72.8414294,78.5688948 73.8793852,78.1911098 Z M73.8793852,90.8577765 L92.6732377,84.0173736 C93.7111935,83.6395886 94.8588782,84.1747628 95.2366632,85.2127186 L96.6047438,88.9714891 C96.9825288,90.0094449 96.4473546,91.1571296 95.4093988,91.5349146 L76.6155464,98.3753175 C75.5775906,98.7531025 74.4299059,98.2179283 74.0521209,97.1799725 L72.6840403,93.421202 C72.3062553,92.3832462 72.8414294,91.2355615 73.8793852,90.8577765 Z M73.8793852,103.524443 L92.6732377,96.6840403 C93.7111935,96.3062553 94.8588782,96.8414294 95.2366632,97.8793852 L96.6047438,101.638156 C96.9825288,102.676112 96.4473546,103.823796 95.4093988,104.201581 L76.6155464,111.041984 C75.5775906,111.419769 74.4299059,110.884595 74.0521209,109.846639 L72.6840403,106.087869 C72.3062553,105.049913 72.8414294,103.902228 73.8793852,103.524443 Z M73.8793852,116.19111 L92.6732377,109.350707 C93.7111935,108.972922 94.8588782,109.508096 95.2366632,110.546052 L96.6047438,114.304822 C96.9825288,115.342778 96.4473546,116.490463 95.4093988,116.868248 L76.6155464,123.708651 C75.5775906,124.086436 74.4299059,123.551262 74.0521209,122.513306 L72.6840403,118.754535 C72.3062553,117.71658 72.8414294,116.568895 73.8793852,116.19111 Z M73.8793852,128.857776 L92.6732377,122.017374 C93.7111935,121.639589 94.8588782,122.174763 95.2366632,123.212719 L96.6047438,126.971489 C96.9825288,128.009445 96.4473546,129.15713 95.4093988,129.534915 L76.6155464,136.375317 C75.5775906,136.753102 74.4299059,136.217928 74.0521209,135.179972 L72.6840403,131.421202 C72.3062553,130.383246 72.8414294,129.235562 73.8793852,128.857776 Z"/>
13
- <path fill="#F23030" fill-rule="nonzero" d="M222 151C222.552285 151 223 150.552285 223 150 223 149.447715 222.552285 149 222 149 221.447715 149 221 149.447715 221 150 221 150.552285 221.447715 151 222 151zM222 152C220.895431 152 220 151.104569 220 150 220 148.895431 220.895431 148 222 148 223.104569 148 224 148.895431 224 150 224 151.104569 223.104569 152 222 152zM50 136C50.5522847 136 51 135.552285 51 135 51 134.447715 50.5522847 134 50 134 49.4477153 134 49 134.447715 49 135 49 135.552285 49.4477153 136 50 136zM50 137C48.8954305 137 48 136.104569 48 135 48 133.895431 48.8954305 133 50 133 51.1045695 133 52 133.895431 52 135 52 136.104569 51.1045695 137 50 137z"/>
14
- <polygon fill="#F23030" points="232 137 232 135 233 135 233 137 235 137 235 138 233 138 233 140 232 140 232 138 230 138 230 137"/>
15
- <path fill="#F23030" fill-rule="nonzero" d="M38,35 C38.5522847,35 39,34.5522847 39,34 C39,33.4477153 38.5522847,33 38,33 C37.4477153,33 37,33.4477153 37,34 C37,34.5522847 37.4477153,35 38,35 Z M38,36 C36.8954305,36 36,35.1045695 36,34 C36,32.8954305 36.8954305,32 38,32 C39.1045695,32 40,32.8954305 40,34 C40,35.1045695 39.1045695,36 38,36 Z"/>
16
- <path fill="#F23030" fill-rule="nonzero" d="M55.8062676 17.1937324C56.0645775 17.4520422 56.0645775 17.8708451 55.8062676 18.1291549L54.4031338 19.5322887C54.144824 19.7905985 53.7260211 19.7905985 53.4677113 19.5322887 53.2094015 19.2739789 53.2094015 18.855176 53.4677113 18.5968662L54.8708451 17.1937324C55.1291549 16.9354225 55.5479578 16.9354225 55.8062676 17.1937324L55.8062676 17.1937324zM52.5322887 20.4677113C52.7905985 20.7260211 52.7905985 21.144824 52.5322887 21.4031338L51.1291549 22.8062676C50.8708451 23.0645775 50.4520422 23.0645775 50.1937324 22.8062676 49.9354225 22.5479578 49.9354225 22.1291549 50.1937324 21.8708451L51.5968662 20.4677113C51.855176 20.2094015 52.2739789 20.2094015 52.5322887 20.4677113zM55.8062676 22.8062676C55.5479578 23.0645775 55.1291549 23.0645775 54.8708451 22.8062676L53.4677113 21.4031338C53.2094015 21.144824 53.2094015 20.7260211 53.4677113 20.4677113 53.7260211 20.2094015 54.144824 20.2094015 54.4031338 20.4677113L55.8062676 21.8708451C56.0645775 22.1291549 56.0645775 22.5479578 55.8062676 22.8062676zM52.5322887 19.5322887C52.2739789 19.7905985 51.855176 19.7905985 51.5968662 19.5322887L50.1937324 18.1291549C49.9354225 17.8708451 49.9354225 17.4520422 50.1937324 17.1937324 50.4520422 16.9354225 50.8708451 16.9354225 51.1291549 17.1937324L52.5322887 18.5968662C52.7905985 18.855176 52.7905985 19.2739789 52.5322887 19.5322887zM43.8062676 113.193732C44.0645775 113.452042 44.0645775 113.870845 43.8062676 114.129155L42.4031338 115.532289C42.144824 115.790599 41.7260211 115.790599 41.4677113 115.532289 41.2094015 115.273979 41.2094015 114.855176 41.4677113 114.596866L42.8708451 113.193732C43.1291549 112.935423 43.5479578 112.935423 43.8062676 113.193732L43.8062676 113.193732zM40.5322887 116.467711C40.7905985 116.726021 40.7905985 117.144824 40.5322887 117.403134L39.1291549 118.806268C38.8708451 119.064577 38.4520422 119.064577 38.1937324 118.806268 37.9354225 118.547958 37.9354225 118.129155 38.1937324 117.870845L39.5968662 116.467711C39.855176 116.209401 40.2739789 116.209401 40.5322887 116.467711zM43.8062676 118.806268C43.5479578 119.064577 43.1291549 119.064577 42.8708451 118.806268L41.4677113 117.403134C41.2094015 117.144824 41.2094015 116.726021 41.4677113 116.467711 41.7260211 116.209401 42.144824 116.209401 42.4031338 116.467711L43.8062676 117.870845C44.0645775 118.129155 44.0645775 118.547958 43.8062676 118.806268zM40.5322887 115.532289C40.2739789 115.790599 39.855176 115.790599 39.5968662 115.532289L38.1937324 114.129155C37.9354225 113.870845 37.9354225 113.452042 38.1937324 113.193732 38.4520422 112.935423 38.8708451 112.935423 39.1291549 113.193732L40.5322887 114.596866C40.7905985 114.855176 40.7905985 115.273979 40.5322887 115.532289z"/>
17
- <polygon fill="#212121" points="212 21.5 217.5 16 219 17.5 213.5 23 217 23 217 25 210 25 210 18 212 18"/>
18
- <path fill="#F23030" fill-rule="nonzero" d="M241.806268,67.1937324 C242.064577,67.4520422 242.064577,67.8708451 241.806268,68.1291549 L240.403134,69.5322887 C240.144824,69.7905985 239.726021,69.7905985 239.467711,69.5322887 C239.209401,69.2739789 239.209401,68.855176 239.467711,68.5968662 L240.870845,67.1937324 C241.129155,66.9354225 241.547958,66.9354225 241.806268,67.1937324 L241.806268,67.1937324 Z M238.532289,70.4677113 C238.790599,70.7260211 238.790599,71.144824 238.532289,71.4031338 L237.129155,72.8062676 C236.870845,73.0645775 236.452042,73.0645775 236.193732,72.8062676 C235.935423,72.5479578 235.935423,72.1291549 236.193732,71.8708451 L237.596866,70.4677113 C237.855176,70.2094015 238.273979,70.2094015 238.532289,70.4677113 Z M241.806268,72.8062676 C241.547958,73.0645775 241.129155,73.0645775 240.870845,72.8062676 L239.467711,71.4031338 C239.209401,71.144824 239.209401,70.7260211 239.467711,70.4677113 C239.726021,70.2094015 240.144824,70.2094015 240.403134,70.4677113 L241.806268,71.8708451 C242.064577,72.1291549 242.064577,72.5479578 241.806268,72.8062676 Z M238.532289,69.5322887 C238.273979,69.7905985 237.855176,69.7905985 237.596866,69.5322887 L236.193732,68.1291549 C235.935423,67.8708451 235.935423,67.4520422 236.193732,67.1937324 C236.452042,66.9354225 236.870845,66.9354225 237.129155,67.1937324 L238.532289,68.5968662 C238.790599,68.855176 238.790599,69.2739789 238.532289,69.5322887 Z"/>
19
- <path fill="#F23030" fill-rule="nonzero" d="M251,86 C251.552285,86 252,85.5522847 252,85 C252,84.4477153 251.552285,84 251,84 C250.447715,84 250,84.4477153 250,85 C250,85.5522847 250.447715,86 251,86 Z M251,87 C249.895431,87 249,86.1045695 249,85 C249,83.8954305 249.895431,83 251,83 C252.104569,83 253,83.8954305 253,85 C253,86.1045695 252.104569,87 251,87 Z"/>
20
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="300" height="180" viewBox="0 0 300 180">
2
+ <path fill="#F23030" d="M120.99998,19.9999941 L191,20 L215,44 L215,92.7006568 L210,100.778943 L215,108.591421 L210,115.323885 L215,122.91687 L215,137.99999 C215,139.104559 214.104569,139.99999 213,139.99999 L120.99998,139.99999 C119.895411,139.99999 118.99998,139.104559 118.99998,137.99999 C118.99998,137.99999 118.99998,137.99999 118.99998,137.99999 L118.999982,70.6028877 L123.999982,62.598128 L118.999982,56.3413748 L123.999982,49.7409964 L118.999982,44.5417978 L118.99998,21.9999939 C118.99998,20.8954244 119.895411,19.9999938 120.99998,19.9999938 C120.99998,19.9999938 120.99998,19.9999938 120.99998,19.9999938 Z"/>
3
+ <path fill="#FFFFFF" d="M191,20 L215,44 L192,44 C191.447715,44 191,43.5522847 191,43 L191,20 Z" opacity=".3"/>
4
+ <rect width="60" height="2" x="137" y="72" fill="#FFFFFF"/>
5
+ <rect width="60" height="4" x="137" y="58" fill="#FFFFFF"/>
6
+ <rect width="60" height="2" x="137" y="84" fill="#FFFFFF"/>
7
+ <rect width="26" height="2" x="171" y="96" fill="#FFFFFF"/>
8
+ <rect width="26" height="2" x="171" y="108" fill="#FFFFFF"/>
9
+ <rect width="26" height="2" x="171" y="120" fill="#FFFFFF"/>
10
+ <path fill="#BF2626" d="M110,95 L164,95 C164.552285,95 165,95.4477153 165,96 L165,122 C165,122.552285 164.552285,123 164,123 L110,123 C109.447715,123 109,122.552285 109,122 L109,96 C109,95.4477153 109.447715,95 110,95 Z"/>
11
+ <path fill="#FFFFFF" fill-rule="nonzero" d="M118,116 L118,100 L122.886392,100 C126.325843,100 128.88764,101.223242 128.88764,104.941896 C128.88764,108.489297 126.325843,110.12844 122.981273,110.12844 L120.751561,110.12844 L120.751561,116 L118,116 Z M120.751561,107.853211 L122.76779,107.853211 C125.068664,107.853211 126.183521,106.899083 126.183521,104.941896 C126.183521,102.93578 124.973783,102.275229 122.672909,102.275229 L120.751561,102.275229 L120.751561,107.853211 Z M131.805243,116 L131.805243,100 L135.956305,100 C140.700375,100 143.499376,102.642202 143.499376,107.926606 C143.499376,113.235474 140.700375,116 136.098627,116 L131.805243,116 Z M134.556804,113.700306 L135.766542,113.700306 C138.897628,113.700306 140.676654,111.865443 140.676654,107.926606 C140.676654,104.012232 138.897628,102.299694 135.766542,102.299694 L134.556804,102.299694 L134.556804,113.700306 Z M146.630462,116 L146.630462,100 L156,100 L156,102.397554 L149.382022,102.397554 L149.382022,106.923547 L155.027466,106.923547 L155.027466,109.321101 L149.382022,109.321101 L149.382022,116 L146.630462,116 Z"/>
12
+ <path fill="#BF2626" d="M93.2157613,143 L158,143 L158,146 L131.75,152 L88,152 L88,158 L93.515549,158 C95.1300717,155.588029 97.8795839,154 101,154 C105.970563,154 110,158.029437 110,163 C110,167.970563 105.970563,172 101,172 C97.4662787,172 94.4082222,169.963437 92.9355196,167 L73.0644804,167 C71.5917778,169.963437 68.5337213,172 65,172 C60.0294373,172 56,167.970563 56,163 C56,158.029437 60.0294373,154 65,154 C68.1204161,154 70.8699283,155.588029 72.484451,158 L79,158 L79,148.174114 L76.6155464,149.041984 C75.5775906,149.419769 74.4299059,148.884595 74.0521209,147.846639 L72.6840403,144.087869 C72.3062553,143.049913 72.8414294,141.902228 73.8793852,141.524443 L92.6732377,134.68404 C93.7111935,134.306255 94.8588782,134.841429 95.2366632,135.879385 L96.6047438,139.638156 C96.9825288,140.676112 96.4473546,141.823796 95.4093988,142.201581 L93.2157613,143 Z M88,17 L88,22.3849597 L92.6732377,20.6840403 C93.7111935,20.3062553 94.8588782,20.8414294 95.2366632,21.8793852 L96.6047438,25.6381557 C96.9825288,26.6761115 96.4473546,27.8237962 95.4093988,28.2015813 L76.6155464,35.0419841 C75.5775906,35.4197691 74.4299059,34.884595 74.0521209,33.8466392 L72.6840403,30.0878687 C72.3062553,29.0499129 72.8414294,27.9022282 73.8793852,27.5244432 L79,25.6606918 L79,8 L88,8 L131.75,8 L158,14 L158,17 L88,17 Z M73.8793852,40.1911098 L92.6732377,33.350707 C93.7111935,32.9729219 94.8588782,33.5080961 95.2366632,34.5460519 L96.6047438,38.3048224 C96.9825288,39.3427782 96.4473546,40.4904629 95.4093988,40.8682479 L76.6155464,47.7086508 C75.5775906,48.0864358 74.4299059,47.5512616 74.0521209,46.5133058 L72.6840403,42.7545353 C72.3062553,41.7165795 72.8414294,40.5688948 73.8793852,40.1911098 Z M73.8793852,52.8577765 L92.6732377,46.0173736 C93.7111935,45.6395886 94.8588782,46.1747628 95.2366632,47.2127186 L96.6047438,50.9714891 C96.9825288,52.0094449 96.4473546,53.1571296 95.4093988,53.5349146 L76.6155464,60.3753175 C75.5775906,60.7531025 74.4299059,60.2179283 74.0521209,59.1799725 L72.6840403,55.421202 C72.3062553,54.3832462 72.8414294,53.2355615 73.8793852,52.8577765 Z M73.8793852,65.5244432 L92.6732377,58.6840403 C93.7111935,58.3062553 94.8588782,58.8414294 95.2366632,59.8793852 L96.6047438,63.6381557 C96.9825288,64.6761115 96.4473546,65.8237962 95.4093988,66.2015813 L76.6155464,73.0419841 C75.5775906,73.4197691 74.4299059,72.884595 74.0521209,71.8466392 L72.6840403,68.0878687 C72.3062553,67.0499129 72.8414294,65.9022282 73.8793852,65.5244432 Z M73.8793852,78.1911098 L92.6732377,71.350707 C93.7111935,70.9729219 94.8588782,71.5080961 95.2366632,72.5460519 L96.6047438,76.3048224 C96.9825288,77.3427782 96.4473546,78.4904629 95.4093988,78.8682479 L76.6155464,85.7086508 C75.5775906,86.0864358 74.4299059,85.5512616 74.0521209,84.5133058 L72.6840403,80.7545353 C72.3062553,79.7165795 72.8414294,78.5688948 73.8793852,78.1911098 Z M73.8793852,90.8577765 L92.6732377,84.0173736 C93.7111935,83.6395886 94.8588782,84.1747628 95.2366632,85.2127186 L96.6047438,88.9714891 C96.9825288,90.0094449 96.4473546,91.1571296 95.4093988,91.5349146 L76.6155464,98.3753175 C75.5775906,98.7531025 74.4299059,98.2179283 74.0521209,97.1799725 L72.6840403,93.421202 C72.3062553,92.3832462 72.8414294,91.2355615 73.8793852,90.8577765 Z M73.8793852,103.524443 L92.6732377,96.6840403 C93.7111935,96.3062553 94.8588782,96.8414294 95.2366632,97.8793852 L96.6047438,101.638156 C96.9825288,102.676112 96.4473546,103.823796 95.4093988,104.201581 L76.6155464,111.041984 C75.5775906,111.419769 74.4299059,110.884595 74.0521209,109.846639 L72.6840403,106.087869 C72.3062553,105.049913 72.8414294,103.902228 73.8793852,103.524443 Z M73.8793852,116.19111 L92.6732377,109.350707 C93.7111935,108.972922 94.8588782,109.508096 95.2366632,110.546052 L96.6047438,114.304822 C96.9825288,115.342778 96.4473546,116.490463 95.4093988,116.868248 L76.6155464,123.708651 C75.5775906,124.086436 74.4299059,123.551262 74.0521209,122.513306 L72.6840403,118.754535 C72.3062553,117.71658 72.8414294,116.568895 73.8793852,116.19111 Z M73.8793852,128.857776 L92.6732377,122.017374 C93.7111935,121.639589 94.8588782,122.174763 95.2366632,123.212719 L96.6047438,126.971489 C96.9825288,128.009445 96.4473546,129.15713 95.4093988,129.534915 L76.6155464,136.375317 C75.5775906,136.753102 74.4299059,136.217928 74.0521209,135.179972 L72.6840403,131.421202 C72.3062553,130.383246 72.8414294,129.235562 73.8793852,128.857776 Z"/>
13
+ <path fill="#F23030" fill-rule="nonzero" d="M222 151C222.552285 151 223 150.552285 223 150 223 149.447715 222.552285 149 222 149 221.447715 149 221 149.447715 221 150 221 150.552285 221.447715 151 222 151zM222 152C220.895431 152 220 151.104569 220 150 220 148.895431 220.895431 148 222 148 223.104569 148 224 148.895431 224 150 224 151.104569 223.104569 152 222 152zM50 136C50.5522847 136 51 135.552285 51 135 51 134.447715 50.5522847 134 50 134 49.4477153 134 49 134.447715 49 135 49 135.552285 49.4477153 136 50 136zM50 137C48.8954305 137 48 136.104569 48 135 48 133.895431 48.8954305 133 50 133 51.1045695 133 52 133.895431 52 135 52 136.104569 51.1045695 137 50 137z"/>
14
+ <polygon fill="#F23030" points="232 137 232 135 233 135 233 137 235 137 235 138 233 138 233 140 232 140 232 138 230 138 230 137"/>
15
+ <path fill="#F23030" fill-rule="nonzero" d="M38,35 C38.5522847,35 39,34.5522847 39,34 C39,33.4477153 38.5522847,33 38,33 C37.4477153,33 37,33.4477153 37,34 C37,34.5522847 37.4477153,35 38,35 Z M38,36 C36.8954305,36 36,35.1045695 36,34 C36,32.8954305 36.8954305,32 38,32 C39.1045695,32 40,32.8954305 40,34 C40,35.1045695 39.1045695,36 38,36 Z"/>
16
+ <path fill="#F23030" fill-rule="nonzero" d="M55.8062676 17.1937324C56.0645775 17.4520422 56.0645775 17.8708451 55.8062676 18.1291549L54.4031338 19.5322887C54.144824 19.7905985 53.7260211 19.7905985 53.4677113 19.5322887 53.2094015 19.2739789 53.2094015 18.855176 53.4677113 18.5968662L54.8708451 17.1937324C55.1291549 16.9354225 55.5479578 16.9354225 55.8062676 17.1937324L55.8062676 17.1937324zM52.5322887 20.4677113C52.7905985 20.7260211 52.7905985 21.144824 52.5322887 21.4031338L51.1291549 22.8062676C50.8708451 23.0645775 50.4520422 23.0645775 50.1937324 22.8062676 49.9354225 22.5479578 49.9354225 22.1291549 50.1937324 21.8708451L51.5968662 20.4677113C51.855176 20.2094015 52.2739789 20.2094015 52.5322887 20.4677113zM55.8062676 22.8062676C55.5479578 23.0645775 55.1291549 23.0645775 54.8708451 22.8062676L53.4677113 21.4031338C53.2094015 21.144824 53.2094015 20.7260211 53.4677113 20.4677113 53.7260211 20.2094015 54.144824 20.2094015 54.4031338 20.4677113L55.8062676 21.8708451C56.0645775 22.1291549 56.0645775 22.5479578 55.8062676 22.8062676zM52.5322887 19.5322887C52.2739789 19.7905985 51.855176 19.7905985 51.5968662 19.5322887L50.1937324 18.1291549C49.9354225 17.8708451 49.9354225 17.4520422 50.1937324 17.1937324 50.4520422 16.9354225 50.8708451 16.9354225 51.1291549 17.1937324L52.5322887 18.5968662C52.7905985 18.855176 52.7905985 19.2739789 52.5322887 19.5322887zM43.8062676 113.193732C44.0645775 113.452042 44.0645775 113.870845 43.8062676 114.129155L42.4031338 115.532289C42.144824 115.790599 41.7260211 115.790599 41.4677113 115.532289 41.2094015 115.273979 41.2094015 114.855176 41.4677113 114.596866L42.8708451 113.193732C43.1291549 112.935423 43.5479578 112.935423 43.8062676 113.193732L43.8062676 113.193732zM40.5322887 116.467711C40.7905985 116.726021 40.7905985 117.144824 40.5322887 117.403134L39.1291549 118.806268C38.8708451 119.064577 38.4520422 119.064577 38.1937324 118.806268 37.9354225 118.547958 37.9354225 118.129155 38.1937324 117.870845L39.5968662 116.467711C39.855176 116.209401 40.2739789 116.209401 40.5322887 116.467711zM43.8062676 118.806268C43.5479578 119.064577 43.1291549 119.064577 42.8708451 118.806268L41.4677113 117.403134C41.2094015 117.144824 41.2094015 116.726021 41.4677113 116.467711 41.7260211 116.209401 42.144824 116.209401 42.4031338 116.467711L43.8062676 117.870845C44.0645775 118.129155 44.0645775 118.547958 43.8062676 118.806268zM40.5322887 115.532289C40.2739789 115.790599 39.855176 115.790599 39.5968662 115.532289L38.1937324 114.129155C37.9354225 113.870845 37.9354225 113.452042 38.1937324 113.193732 38.4520422 112.935423 38.8708451 112.935423 39.1291549 113.193732L40.5322887 114.596866C40.7905985 114.855176 40.7905985 115.273979 40.5322887 115.532289z"/>
17
+ <polygon fill="#212121" points="212 21.5 217.5 16 219 17.5 213.5 23 217 23 217 25 210 25 210 18 212 18"/>
18
+ <path fill="#F23030" fill-rule="nonzero" d="M241.806268,67.1937324 C242.064577,67.4520422 242.064577,67.8708451 241.806268,68.1291549 L240.403134,69.5322887 C240.144824,69.7905985 239.726021,69.7905985 239.467711,69.5322887 C239.209401,69.2739789 239.209401,68.855176 239.467711,68.5968662 L240.870845,67.1937324 C241.129155,66.9354225 241.547958,66.9354225 241.806268,67.1937324 L241.806268,67.1937324 Z M238.532289,70.4677113 C238.790599,70.7260211 238.790599,71.144824 238.532289,71.4031338 L237.129155,72.8062676 C236.870845,73.0645775 236.452042,73.0645775 236.193732,72.8062676 C235.935423,72.5479578 235.935423,72.1291549 236.193732,71.8708451 L237.596866,70.4677113 C237.855176,70.2094015 238.273979,70.2094015 238.532289,70.4677113 Z M241.806268,72.8062676 C241.547958,73.0645775 241.129155,73.0645775 240.870845,72.8062676 L239.467711,71.4031338 C239.209401,71.144824 239.209401,70.7260211 239.467711,70.4677113 C239.726021,70.2094015 240.144824,70.2094015 240.403134,70.4677113 L241.806268,71.8708451 C242.064577,72.1291549 242.064577,72.5479578 241.806268,72.8062676 Z M238.532289,69.5322887 C238.273979,69.7905985 237.855176,69.7905985 237.596866,69.5322887 L236.193732,68.1291549 C235.935423,67.8708451 235.935423,67.4520422 236.193732,67.1937324 C236.452042,66.9354225 236.870845,66.9354225 237.129155,67.1937324 L238.532289,68.5968662 C238.790599,68.855176 238.790599,69.2739789 238.532289,69.5322887 Z"/>
19
+ <path fill="#F23030" fill-rule="nonzero" d="M251,86 C251.552285,86 252,85.5522847 252,85 C252,84.4477153 251.552285,84 251,84 C250.447715,84 250,84.4477153 250,85 C250,85.5522847 250.447715,86 251,86 Z M251,87 C249.895431,87 249,86.1045695 249,85 C249,83.8954305 249.895431,83 251,83 C252.104569,83 253,83.8954305 253,85 C253,86.1045695 252.104569,87 251,87 Z"/>
20
+ </svg>
data/assets/star.svg CHANGED
@@ -1,5 +1,5 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 36 36" fill="#fff">
2
- <path
3
- d="M6,6 L9,18 L6,30 L18,27 L30,30 L27,18 L30,6 L18,9 L6,6 Z M3,3 L18,6.75 L33,3 L29.25,18 L33,33 L18,29.25 L3,33 L6.75,18 L3,3 Z">
4
- </path>
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 36 36" fill="#fff">
2
+ <path
3
+ d="M6,6 L9,18 L6,30 L18,27 L30,30 L27,18 L30,6 L18,9 L6,6 Z M3,3 L18,6.75 L33,3 L29.25,18 L33,33 L18,29.25 L3,33 L6.75,18 L3,3 Z">
4
+ </path>
5
5
  </svg>
data/assets/twitter.svg CHANGED
@@ -1,5 +1,5 @@
1
- <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="M20.436 5.83c.92-.552 1.6-1.437 1.994-2.498-.854.508-1.862.884-2.936 1.105A4.286 4.286 0 0016.251 3c-2.52 0-4.558 1.99-4.558 4.533 0 .376.088.686.132 1.084A13.15 13.15 0 012.534 3.84c-.416.664-.614 1.438-.614 2.3 0 1.548.767 2.941 2.016 3.76a4.737 4.737 0 01-2.06-.598v.067c0 2.189 1.556 4.046 3.616 4.466-.35.089-.789.177-1.183.177-.285 0-.614-.066-.877-.088.592 1.813 2.28 3.162 4.23 3.184-1.49 1.216-3.485 1.924-5.61 1.924-.35 0-.745 0-1.052-.022C2.994 20.314 5.382 21 7.946 21c8.261 0 12.84-6.9 12.84-12.936 0-.155 0-.376-.021-.597A9.469 9.469 0 0023 5.1c-.767.376-1.665.597-2.564.73z">
4
- </path>
1
+ <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
+ <path
3
+ d="M20.436 5.83c.92-.552 1.6-1.437 1.994-2.498-.854.508-1.862.884-2.936 1.105A4.286 4.286 0 0016.251 3c-2.52 0-4.558 1.99-4.558 4.533 0 .376.088.686.132 1.084A13.15 13.15 0 012.534 3.84c-.416.664-.614 1.438-.614 2.3 0 1.548.767 2.941 2.016 3.76a4.737 4.737 0 01-2.06-.598v.067c0 2.189 1.556 4.046 3.616 4.466-.35.089-.789.177-1.183.177-.285 0-.614-.066-.877-.088.592 1.813 2.28 3.162 4.23 3.184-1.49 1.216-3.485 1.924-5.61 1.924-.35 0-.745 0-1.052-.022C2.994 20.314 5.382 21 7.946 21c8.261 0 12.84-6.9 12.84-12.936 0-.155 0-.376-.021-.597A9.469 9.469 0 0023 5.1c-.767.376-1.665.597-2.564.73z">
4
+ </path>
5
5
  </svg>
data/assets/youtube.svg CHANGED
@@ -1,5 +1,5 @@
1
- <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd"
3
- d="M21.38 4.48A2.94 2.94 0 0123.5 6.5c.5 1.78.5 5.5.5 5.5s0 3.72-.5 5.5a2.94 2.94 0 01-2.12 2.02C19.5 20 12 20 12 20s-7.5 0-9.38-.48A2.94 2.94 0 01.5 17.5C0 15.72 0 12 0 12s0-3.72.5-5.5a2.94 2.94 0 012.12-2.02C4.5 4 12 4 12 4s7.5 0 9.38.48zM17 12l-8 4V8l8 4z">
4
- </path>
1
+ <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd"
3
+ d="M21.38 4.48A2.94 2.94 0 0123.5 6.5c.5 1.78.5 5.5.5 5.5s0 3.72-.5 5.5a2.94 2.94 0 01-2.12 2.02C19.5 20 12 20 12 20s-7.5 0-9.38-.48A2.94 2.94 0 01.5 17.5C0 15.72 0 12 0 12s0-3.72.5-5.5a2.94 2.94 0 012.12-2.02C4.5 4 12 4 12 4s7.5 0 9.38.48zM17 12l-8 4V8l8 4z">
4
+ </path>
5
5
  </svg>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appscms-tools-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - vivek-appscms
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2021-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '12.0'
55
- description:
55
+ description:
56
56
  email:
57
57
  - vivek@appscms.com
58
58
  executables: []
@@ -61,22 +61,22 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - LICENSE.txt
63
63
  - README.md
64
+ - _data/about/en/about.json
64
65
  - _data/blog/alertbar.yml
65
66
  - _data/blog/authors.yml
66
67
  - _data/blog/blog.yml
67
68
  - _data/blog/nav.json
68
69
  - _data/blog/share.yml
70
+ - _data/contact/en/contact.json
69
71
  - _data/feature/en/compress-pdf.json
70
72
  - _data/feature/en/split-pdf.json
71
73
  - _data/feature/hi/compress-pdf.json
72
74
  - _data/footer/en/data.json
73
75
  - _data/header/en/data.json
74
- - _data/home/en.json
76
+ - _data/help/en/help.json
77
+ - _data/home/en/en.json
75
78
  - _data/home/hi.json
76
- - _data/pages/about.json
77
- - _data/pages/contact.json
78
- - _data/pages/help.json
79
- - _data/pages/termAndCondition.json
79
+ - _data/termAndCondition/en/termAndCondition.json
80
80
  - _includes/author_bio.html
81
81
  - _includes/custom-head.html
82
82
  - _includes/disqus_comments.html
@@ -88,10 +88,9 @@ files:
88
88
  - _includes/paginationPostPage.html
89
89
  - _includes/postbox.html
90
90
  - _includes/script.html
91
- - _includes/search-lunr.html
92
91
  - _includes/section/alertbar.html
93
92
  - _includes/section/count.html
94
- - _includes/uploader/index.html
93
+ - _includes/share/socialshare.html
95
94
  - _layouts/aboutUs.html
96
95
  - _layouts/blog.html
97
96
  - _layouts/categories.html
@@ -115,8 +114,6 @@ files:
115
114
  - assets/images/logo.png
116
115
  - assets/instagram.svg
117
116
  - assets/js/TopScroll.js
118
- - assets/js/lunr.js
119
- - assets/js/lunrsearchengine.js
120
117
  - assets/linkdin.svg
121
118
  - assets/pdf.svg
122
119
  - assets/protect.svg
@@ -128,7 +125,7 @@ homepage: https://github.com/Appscms-com/appscms-tools-theme
128
125
  licenses:
129
126
  - MIT
130
127
  metadata: {}
131
- post_install_message:
128
+ post_install_message:
132
129
  rdoc_options: []
133
130
  require_paths:
134
131
  - lib
@@ -143,8 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
140
  - !ruby/object:Gem::Version
144
141
  version: '0'
145
142
  requirements: []
146
- rubygems_version: 3.2.5
147
- signing_key:
143
+ rubygems_version: 3.1.4
144
+ signing_key:
148
145
  specification_version: 4
149
146
  summary: Appscms theme for all tools
150
147
  test_files: []
data/_data/home/en.json DELETED
@@ -1,48 +0,0 @@
1
- {
2
- "h1":"We make PDF easy",
3
- "h2":"All-in-one easy-to-use online PDF tools",
4
- "title":"List of all Android alarm libraries for use in your project",
5
- "meta":"See collection of all Android alarm libraries, filter by license, modified date, languages, and select best for your usecase.",
6
- "features":[
7
- {
8
- "name":"Compress PDF",
9
- "description":"Reduce the size of your PDF without losing quality",
10
- "color": "#ff615c",
11
- "icon": "/assets/star.svg",
12
- "url":"/compress-pdf"
13
-
14
- },
15
- {
16
- "name":"Delete PDF",
17
- "description":"Reduce the size of your PDF without losing quality",
18
- "color":"#FFFF00",
19
- "icon": "/assets/star.svg",
20
- "url":"/delete-pdf"
21
-
22
- },
23
- {
24
- "name":"Split PDF",
25
- "description":"Reduce the size of your PDF without losing quality",
26
- "color":"#008000",
27
- "icon": "/assets/star.svg",
28
- "url":"/split-pdf"
29
-
30
- },
31
- {
32
- "name":"Merge PDF",
33
- "description":"Reduce the size of your PDF without losing quality",
34
- "color":"#A52A2A",
35
- "icon": "/assets/star.svg",
36
- "url":"/merge-pdf"
37
-
38
- },
39
- {
40
- "name":"Kartik PDF",
41
- "description":"Reduce the size of your PDF without losing quality",
42
- "color":"#808000",
43
- "icon": "/assets/star.svg",
44
- "url":"/kartik-pdf"
45
-
46
- }
47
- ]
48
- }
@@ -1,16 +0,0 @@
1
- <form class="bd-search m-0" onSubmit="return lunr_search(document.getElementById('lunrsearch').value);">
2
- <input type="text" class="form-control text-small launch-modal-search py-4" id="lunrsearch" name="q" maxlength="255"
3
- value="" placeholder="Type and enter..." style="border-radius: 50px; font-size: 12px;" />
4
- </form>
5
-
6
- <div id="lunrsearchresults">
7
- <ul></ul>
8
- </div>
9
-
10
- <script src=" {{site.url}}/assets/js/lunr.js"></script>
11
- <script src="{{site.url}}/assets/js/lunrsearchengine.js"></script>
12
-
13
-
14
- <script>
15
-
16
- </script>
@@ -1,69 +0,0 @@
1
- <form class="sc-1oqtgb8-1 fqHzAf">
2
- <label class="sc-1oqtgb8-2 fqPWeo">
3
- <div class="sc-1rkezdt-4 cwMDkh">
4
- <div class="sc-1rkezdt-5 cwUZOq">
5
- <div class="sc-2xfn8l-0 bxyVaO sc-6w1ep9-0 iTXuYA">
6
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 60">
7
- <path
8
- d="M56.9358018,0.887952143 L87.1245072,1.94216497 L95.1229308,10.5194242 L93.649924,52.7008195 C93.6036653,54.0254955 92.5349073,55.07339 91.2286594,55.11247 L91.0641982,55.1120479 L68.9993032,54.34053 L69,58 C69,59.1045695 68.1045695,60 67,60 L31,60 C29.8954305,60 29,59.1045695 29,58 L28.9993032,54.26853 L4.93575717,55.1094924 C3.61108122,55.1557511 2.49118654,54.162694 2.36108243,52.862354 L2.35003136,52.6982641 L0.67485552,4.72750438 C0.628596816,3.40282843 1.62165394,2.28293375 2.92199388,2.15282964 L3.08608385,2.14177857 L33.2747893,1.08756574 L40.5172077,7.8412302 L40.3683032,7.99952995 L54.1853032,7.99952995 L54.350076,3.29918047 C54.3963347,1.97450452 55.4650927,0.926610013 56.7713406,0.887529955 L56.9358018,0.887952143 Z M59.9993032,8.99952995 L31,9 C30.4871642,9 30.0644928,9.38604019 30.0067277,9.88337887 L30,10 L29.9993032,38.99953 L50,39 C50.5522847,39 51,39.4477153 51,40 L51,51 C51,51.5522847 50.5522847,52 50,52 L29.9993032,51.99953 L30,58 C30,58.5128358 30.3860402,58.9355072 30.8833789,58.9932723 L31,59 L67,59 C67.5128358,59 67.9355072,58.6139598 67.9932723,58.1166211 L68,58 L67.9993032,16.99953 L60,17 L59.9993032,8.99952995 Z M56.9009023,1.88734297 C56.1216811,1.86013197 55.4605576,2.43229572 55.3613708,3.1899476 L55.3494668,3.33407997 L55.1863032,7.99952995 L61,8 L69,16 L68.9991926,25.6289267 C70.5660308,24.8310303 72.3185302,24.4353033 74.1222153,24.4982894 C79.9176726,24.7006712 84.4517561,29.5628805 84.2493743,35.3583378 C84.0469925,41.1537951 79.1847832,45.6878786 73.3893259,45.4854968 C71.8381588,45.4313288 70.3473363,45.0415105 68.9989737,44.3553556 L68.9993032,53.34053 L91.0990977,54.112657 C91.8783189,54.139868 92.5394424,53.5677043 92.6386292,52.8100524 L92.6505332,52.66592 L94.0793032,11.69053 L86.5859814,11.4291499 L85.5865905,11.3942504 L85.8833032,2.89752995 L56.9009023,1.88734297 Z M32.1023032,2.12752995 L3.12098334,3.1411694 C2.34176219,3.1683804 1.72216126,3.78526803 1.67606716,4.54799323 L1.67424635,4.69260488 L3.34942219,52.6633646 C3.37663319,53.4425857 3.99352083,54.0621867 4.75624602,54.1082808 L4.90085767,54.1101016 L28.9993032,53.26853 L28.9993032,51.99953 L28,52 C27.4477153,52 27,51.5522847 27,51 L26.9993032,44.83453 L19.5950841,45.0933432 L19.595119,45.0943425 L18.5957281,45.129242 L18.5956932,45.1282427 L13.5987391,45.3027401 L13.598774,45.3037395 L12.5993832,45.338639 L11.8664937,24.3514317 L28.9993032,23.75253 L29,10 C29,8.8954305 29.8954305,8 31,8 L32.3073032,7.99952995 L32.1023032,2.12752995 Z M59,50 L59,51 L53,51 L53,50 L59,50 Z M32.3146067,42 L30,42 L30,49 L31.3033708,49 L31.3033708,46.4311927 L32.3595506,46.4311927 C33.9438202,46.4311927 35.1573034,45.7140673 35.1573034,44.1620795 C35.1573034,42.5351682 33.9438202,42 32.3146067,42 Z M38.505618,42 L36.5393258,42 L36.5393258,49 L38.5730337,49 C40.752809,49 42.0786517,47.7905199 42.0786517,45.4678899 C42.0786517,43.1559633 40.752809,42 38.505618,42 Z M48,42 L43.5617978,42 L43.5617978,49 L44.8651685,49 L44.8651685,46.0779817 L47.5393258,46.0779817 L47.5393258,45.029052 L44.8651685,45.029052 L44.8651685,43.0489297 L48,43.0489297 L48,42 Z M38.4157303,43.0061162 C39.8988764,43.0061162 40.741573,43.7553517 40.741573,45.4678899 C40.741573,47.1222018 39.9649438,47.9281908 38.5906208,47.990023 L38.4157303,47.9938838 L37.8426966,47.9938838 L37.8426966,43.0061162 L38.4157303,43.0061162 Z M59,45 L59,46 L53,46 L53,45 L59,45 Z M32.2134831,42.9954128 C33.3033708,42.9954128 33.8764045,43.2844037 33.8764045,44.1620795 C33.8764045,44.9679799 33.4086155,45.3851518 32.4449351,45.4314423 L32.258427,45.4357798 L31.3033708,45.4357798 L31.3033708,42.9954128 L32.2134831,42.9954128 Z M69.0265641,26.7510919 L68.9993032,26.76653 L68.9996167,43.2178828 C70.3344397,43.991422 71.8438183,44.4309169 73.4242254,44.4861059 C78.3287144,44.6573745 82.4944919,41.0794986 83.1625055,36.3253363 L73.720804,35.9951266 L74.0873158,25.4976802 L74.0873158,25.4976802 C72.2889112,25.4348785 70.5488066,25.8752929 69.0265641,26.7510919 Z M18.4212307,40.1322879 L13.4242765,40.3067854 L13.5638396,44.3033493 L18.5607937,44.1288518 L18.4212307,40.1322879 Z M27.0141292,39.8315388 L19.4206215,40.0973884 L19.5601846,44.0939523 L26.9993032,43.83453 L27,40 C27,39.9425877 27.0048382,39.8863055 27.0141292,39.8315388 Z M59,40 L59,41 L53,41 L53,40 L59,40 Z M18.2467332,35.1353338 L13.249779,35.3098313 L13.389377,39.3073946 L18.3863312,39.1328971 L18.2467332,35.1353338 Z M28.9993032,34.75853 L19.246124,35.1004343 L19.385722,39.0979976 L28.9993032,38.76153 L28.9993032,34.75853 Z M59,35 L59,36 L39,36 L39,35 L59,35 Z M18.0722357,30.1383796 L13.0752816,30.3128771 L13.2148795,34.3104404 L18.2118337,34.1359429 L18.0722357,30.1383796 Z M28.9993032,29.75553 L19.0716265,30.1034801 L19.2112245,34.1010435 L28.9993032,33.75853 L28.9993032,29.75553 Z M59,30 L59,31 L39,31 L39,30 L59,30 Z M17.8977382,25.1414255 L12.9007841,25.315923 L13.0403821,29.3134863 L18.0373362,29.1389888 L17.8977382,25.1414255 Z M28.9993032,24.75353 L18.897129,25.106526 L19.036727,29.1040893 L28.9993032,28.75553 L28.9993032,24.75353 Z M60.9993032,9.41452995 L60.9993032,15.99953 L67.5843032,15.99953 L60.9993032,9.41452995 Z M86.8743032,3.14052995 L86.6203032,10.42953 L93.9093032,10.68353 L86.8743032,3.14052995 Z M33.1093032,2.29952995 L33.3083032,7.99952995 L39.2203032,7.99952995 L33.1093032,2.29952995 Z">
9
- </path>
10
- </svg>
11
- </div>
12
- </div>
13
- <div style="display:none" id="__cond-922052">
14
- <div class="sc-1rkezdt-10 bbKduS">
15
- <div class="sc-1rkezdt-12 bcaWDk">
16
- <button class="sc-1mvwhop-0 bXaSgw" type="button">
17
- <div class="sc-2xfn8l-0 bxyVaO sc-2wite4-0 SBukn">
18
- <svg xmlns="http://www.w3.org/2000/svg"
19
- viewBox="0 0 24 24">
20
- <path
21
- d="M13 12v-2h1v2h2v1h-2v2h-1v-2h-2v-1h2zm5 8H6V4H5v17h13v-1zm1 0v2H4V3h2V1h10l5 5v14h-2zM7 2v17h13V6l-4-4H7zm9 0l4 4h-4V2z">
22
- </path>
23
- </svg>
24
- </div><span class="sc-1rkezdt-7 cxlSWI">Choose
25
- Files</span>
26
- <div
27
- class="sc-2xfn8l-0 bxyVaO l0r692-0 sc-1rkezdt-9 cxCMfa">
28
- <svg viewBox="0 0 16 16"
29
- xmlns="http://www.w3.org/2000/svg"
30
- fill="currentColor">
31
- <path d="M3 6H13L8 11L3 6Z"></path>
32
- </svg>
33
- </div>
34
- </button>
35
- </div>
36
- </div>
37
- </div>
38
- <div style="display:flex" id="__cond-922053">
39
- <div class="l3tlg0-6 dKjQAB">
40
- <button type="button" class="l3tlg0-0 hrcxSS">
41
- <div class="sc-2xfn8l-0 bxyVaO sc-2wite4-0 SBukn">
42
- <svg xmlns="http://www.w3.org/2000/svg"
43
- viewBox="0 0 24 24">
44
- <path
45
- d="M13 12v-2h1v2h2v1h-2v2h-1v-2h-2v-1h2zm5 8H6V4H5v17h13v-1zm1 0v2H4V3h2V1h10l5 5v14h-2zM7 2v17h13V6l-4-4H7zm9 0l4 4h-4V2z">
46
- </path>
47
- </svg>
48
- </div><span class="sc-1rkezdt-7 cxlSWI">Choose Files</span>
49
- </button>
50
- <div class="l3tlg0-7 fhjLHS"></div>
51
- <button type="button" title="Expand menu"
52
- class="l3tlg0-2 enfNez">
53
- <div class="sc-1gyxcpm-0 csDfHB"
54
- style="width:16px;height:16px">
55
- <svg viewBox="0 0 16 16"
56
- xmlns="http://www.w3.org/2000/svg"
57
- fill="currentColor">
58
- <path
59
- d="M13.3333 4L14.6666 5.33333L7.99992 12L1.33325 5.33333L2.66659 4L7.99992 9.5L13.3333 4Z">
60
- </path>
61
- </svg>
62
- </div>
63
- </button>
64
- </div>
65
- </div>
66
- <div class="sc-1rkezdt-6 cxdwsz">or drop files here</div>
67
- </div>
68
- </label>
69
- </form>
data/assets/js/lunr.js DELETED
@@ -1,2977 +0,0 @@
1
- /**
2
- * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.1.5
3
- * Copyright (C) 2017 Oliver Nightingale
4
- * @license MIT
5
- */
6
-
7
- ;(function(){
8
-
9
- /**
10
- * A convenience function for configuring and constructing
11
- * a new lunr Index.
12
- *
13
- * A lunr.Builder instance is created and the pipeline setup
14
- * with a trimmer, stop word filter and stemmer.
15
- *
16
- * This builder object is yielded to the configuration function
17
- * that is passed as a parameter, allowing the list of fields
18
- * and other builder parameters to be customised.
19
- *
20
- * All documents _must_ be added within the passed config function.
21
- *
22
- * @example
23
- * var idx = lunr(function () {
24
- * this.field('title')
25
- * this.field('body')
26
- * this.ref('id')
27
- *
28
- * documents.forEach(function (doc) {
29
- * this.add(doc)
30
- * }, this)
31
- * })
32
- *
33
- * @see {@link lunr.Builder}
34
- * @see {@link lunr.Pipeline}
35
- * @see {@link lunr.trimmer}
36
- * @see {@link lunr.stopWordFilter}
37
- * @see {@link lunr.stemmer}
38
- * @namespace {function} lunr
39
- */
40
- var lunr = function (config) {
41
- var builder = new lunr.Builder
42
-
43
- builder.pipeline.add(
44
- lunr.trimmer,
45
- lunr.stopWordFilter,
46
- lunr.stemmer
47
- )
48
-
49
- builder.searchPipeline.add(
50
- lunr.stemmer
51
- )
52
-
53
- config.call(builder, builder)
54
- return builder.build()
55
- }
56
-
57
- lunr.version = "2.1.5"
58
- /*!
59
- * lunr.utils
60
- * Copyright (C) 2017 Oliver Nightingale
61
- */
62
-
63
- /**
64
- * A namespace containing utils for the rest of the lunr library
65
- */
66
- lunr.utils = {}
67
-
68
- /**
69
- * Print a warning message to the console.
70
- *
71
- * @param {String} message The message to be printed.
72
- * @memberOf Utils
73
- */
74
- lunr.utils.warn = (function (global) {
75
- /* eslint-disable no-console */
76
- return function (message) {
77
- if (global.console && console.warn) {
78
- console.warn(message)
79
- }
80
- }
81
- /* eslint-enable no-console */
82
- })(this)
83
-
84
- /**
85
- * Convert an object to a string.
86
- *
87
- * In the case of `null` and `undefined` the function returns
88
- * the empty string, in all other cases the result of calling
89
- * `toString` on the passed object is returned.
90
- *
91
- * @param {Any} obj The object to convert to a string.
92
- * @return {String} string representation of the passed object.
93
- * @memberOf Utils
94
- */
95
- lunr.utils.asString = function (obj) {
96
- if (obj === void 0 || obj === null) {
97
- return ""
98
- } else {
99
- return obj.toString()
100
- }
101
- }
102
- lunr.FieldRef = function (docRef, fieldName, stringValue) {
103
- this.docRef = docRef
104
- this.fieldName = fieldName
105
- this._stringValue = stringValue
106
- }
107
-
108
- lunr.FieldRef.joiner = "/"
109
-
110
- lunr.FieldRef.fromString = function (s) {
111
- var n = s.indexOf(lunr.FieldRef.joiner)
112
-
113
- if (n === -1) {
114
- throw "malformed field ref string"
115
- }
116
-
117
- var fieldRef = s.slice(0, n),
118
- docRef = s.slice(n + 1)
119
-
120
- return new lunr.FieldRef (docRef, fieldRef, s)
121
- }
122
-
123
- lunr.FieldRef.prototype.toString = function () {
124
- if (this._stringValue == undefined) {
125
- this._stringValue = this.fieldName + lunr.FieldRef.joiner + this.docRef
126
- }
127
-
128
- return this._stringValue
129
- }
130
- /**
131
- * A function to calculate the inverse document frequency for
132
- * a posting. This is shared between the builder and the index
133
- *
134
- * @private
135
- * @param {object} posting - The posting for a given term
136
- * @param {number} documentCount - The total number of documents.
137
- */
138
- lunr.idf = function (posting, documentCount) {
139
- var documentsWithTerm = 0
140
-
141
- for (var fieldName in posting) {
142
- if (fieldName == '_index') continue // Ignore the term index, its not a field
143
- documentsWithTerm += Object.keys(posting[fieldName]).length
144
- }
145
-
146
- var x = (documentCount - documentsWithTerm + 0.5) / (documentsWithTerm + 0.5)
147
-
148
- return Math.log(1 + Math.abs(x))
149
- }
150
-
151
- /**
152
- * A token wraps a string representation of a token
153
- * as it is passed through the text processing pipeline.
154
- *
155
- * @constructor
156
- * @param {string} [str=''] - The string token being wrapped.
157
- * @param {object} [metadata={}] - Metadata associated with this token.
158
- */
159
- lunr.Token = function (str, metadata) {
160
- this.str = str || ""
161
- this.metadata = metadata || {}
162
- }
163
-
164
- /**
165
- * Returns the token string that is being wrapped by this object.
166
- *
167
- * @returns {string}
168
- */
169
- lunr.Token.prototype.toString = function () {
170
- return this.str
171
- }
172
-
173
- /**
174
- * A token update function is used when updating or optionally
175
- * when cloning a token.
176
- *
177
- * @callback lunr.Token~updateFunction
178
- * @param {string} str - The string representation of the token.
179
- * @param {Object} metadata - All metadata associated with this token.
180
- */
181
-
182
- /**
183
- * Applies the given function to the wrapped string token.
184
- *
185
- * @example
186
- * token.update(function (str, metadata) {
187
- * return str.toUpperCase()
188
- * })
189
- *
190
- * @param {lunr.Token~updateFunction} fn - A function to apply to the token string.
191
- * @returns {lunr.Token}
192
- */
193
- lunr.Token.prototype.update = function (fn) {
194
- this.str = fn(this.str, this.metadata)
195
- return this
196
- }
197
-
198
- /**
199
- * Creates a clone of this token. Optionally a function can be
200
- * applied to the cloned token.
201
- *
202
- * @param {lunr.Token~updateFunction} [fn] - An optional function to apply to the cloned token.
203
- * @returns {lunr.Token}
204
- */
205
- lunr.Token.prototype.clone = function (fn) {
206
- fn = fn || function (s) { return s }
207
- return new lunr.Token (fn(this.str, this.metadata), this.metadata)
208
- }
209
- /*!
210
- * lunr.tokenizer
211
- * Copyright (C) 2017 Oliver Nightingale
212
- */
213
-
214
- /**
215
- * A function for splitting a string into tokens ready to be inserted into
216
- * the search index. Uses `lunr.tokenizer.separator` to split strings, change
217
- * the value of this property to change how strings are split into tokens.
218
- *
219
- * This tokenizer will convert its parameter to a string by calling `toString` and
220
- * then will split this string on the character in `lunr.tokenizer.separator`.
221
- * Arrays will have their elements converted to strings and wrapped in a lunr.Token.
222
- *
223
- * @static
224
- * @param {?(string|object|object[])} obj - The object to convert into tokens
225
- * @returns {lunr.Token[]}
226
- */
227
- lunr.tokenizer = function (obj) {
228
- if (obj == null || obj == undefined) {
229
- return []
230
- }
231
-
232
- if (Array.isArray(obj)) {
233
- return obj.map(function (t) {
234
- return new lunr.Token(lunr.utils.asString(t).toLowerCase())
235
- })
236
- }
237
-
238
- var str = obj.toString().trim().toLowerCase(),
239
- len = str.length,
240
- tokens = []
241
-
242
- for (var sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) {
243
- var char = str.charAt(sliceEnd),
244
- sliceLength = sliceEnd - sliceStart
245
-
246
- if ((char.match(lunr.tokenizer.separator) || sliceEnd == len)) {
247
-
248
- if (sliceLength > 0) {
249
- tokens.push(
250
- new lunr.Token (str.slice(sliceStart, sliceEnd), {
251
- position: [sliceStart, sliceLength],
252
- index: tokens.length
253
- })
254
- )
255
- }
256
-
257
- sliceStart = sliceEnd + 1
258
- }
259
-
260
- }
261
-
262
- return tokens
263
- }
264
-
265
- /**
266
- * The separator used to split a string into tokens. Override this property to change the behaviour of
267
- * `lunr.tokenizer` behaviour when tokenizing strings. By default this splits on whitespace and hyphens.
268
- *
269
- * @static
270
- * @see lunr.tokenizer
271
- */
272
- lunr.tokenizer.separator = /[\s\-]+/
273
- /*!
274
- * lunr.Pipeline
275
- * Copyright (C) 2017 Oliver Nightingale
276
- */
277
-
278
- /**
279
- * lunr.Pipelines maintain an ordered list of functions to be applied to all
280
- * tokens in documents entering the search index and queries being ran against
281
- * the index.
282
- *
283
- * An instance of lunr.Index created with the lunr shortcut will contain a
284
- * pipeline with a stop word filter and an English language stemmer. Extra
285
- * functions can be added before or after either of these functions or these
286
- * default functions can be removed.
287
- *
288
- * When run the pipeline will call each function in turn, passing a token, the
289
- * index of that token in the original list of all tokens and finally a list of
290
- * all the original tokens.
291
- *
292
- * The output of functions in the pipeline will be passed to the next function
293
- * in the pipeline. To exclude a token from entering the index the function
294
- * should return undefined, the rest of the pipeline will not be called with
295
- * this token.
296
- *
297
- * For serialisation of pipelines to work, all functions used in an instance of
298
- * a pipeline should be registered with lunr.Pipeline. Registered functions can
299
- * then be loaded. If trying to load a serialised pipeline that uses functions
300
- * that are not registered an error will be thrown.
301
- *
302
- * If not planning on serialising the pipeline then registering pipeline functions
303
- * is not necessary.
304
- *
305
- * @constructor
306
- */
307
- lunr.Pipeline = function () {
308
- this._stack = []
309
- }
310
-
311
- lunr.Pipeline.registeredFunctions = Object.create(null)
312
-
313
- /**
314
- * A pipeline function maps lunr.Token to lunr.Token. A lunr.Token contains the token
315
- * string as well as all known metadata. A pipeline function can mutate the token string
316
- * or mutate (or add) metadata for a given token.
317
- *
318
- * A pipeline function can indicate that the passed token should be discarded by returning
319
- * null. This token will not be passed to any downstream pipeline functions and will not be
320
- * added to the index.
321
- *
322
- * Multiple tokens can be returned by returning an array of tokens. Each token will be passed
323
- * to any downstream pipeline functions and all will returned tokens will be added to the index.
324
- *
325
- * Any number of pipeline functions may be chained together using a lunr.Pipeline.
326
- *
327
- * @interface lunr.PipelineFunction
328
- * @param {lunr.Token} token - A token from the document being processed.
329
- * @param {number} i - The index of this token in the complete list of tokens for this document/field.
330
- * @param {lunr.Token[]} tokens - All tokens for this document/field.
331
- * @returns {(?lunr.Token|lunr.Token[])}
332
- */
333
-
334
- /**
335
- * Register a function with the pipeline.
336
- *
337
- * Functions that are used in the pipeline should be registered if the pipeline
338
- * needs to be serialised, or a serialised pipeline needs to be loaded.
339
- *
340
- * Registering a function does not add it to a pipeline, functions must still be
341
- * added to instances of the pipeline for them to be used when running a pipeline.
342
- *
343
- * @param {lunr.PipelineFunction} fn - The function to check for.
344
- * @param {String} label - The label to register this function with
345
- */
346
- lunr.Pipeline.registerFunction = function (fn, label) {
347
- if (label in this.registeredFunctions) {
348
- lunr.utils.warn('Overwriting existing registered function: ' + label)
349
- }
350
-
351
- fn.label = label
352
- lunr.Pipeline.registeredFunctions[fn.label] = fn
353
- }
354
-
355
- /**
356
- * Warns if the function is not registered as a Pipeline function.
357
- *
358
- * @param {lunr.PipelineFunction} fn - The function to check for.
359
- * @private
360
- */
361
- lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
362
- var isRegistered = fn.label && (fn.label in this.registeredFunctions)
363
-
364
- if (!isRegistered) {
365
- lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
366
- }
367
- }
368
-
369
- /**
370
- * Loads a previously serialised pipeline.
371
- *
372
- * All functions to be loaded must already be registered with lunr.Pipeline.
373
- * If any function from the serialised data has not been registered then an
374
- * error will be thrown.
375
- *
376
- * @param {Object} serialised - The serialised pipeline to load.
377
- * @returns {lunr.Pipeline}
378
- */
379
- lunr.Pipeline.load = function (serialised) {
380
- var pipeline = new lunr.Pipeline
381
-
382
- serialised.forEach(function (fnName) {
383
- var fn = lunr.Pipeline.registeredFunctions[fnName]
384
-
385
- if (fn) {
386
- pipeline.add(fn)
387
- } else {
388
- throw new Error('Cannot load unregistered function: ' + fnName)
389
- }
390
- })
391
-
392
- return pipeline
393
- }
394
-
395
- /**
396
- * Adds new functions to the end of the pipeline.
397
- *
398
- * Logs a warning if the function has not been registered.
399
- *
400
- * @param {lunr.PipelineFunction[]} functions - Any number of functions to add to the pipeline.
401
- */
402
- lunr.Pipeline.prototype.add = function () {
403
- var fns = Array.prototype.slice.call(arguments)
404
-
405
- fns.forEach(function (fn) {
406
- lunr.Pipeline.warnIfFunctionNotRegistered(fn)
407
- this._stack.push(fn)
408
- }, this)
409
- }
410
-
411
- /**
412
- * Adds a single function after a function that already exists in the
413
- * pipeline.
414
- *
415
- * Logs a warning if the function has not been registered.
416
- *
417
- * @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.
418
- * @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.
419
- */
420
- lunr.Pipeline.prototype.after = function (existingFn, newFn) {
421
- lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
422
-
423
- var pos = this._stack.indexOf(existingFn)
424
- if (pos == -1) {
425
- throw new Error('Cannot find existingFn')
426
- }
427
-
428
- pos = pos + 1
429
- this._stack.splice(pos, 0, newFn)
430
- }
431
-
432
- /**
433
- * Adds a single function before a function that already exists in the
434
- * pipeline.
435
- *
436
- * Logs a warning if the function has not been registered.
437
- *
438
- * @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.
439
- * @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.
440
- */
441
- lunr.Pipeline.prototype.before = function (existingFn, newFn) {
442
- lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
443
-
444
- var pos = this._stack.indexOf(existingFn)
445
- if (pos == -1) {
446
- throw new Error('Cannot find existingFn')
447
- }
448
-
449
- this._stack.splice(pos, 0, newFn)
450
- }
451
-
452
- /**
453
- * Removes a function from the pipeline.
454
- *
455
- * @param {lunr.PipelineFunction} fn The function to remove from the pipeline.
456
- */
457
- lunr.Pipeline.prototype.remove = function (fn) {
458
- var pos = this._stack.indexOf(fn)
459
- if (pos == -1) {
460
- return
461
- }
462
-
463
- this._stack.splice(pos, 1)
464
- }
465
-
466
- /**
467
- * Runs the current list of functions that make up the pipeline against the
468
- * passed tokens.
469
- *
470
- * @param {Array} tokens The tokens to run through the pipeline.
471
- * @returns {Array}
472
- */
473
- lunr.Pipeline.prototype.run = function (tokens) {
474
- var stackLength = this._stack.length
475
-
476
- for (var i = 0; i < stackLength; i++) {
477
- var fn = this._stack[i]
478
-
479
- tokens = tokens.reduce(function (memo, token, j) {
480
- var result = fn(token, j, tokens)
481
-
482
- if (result === void 0 || result === '') return memo
483
-
484
- return memo.concat(result)
485
- }, [])
486
- }
487
-
488
- return tokens
489
- }
490
-
491
- /**
492
- * Convenience method for passing a string through a pipeline and getting
493
- * strings out. This method takes care of wrapping the passed string in a
494
- * token and mapping the resulting tokens back to strings.
495
- *
496
- * @param {string} str - The string to pass through the pipeline.
497
- * @returns {string[]}
498
- */
499
- lunr.Pipeline.prototype.runString = function (str) {
500
- var token = new lunr.Token (str)
501
-
502
- return this.run([token]).map(function (t) {
503
- return t.toString()
504
- })
505
- }
506
-
507
- /**
508
- * Resets the pipeline by removing any existing processors.
509
- *
510
- */
511
- lunr.Pipeline.prototype.reset = function () {
512
- this._stack = []
513
- }
514
-
515
- /**
516
- * Returns a representation of the pipeline ready for serialisation.
517
- *
518
- * Logs a warning if the function has not been registered.
519
- *
520
- * @returns {Array}
521
- */
522
- lunr.Pipeline.prototype.toJSON = function () {
523
- return this._stack.map(function (fn) {
524
- lunr.Pipeline.warnIfFunctionNotRegistered(fn)
525
-
526
- return fn.label
527
- })
528
- }
529
- /*!
530
- * lunr.Vector
531
- * Copyright (C) 2017 Oliver Nightingale
532
- */
533
-
534
- /**
535
- * A vector is used to construct the vector space of documents and queries. These
536
- * vectors support operations to determine the similarity between two documents or
537
- * a document and a query.
538
- *
539
- * Normally no parameters are required for initializing a vector, but in the case of
540
- * loading a previously dumped vector the raw elements can be provided to the constructor.
541
- *
542
- * For performance reasons vectors are implemented with a flat array, where an elements
543
- * index is immediately followed by its value. E.g. [index, value, index, value]. This
544
- * allows the underlying array to be as sparse as possible and still offer decent
545
- * performance when being used for vector calculations.
546
- *
547
- * @constructor
548
- * @param {Number[]} [elements] - The flat list of element index and element value pairs.
549
- */
550
- lunr.Vector = function (elements) {
551
- this._magnitude = 0
552
- this.elements = elements || []
553
- }
554
-
555
-
556
- /**
557
- * Calculates the position within the vector to insert a given index.
558
- *
559
- * This is used internally by insert and upsert. If there are duplicate indexes then
560
- * the position is returned as if the value for that index were to be updated, but it
561
- * is the callers responsibility to check whether there is a duplicate at that index
562
- *
563
- * @param {Number} insertIdx - The index at which the element should be inserted.
564
- * @returns {Number}
565
- */
566
- lunr.Vector.prototype.positionForIndex = function (index) {
567
- // For an empty vector the tuple can be inserted at the beginning
568
- if (this.elements.length == 0) {
569
- return 0
570
- }
571
-
572
- var start = 0,
573
- end = this.elements.length / 2,
574
- sliceLength = end - start,
575
- pivotPoint = Math.floor(sliceLength / 2),
576
- pivotIndex = this.elements[pivotPoint * 2]
577
-
578
- while (sliceLength > 1) {
579
- if (pivotIndex < index) {
580
- start = pivotPoint
581
- }
582
-
583
- if (pivotIndex > index) {
584
- end = pivotPoint
585
- }
586
-
587
- if (pivotIndex == index) {
588
- break
589
- }
590
-
591
- sliceLength = end - start
592
- pivotPoint = start + Math.floor(sliceLength / 2)
593
- pivotIndex = this.elements[pivotPoint * 2]
594
- }
595
-
596
- if (pivotIndex == index) {
597
- return pivotPoint * 2
598
- }
599
-
600
- if (pivotIndex > index) {
601
- return pivotPoint * 2
602
- }
603
-
604
- if (pivotIndex < index) {
605
- return (pivotPoint + 1) * 2
606
- }
607
- }
608
-
609
- /**
610
- * Inserts an element at an index within the vector.
611
- *
612
- * Does not allow duplicates, will throw an error if there is already an entry
613
- * for this index.
614
- *
615
- * @param {Number} insertIdx - The index at which the element should be inserted.
616
- * @param {Number} val - The value to be inserted into the vector.
617
- */
618
- lunr.Vector.prototype.insert = function (insertIdx, val) {
619
- this.upsert(insertIdx, val, function () {
620
- throw "duplicate index"
621
- })
622
- }
623
-
624
- /**
625
- * Inserts or updates an existing index within the vector.
626
- *
627
- * @param {Number} insertIdx - The index at which the element should be inserted.
628
- * @param {Number} val - The value to be inserted into the vector.
629
- * @param {function} fn - A function that is called for updates, the existing value and the
630
- * requested value are passed as arguments
631
- */
632
- lunr.Vector.prototype.upsert = function (insertIdx, val, fn) {
633
- this._magnitude = 0
634
- var position = this.positionForIndex(insertIdx)
635
-
636
- if (this.elements[position] == insertIdx) {
637
- this.elements[position + 1] = fn(this.elements[position + 1], val)
638
- } else {
639
- this.elements.splice(position, 0, insertIdx, val)
640
- }
641
- }
642
-
643
- /**
644
- * Calculates the magnitude of this vector.
645
- *
646
- * @returns {Number}
647
- */
648
- lunr.Vector.prototype.magnitude = function () {
649
- if (this._magnitude) return this._magnitude
650
-
651
- var sumOfSquares = 0,
652
- elementsLength = this.elements.length
653
-
654
- for (var i = 1; i < elementsLength; i += 2) {
655
- var val = this.elements[i]
656
- sumOfSquares += val * val
657
- }
658
-
659
- return this._magnitude = Math.sqrt(sumOfSquares)
660
- }
661
-
662
- /**
663
- * Calculates the dot product of this vector and another vector.
664
- *
665
- * @param {lunr.Vector} otherVector - The vector to compute the dot product with.
666
- * @returns {Number}
667
- */
668
- lunr.Vector.prototype.dot = function (otherVector) {
669
- var dotProduct = 0,
670
- a = this.elements, b = otherVector.elements,
671
- aLen = a.length, bLen = b.length,
672
- aVal = 0, bVal = 0,
673
- i = 0, j = 0
674
-
675
- while (i < aLen && j < bLen) {
676
- aVal = a[i], bVal = b[j]
677
- if (aVal < bVal) {
678
- i += 2
679
- } else if (aVal > bVal) {
680
- j += 2
681
- } else if (aVal == bVal) {
682
- dotProduct += a[i + 1] * b[j + 1]
683
- i += 2
684
- j += 2
685
- }
686
- }
687
-
688
- return dotProduct
689
- }
690
-
691
- /**
692
- * Calculates the cosine similarity between this vector and another
693
- * vector.
694
- *
695
- * @param {lunr.Vector} otherVector - The other vector to calculate the
696
- * similarity with.
697
- * @returns {Number}
698
- */
699
- lunr.Vector.prototype.similarity = function (otherVector) {
700
- return this.dot(otherVector) / (this.magnitude() * otherVector.magnitude())
701
- }
702
-
703
- /**
704
- * Converts the vector to an array of the elements within the vector.
705
- *
706
- * @returns {Number[]}
707
- */
708
- lunr.Vector.prototype.toArray = function () {
709
- var output = new Array (this.elements.length / 2)
710
-
711
- for (var i = 1, j = 0; i < this.elements.length; i += 2, j++) {
712
- output[j] = this.elements[i]
713
- }
714
-
715
- return output
716
- }
717
-
718
- /**
719
- * A JSON serializable representation of the vector.
720
- *
721
- * @returns {Number[]}
722
- */
723
- lunr.Vector.prototype.toJSON = function () {
724
- return this.elements
725
- }
726
- /* eslint-disable */
727
- /*!
728
- * lunr.stemmer
729
- * Copyright (C) 2017 Oliver Nightingale
730
- * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
731
- */
732
-
733
- /**
734
- * lunr.stemmer is an english language stemmer, this is a JavaScript
735
- * implementation of the PorterStemmer taken from http://tartarus.org/~martin
736
- *
737
- * @static
738
- * @implements {lunr.PipelineFunction}
739
- * @param {lunr.Token} token - The string to stem
740
- * @returns {lunr.Token}
741
- * @see {@link lunr.Pipeline}
742
- */
743
- lunr.stemmer = (function(){
744
- var step2list = {
745
- "ational" : "ate",
746
- "tional" : "tion",
747
- "enci" : "ence",
748
- "anci" : "ance",
749
- "izer" : "ize",
750
- "bli" : "ble",
751
- "alli" : "al",
752
- "entli" : "ent",
753
- "eli" : "e",
754
- "ousli" : "ous",
755
- "ization" : "ize",
756
- "ation" : "ate",
757
- "ator" : "ate",
758
- "alism" : "al",
759
- "iveness" : "ive",
760
- "fulness" : "ful",
761
- "ousness" : "ous",
762
- "aliti" : "al",
763
- "iviti" : "ive",
764
- "biliti" : "ble",
765
- "logi" : "log"
766
- },
767
-
768
- step3list = {
769
- "icate" : "ic",
770
- "ative" : "",
771
- "alize" : "al",
772
- "iciti" : "ic",
773
- "ical" : "ic",
774
- "ful" : "",
775
- "ness" : ""
776
- },
777
-
778
- c = "[^aeiou]", // consonant
779
- v = "[aeiouy]", // vowel
780
- C = c + "[^aeiouy]*", // consonant sequence
781
- V = v + "[aeiou]*", // vowel sequence
782
-
783
- mgr0 = "^(" + C + ")?" + V + C, // [C]VC... is m>0
784
- meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$", // [C]VC[V] is m=1
785
- mgr1 = "^(" + C + ")?" + V + C + V + C, // [C]VCVC... is m>1
786
- s_v = "^(" + C + ")?" + v; // vowel in stem
787
-
788
- var re_mgr0 = new RegExp(mgr0);
789
- var re_mgr1 = new RegExp(mgr1);
790
- var re_meq1 = new RegExp(meq1);
791
- var re_s_v = new RegExp(s_v);
792
-
793
- var re_1a = /^(.+?)(ss|i)es$/;
794
- var re2_1a = /^(.+?)([^s])s$/;
795
- var re_1b = /^(.+?)eed$/;
796
- var re2_1b = /^(.+?)(ed|ing)$/;
797
- var re_1b_2 = /.$/;
798
- var re2_1b_2 = /(at|bl|iz)$/;
799
- var re3_1b_2 = new RegExp("([^aeiouylsz])\\1$");
800
- var re4_1b_2 = new RegExp("^" + C + v + "[^aeiouwxy]$");
801
-
802
- var re_1c = /^(.+?[^aeiou])y$/;
803
- var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
804
-
805
- var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
806
-
807
- var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
808
- var re2_4 = /^(.+?)(s|t)(ion)$/;
809
-
810
- var re_5 = /^(.+?)e$/;
811
- var re_5_1 = /ll$/;
812
- var re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$");
813
-
814
- var porterStemmer = function porterStemmer(w) {
815
- var stem,
816
- suffix,
817
- firstch,
818
- re,
819
- re2,
820
- re3,
821
- re4;
822
-
823
- if (w.length < 3) { return w; }
824
-
825
- firstch = w.substr(0,1);
826
- if (firstch == "y") {
827
- w = firstch.toUpperCase() + w.substr(1);
828
- }
829
-
830
- // Step 1a
831
- re = re_1a
832
- re2 = re2_1a;
833
-
834
- if (re.test(w)) { w = w.replace(re,"$1$2"); }
835
- else if (re2.test(w)) { w = w.replace(re2,"$1$2"); }
836
-
837
- // Step 1b
838
- re = re_1b;
839
- re2 = re2_1b;
840
- if (re.test(w)) {
841
- var fp = re.exec(w);
842
- re = re_mgr0;
843
- if (re.test(fp[1])) {
844
- re = re_1b_2;
845
- w = w.replace(re,"");
846
- }
847
- } else if (re2.test(w)) {
848
- var fp = re2.exec(w);
849
- stem = fp[1];
850
- re2 = re_s_v;
851
- if (re2.test(stem)) {
852
- w = stem;
853
- re2 = re2_1b_2;
854
- re3 = re3_1b_2;
855
- re4 = re4_1b_2;
856
- if (re2.test(w)) { w = w + "e"; }
857
- else if (re3.test(w)) { re = re_1b_2; w = w.replace(re,""); }
858
- else if (re4.test(w)) { w = w + "e"; }
859
- }
860
- }
861
-
862
- // Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say)
863
- re = re_1c;
864
- if (re.test(w)) {
865
- var fp = re.exec(w);
866
- stem = fp[1];
867
- w = stem + "i";
868
- }
869
-
870
- // Step 2
871
- re = re_2;
872
- if (re.test(w)) {
873
- var fp = re.exec(w);
874
- stem = fp[1];
875
- suffix = fp[2];
876
- re = re_mgr0;
877
- if (re.test(stem)) {
878
- w = stem + step2list[suffix];
879
- }
880
- }
881
-
882
- // Step 3
883
- re = re_3;
884
- if (re.test(w)) {
885
- var fp = re.exec(w);
886
- stem = fp[1];
887
- suffix = fp[2];
888
- re = re_mgr0;
889
- if (re.test(stem)) {
890
- w = stem + step3list[suffix];
891
- }
892
- }
893
-
894
- // Step 4
895
- re = re_4;
896
- re2 = re2_4;
897
- if (re.test(w)) {
898
- var fp = re.exec(w);
899
- stem = fp[1];
900
- re = re_mgr1;
901
- if (re.test(stem)) {
902
- w = stem;
903
- }
904
- } else if (re2.test(w)) {
905
- var fp = re2.exec(w);
906
- stem = fp[1] + fp[2];
907
- re2 = re_mgr1;
908
- if (re2.test(stem)) {
909
- w = stem;
910
- }
911
- }
912
-
913
- // Step 5
914
- re = re_5;
915
- if (re.test(w)) {
916
- var fp = re.exec(w);
917
- stem = fp[1];
918
- re = re_mgr1;
919
- re2 = re_meq1;
920
- re3 = re3_5;
921
- if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) {
922
- w = stem;
923
- }
924
- }
925
-
926
- re = re_5_1;
927
- re2 = re_mgr1;
928
- if (re.test(w) && re2.test(w)) {
929
- re = re_1b_2;
930
- w = w.replace(re,"");
931
- }
932
-
933
- // and turn initial Y back to y
934
-
935
- if (firstch == "y") {
936
- w = firstch.toLowerCase() + w.substr(1);
937
- }
938
-
939
- return w;
940
- };
941
-
942
- return function (token) {
943
- return token.update(porterStemmer);
944
- }
945
- })();
946
-
947
- lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer')
948
- /*!
949
- * lunr.stopWordFilter
950
- * Copyright (C) 2017 Oliver Nightingale
951
- */
952
-
953
- /**
954
- * lunr.generateStopWordFilter builds a stopWordFilter function from the provided
955
- * list of stop words.
956
- *
957
- * The built in lunr.stopWordFilter is built using this generator and can be used
958
- * to generate custom stopWordFilters for applications or non English languages.
959
- *
960
- * @param {Array} token The token to pass through the filter
961
- * @returns {lunr.PipelineFunction}
962
- * @see lunr.Pipeline
963
- * @see lunr.stopWordFilter
964
- */
965
- lunr.generateStopWordFilter = function (stopWords) {
966
- var words = stopWords.reduce(function (memo, stopWord) {
967
- memo[stopWord] = stopWord
968
- return memo
969
- }, {})
970
-
971
- return function (token) {
972
- if (token && words[token.toString()] !== token.toString()) return token
973
- }
974
- }
975
-
976
- /**
977
- * lunr.stopWordFilter is an English language stop word list filter, any words
978
- * contained in the list will not be passed through the filter.
979
- *
980
- * This is intended to be used in the Pipeline. If the token does not pass the
981
- * filter then undefined will be returned.
982
- *
983
- * @implements {lunr.PipelineFunction}
984
- * @params {lunr.Token} token - A token to check for being a stop word.
985
- * @returns {lunr.Token}
986
- * @see {@link lunr.Pipeline}
987
- */
988
- lunr.stopWordFilter = lunr.generateStopWordFilter([
989
- 'a',
990
- 'able',
991
- 'about',
992
- 'across',
993
- 'after',
994
- 'all',
995
- 'almost',
996
- 'also',
997
- 'am',
998
- 'among',
999
- 'an',
1000
- 'and',
1001
- 'any',
1002
- 'are',
1003
- 'as',
1004
- 'at',
1005
- 'be',
1006
- 'because',
1007
- 'been',
1008
- 'but',
1009
- 'by',
1010
- 'can',
1011
- 'cannot',
1012
- 'could',
1013
- 'dear',
1014
- 'did',
1015
- 'do',
1016
- 'does',
1017
- 'either',
1018
- 'else',
1019
- 'ever',
1020
- 'every',
1021
- 'for',
1022
- 'from',
1023
- 'get',
1024
- 'got',
1025
- 'had',
1026
- 'has',
1027
- 'have',
1028
- 'he',
1029
- 'her',
1030
- 'hers',
1031
- 'him',
1032
- 'his',
1033
- 'how',
1034
- 'however',
1035
- 'i',
1036
- 'if',
1037
- 'in',
1038
- 'into',
1039
- 'is',
1040
- 'it',
1041
- 'its',
1042
- 'just',
1043
- 'least',
1044
- 'let',
1045
- 'like',
1046
- 'likely',
1047
- 'may',
1048
- 'me',
1049
- 'might',
1050
- 'most',
1051
- 'must',
1052
- 'my',
1053
- 'neither',
1054
- 'no',
1055
- 'nor',
1056
- 'not',
1057
- 'of',
1058
- 'off',
1059
- 'often',
1060
- 'on',
1061
- 'only',
1062
- 'or',
1063
- 'other',
1064
- 'our',
1065
- 'own',
1066
- 'rather',
1067
- 'said',
1068
- 'say',
1069
- 'says',
1070
- 'she',
1071
- 'should',
1072
- 'since',
1073
- 'so',
1074
- 'some',
1075
- 'than',
1076
- 'that',
1077
- 'the',
1078
- 'their',
1079
- 'them',
1080
- 'then',
1081
- 'there',
1082
- 'these',
1083
- 'they',
1084
- 'this',
1085
- 'tis',
1086
- 'to',
1087
- 'too',
1088
- 'twas',
1089
- 'us',
1090
- 'wants',
1091
- 'was',
1092
- 'we',
1093
- 'were',
1094
- 'what',
1095
- 'when',
1096
- 'where',
1097
- 'which',
1098
- 'while',
1099
- 'who',
1100
- 'whom',
1101
- 'why',
1102
- 'will',
1103
- 'with',
1104
- 'would',
1105
- 'yet',
1106
- 'you',
1107
- 'your'
1108
- ])
1109
-
1110
- lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter')
1111
- /*!
1112
- * lunr.trimmer
1113
- * Copyright (C) 2017 Oliver Nightingale
1114
- */
1115
-
1116
- /**
1117
- * lunr.trimmer is a pipeline function for trimming non word
1118
- * characters from the beginning and end of tokens before they
1119
- * enter the index.
1120
- *
1121
- * This implementation may not work correctly for non latin
1122
- * characters and should either be removed or adapted for use
1123
- * with languages with non-latin characters.
1124
- *
1125
- * @static
1126
- * @implements {lunr.PipelineFunction}
1127
- * @param {lunr.Token} token The token to pass through the filter
1128
- * @returns {lunr.Token}
1129
- * @see lunr.Pipeline
1130
- */
1131
- lunr.trimmer = function (token) {
1132
- return token.update(function (s) {
1133
- return s.replace(/^\W+/, '').replace(/\W+$/, '')
1134
- })
1135
- }
1136
-
1137
- lunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer')
1138
- /*!
1139
- * lunr.TokenSet
1140
- * Copyright (C) 2017 Oliver Nightingale
1141
- */
1142
-
1143
- /**
1144
- * A token set is used to store the unique list of all tokens
1145
- * within an index. Token sets are also used to represent an
1146
- * incoming query to the index, this query token set and index
1147
- * token set are then intersected to find which tokens to look
1148
- * up in the inverted index.
1149
- *
1150
- * A token set can hold multiple tokens, as in the case of the
1151
- * index token set, or it can hold a single token as in the
1152
- * case of a simple query token set.
1153
- *
1154
- * Additionally token sets are used to perform wildcard matching.
1155
- * Leading, contained and trailing wildcards are supported, and
1156
- * from this edit distance matching can also be provided.
1157
- *
1158
- * Token sets are implemented as a minimal finite state automata,
1159
- * where both common prefixes and suffixes are shared between tokens.
1160
- * This helps to reduce the space used for storing the token set.
1161
- *
1162
- * @constructor
1163
- */
1164
- lunr.TokenSet = function () {
1165
- this.final = false
1166
- this.edges = {}
1167
- this.id = lunr.TokenSet._nextId
1168
- lunr.TokenSet._nextId += 1
1169
- }
1170
-
1171
- /**
1172
- * Keeps track of the next, auto increment, identifier to assign
1173
- * to a new tokenSet.
1174
- *
1175
- * TokenSets require a unique identifier to be correctly minimised.
1176
- *
1177
- * @private
1178
- */
1179
- lunr.TokenSet._nextId = 1
1180
-
1181
- /**
1182
- * Creates a TokenSet instance from the given sorted array of words.
1183
- *
1184
- * @param {String[]} arr - A sorted array of strings to create the set from.
1185
- * @returns {lunr.TokenSet}
1186
- * @throws Will throw an error if the input array is not sorted.
1187
- */
1188
- lunr.TokenSet.fromArray = function (arr) {
1189
- var builder = new lunr.TokenSet.Builder
1190
-
1191
- for (var i = 0, len = arr.length; i < len; i++) {
1192
- builder.insert(arr[i])
1193
- }
1194
-
1195
- builder.finish()
1196
- return builder.root
1197
- }
1198
-
1199
- /**
1200
- * Creates a token set from a query clause.
1201
- *
1202
- * @private
1203
- * @param {Object} clause - A single clause from lunr.Query.
1204
- * @param {string} clause.term - The query clause term.
1205
- * @param {number} [clause.editDistance] - The optional edit distance for the term.
1206
- * @returns {lunr.TokenSet}
1207
- */
1208
- lunr.TokenSet.fromClause = function (clause) {
1209
- if ('editDistance' in clause) {
1210
- return lunr.TokenSet.fromFuzzyString(clause.term, clause.editDistance)
1211
- } else {
1212
- return lunr.TokenSet.fromString(clause.term)
1213
- }
1214
- }
1215
-
1216
- /**
1217
- * Creates a token set representing a single string with a specified
1218
- * edit distance.
1219
- *
1220
- * Insertions, deletions, substitutions and transpositions are each
1221
- * treated as an edit distance of 1.
1222
- *
1223
- * Increasing the allowed edit distance will have a dramatic impact
1224
- * on the performance of both creating and intersecting these TokenSets.
1225
- * It is advised to keep the edit distance less than 3.
1226
- *
1227
- * @param {string} str - The string to create the token set from.
1228
- * @param {number} editDistance - The allowed edit distance to match.
1229
- * @returns {lunr.Vector}
1230
- */
1231
- lunr.TokenSet.fromFuzzyString = function (str, editDistance) {
1232
- var root = new lunr.TokenSet
1233
-
1234
- var stack = [{
1235
- node: root,
1236
- editsRemaining: editDistance,
1237
- str: str
1238
- }]
1239
-
1240
- while (stack.length) {
1241
- var frame = stack.pop()
1242
-
1243
- // no edit
1244
- if (frame.str.length > 0) {
1245
- var char = frame.str.charAt(0),
1246
- noEditNode
1247
-
1248
- if (char in frame.node.edges) {
1249
- noEditNode = frame.node.edges[char]
1250
- } else {
1251
- noEditNode = new lunr.TokenSet
1252
- frame.node.edges[char] = noEditNode
1253
- }
1254
-
1255
- if (frame.str.length == 1) {
1256
- noEditNode.final = true
1257
- } else {
1258
- stack.push({
1259
- node: noEditNode,
1260
- editsRemaining: frame.editsRemaining,
1261
- str: frame.str.slice(1)
1262
- })
1263
- }
1264
- }
1265
-
1266
- // deletion
1267
- // can only do a deletion if we have enough edits remaining
1268
- // and if there are characters left to delete in the string
1269
- if (frame.editsRemaining > 0 && frame.str.length > 1) {
1270
- var char = frame.str.charAt(1),
1271
- deletionNode
1272
-
1273
- if (char in frame.node.edges) {
1274
- deletionNode = frame.node.edges[char]
1275
- } else {
1276
- deletionNode = new lunr.TokenSet
1277
- frame.node.edges[char] = deletionNode
1278
- }
1279
-
1280
- if (frame.str.length <= 2) {
1281
- deletionNode.final = true
1282
- } else {
1283
- stack.push({
1284
- node: deletionNode,
1285
- editsRemaining: frame.editsRemaining - 1,
1286
- str: frame.str.slice(2)
1287
- })
1288
- }
1289
- }
1290
-
1291
- // deletion
1292
- // just removing the last character from the str
1293
- if (frame.editsRemaining > 0 && frame.str.length == 1) {
1294
- frame.node.final = true
1295
- }
1296
-
1297
- // substitution
1298
- // can only do a substitution if we have enough edits remaining
1299
- // and if there are characters left to substitute
1300
- if (frame.editsRemaining > 0 && frame.str.length >= 1) {
1301
- if ("*" in frame.node.edges) {
1302
- var substitutionNode = frame.node.edges["*"]
1303
- } else {
1304
- var substitutionNode = new lunr.TokenSet
1305
- frame.node.edges["*"] = substitutionNode
1306
- }
1307
-
1308
- if (frame.str.length == 1) {
1309
- substitutionNode.final = true
1310
- } else {
1311
- stack.push({
1312
- node: substitutionNode,
1313
- editsRemaining: frame.editsRemaining - 1,
1314
- str: frame.str.slice(1)
1315
- })
1316
- }
1317
- }
1318
-
1319
- // insertion
1320
- // can only do insertion if there are edits remaining
1321
- if (frame.editsRemaining > 0) {
1322
- if ("*" in frame.node.edges) {
1323
- var insertionNode = frame.node.edges["*"]
1324
- } else {
1325
- var insertionNode = new lunr.TokenSet
1326
- frame.node.edges["*"] = insertionNode
1327
- }
1328
-
1329
- if (frame.str.length == 0) {
1330
- insertionNode.final = true
1331
- } else {
1332
- stack.push({
1333
- node: insertionNode,
1334
- editsRemaining: frame.editsRemaining - 1,
1335
- str: frame.str
1336
- })
1337
- }
1338
- }
1339
-
1340
- // transposition
1341
- // can only do a transposition if there are edits remaining
1342
- // and there are enough characters to transpose
1343
- if (frame.editsRemaining > 0 && frame.str.length > 1) {
1344
- var charA = frame.str.charAt(0),
1345
- charB = frame.str.charAt(1),
1346
- transposeNode
1347
-
1348
- if (charB in frame.node.edges) {
1349
- transposeNode = frame.node.edges[charB]
1350
- } else {
1351
- transposeNode = new lunr.TokenSet
1352
- frame.node.edges[charB] = transposeNode
1353
- }
1354
-
1355
- if (frame.str.length == 1) {
1356
- transposeNode.final = true
1357
- } else {
1358
- stack.push({
1359
- node: transposeNode,
1360
- editsRemaining: frame.editsRemaining - 1,
1361
- str: charA + frame.str.slice(2)
1362
- })
1363
- }
1364
- }
1365
- }
1366
-
1367
- return root
1368
- }
1369
-
1370
- /**
1371
- * Creates a TokenSet from a string.
1372
- *
1373
- * The string may contain one or more wildcard characters (*)
1374
- * that will allow wildcard matching when intersecting with
1375
- * another TokenSet.
1376
- *
1377
- * @param {string} str - The string to create a TokenSet from.
1378
- * @returns {lunr.TokenSet}
1379
- */
1380
- lunr.TokenSet.fromString = function (str) {
1381
- var node = new lunr.TokenSet,
1382
- root = node,
1383
- wildcardFound = false
1384
-
1385
- /*
1386
- * Iterates through all characters within the passed string
1387
- * appending a node for each character.
1388
- *
1389
- * As soon as a wildcard character is found then a self
1390
- * referencing edge is introduced to continually match
1391
- * any number of any characters.
1392
- */
1393
- for (var i = 0, len = str.length; i < len; i++) {
1394
- var char = str[i],
1395
- final = (i == len - 1)
1396
-
1397
- if (char == "*") {
1398
- wildcardFound = true
1399
- node.edges[char] = node
1400
- node.final = final
1401
-
1402
- } else {
1403
- var next = new lunr.TokenSet
1404
- next.final = final
1405
-
1406
- node.edges[char] = next
1407
- node = next
1408
-
1409
- // TODO: is this needed anymore?
1410
- if (wildcardFound) {
1411
- node.edges["*"] = root
1412
- }
1413
- }
1414
- }
1415
-
1416
- return root
1417
- }
1418
-
1419
- /**
1420
- * Converts this TokenSet into an array of strings
1421
- * contained within the TokenSet.
1422
- *
1423
- * @returns {string[]}
1424
- */
1425
- lunr.TokenSet.prototype.toArray = function () {
1426
- var words = []
1427
-
1428
- var stack = [{
1429
- prefix: "",
1430
- node: this
1431
- }]
1432
-
1433
- while (stack.length) {
1434
- var frame = stack.pop(),
1435
- edges = Object.keys(frame.node.edges),
1436
- len = edges.length
1437
-
1438
- if (frame.node.final) {
1439
- words.push(frame.prefix)
1440
- }
1441
-
1442
- for (var i = 0; i < len; i++) {
1443
- var edge = edges[i]
1444
-
1445
- stack.push({
1446
- prefix: frame.prefix.concat(edge),
1447
- node: frame.node.edges[edge]
1448
- })
1449
- }
1450
- }
1451
-
1452
- return words
1453
- }
1454
-
1455
- /**
1456
- * Generates a string representation of a TokenSet.
1457
- *
1458
- * This is intended to allow TokenSets to be used as keys
1459
- * in objects, largely to aid the construction and minimisation
1460
- * of a TokenSet. As such it is not designed to be a human
1461
- * friendly representation of the TokenSet.
1462
- *
1463
- * @returns {string}
1464
- */
1465
- lunr.TokenSet.prototype.toString = function () {
1466
- // NOTE: Using Object.keys here as this.edges is very likely
1467
- // to enter 'hash-mode' with many keys being added
1468
- //
1469
- // avoiding a for-in loop here as it leads to the function
1470
- // being de-optimised (at least in V8). From some simple
1471
- // benchmarks the performance is comparable, but allowing
1472
- // V8 to optimize may mean easy performance wins in the future.
1473
-
1474
- if (this._str) {
1475
- return this._str
1476
- }
1477
-
1478
- var str = this.final ? '1' : '0',
1479
- labels = Object.keys(this.edges).sort(),
1480
- len = labels.length
1481
-
1482
- for (var i = 0; i < len; i++) {
1483
- var label = labels[i],
1484
- node = this.edges[label]
1485
-
1486
- str = str + label + node.id
1487
- }
1488
-
1489
- return str
1490
- }
1491
-
1492
- /**
1493
- * Returns a new TokenSet that is the intersection of
1494
- * this TokenSet and the passed TokenSet.
1495
- *
1496
- * This intersection will take into account any wildcards
1497
- * contained within the TokenSet.
1498
- *
1499
- * @param {lunr.TokenSet} b - An other TokenSet to intersect with.
1500
- * @returns {lunr.TokenSet}
1501
- */
1502
- lunr.TokenSet.prototype.intersect = function (b) {
1503
- var output = new lunr.TokenSet,
1504
- frame = undefined
1505
-
1506
- var stack = [{
1507
- qNode: b,
1508
- output: output,
1509
- node: this
1510
- }]
1511
-
1512
- while (stack.length) {
1513
- frame = stack.pop()
1514
-
1515
- // NOTE: As with the #toString method, we are using
1516
- // Object.keys and a for loop instead of a for-in loop
1517
- // as both of these objects enter 'hash' mode, causing
1518
- // the function to be de-optimised in V8
1519
- var qEdges = Object.keys(frame.qNode.edges),
1520
- qLen = qEdges.length,
1521
- nEdges = Object.keys(frame.node.edges),
1522
- nLen = nEdges.length
1523
-
1524
- for (var q = 0; q < qLen; q++) {
1525
- var qEdge = qEdges[q]
1526
-
1527
- for (var n = 0; n < nLen; n++) {
1528
- var nEdge = nEdges[n]
1529
-
1530
- if (nEdge == qEdge || qEdge == '*') {
1531
- var node = frame.node.edges[nEdge],
1532
- qNode = frame.qNode.edges[qEdge],
1533
- final = node.final && qNode.final,
1534
- next = undefined
1535
-
1536
- if (nEdge in frame.output.edges) {
1537
- // an edge already exists for this character
1538
- // no need to create a new node, just set the finality
1539
- // bit unless this node is already final
1540
- next = frame.output.edges[nEdge]
1541
- next.final = next.final || final
1542
-
1543
- } else {
1544
- // no edge exists yet, must create one
1545
- // set the finality bit and insert it
1546
- // into the output
1547
- next = new lunr.TokenSet
1548
- next.final = final
1549
- frame.output.edges[nEdge] = next
1550
- }
1551
-
1552
- stack.push({
1553
- qNode: qNode,
1554
- output: next,
1555
- node: node
1556
- })
1557
- }
1558
- }
1559
- }
1560
- }
1561
-
1562
- return output
1563
- }
1564
- lunr.TokenSet.Builder = function () {
1565
- this.previousWord = ""
1566
- this.root = new lunr.TokenSet
1567
- this.uncheckedNodes = []
1568
- this.minimizedNodes = {}
1569
- }
1570
-
1571
- lunr.TokenSet.Builder.prototype.insert = function (word) {
1572
- var node,
1573
- commonPrefix = 0
1574
-
1575
- if (word < this.previousWord) {
1576
- throw new Error ("Out of order word insertion")
1577
- }
1578
-
1579
- for (var i = 0; i < word.length && i < this.previousWord.length; i++) {
1580
- if (word[i] != this.previousWord[i]) break
1581
- commonPrefix++
1582
- }
1583
-
1584
- this.minimize(commonPrefix)
1585
-
1586
- if (this.uncheckedNodes.length == 0) {
1587
- node = this.root
1588
- } else {
1589
- node = this.uncheckedNodes[this.uncheckedNodes.length - 1].child
1590
- }
1591
-
1592
- for (var i = commonPrefix; i < word.length; i++) {
1593
- var nextNode = new lunr.TokenSet,
1594
- char = word[i]
1595
-
1596
- node.edges[char] = nextNode
1597
-
1598
- this.uncheckedNodes.push({
1599
- parent: node,
1600
- char: char,
1601
- child: nextNode
1602
- })
1603
-
1604
- node = nextNode
1605
- }
1606
-
1607
- node.final = true
1608
- this.previousWord = word
1609
- }
1610
-
1611
- lunr.TokenSet.Builder.prototype.finish = function () {
1612
- this.minimize(0)
1613
- }
1614
-
1615
- lunr.TokenSet.Builder.prototype.minimize = function (downTo) {
1616
- for (var i = this.uncheckedNodes.length - 1; i >= downTo; i--) {
1617
- var node = this.uncheckedNodes[i],
1618
- childKey = node.child.toString()
1619
-
1620
- if (childKey in this.minimizedNodes) {
1621
- node.parent.edges[node.char] = this.minimizedNodes[childKey]
1622
- } else {
1623
- // Cache the key for this node since
1624
- // we know it can't change anymore
1625
- node.child._str = childKey
1626
-
1627
- this.minimizedNodes[childKey] = node.child
1628
- }
1629
-
1630
- this.uncheckedNodes.pop()
1631
- }
1632
- }
1633
- /*!
1634
- * lunr.Index
1635
- * Copyright (C) 2017 Oliver Nightingale
1636
- */
1637
-
1638
- /**
1639
- * An index contains the built index of all documents and provides a query interface
1640
- * to the index.
1641
- *
1642
- * Usually instances of lunr.Index will not be created using this constructor, instead
1643
- * lunr.Builder should be used to construct new indexes, or lunr.Index.load should be
1644
- * used to load previously built and serialized indexes.
1645
- *
1646
- * @constructor
1647
- * @param {Object} attrs - The attributes of the built search index.
1648
- * @param {Object} attrs.invertedIndex - An index of term/field to document reference.
1649
- * @param {Object<string, lunr.Vector>} attrs.documentVectors - Document vectors keyed by document reference.
1650
- * @param {lunr.TokenSet} attrs.tokenSet - An set of all corpus tokens.
1651
- * @param {string[]} attrs.fields - The names of indexed document fields.
1652
- * @param {lunr.Pipeline} attrs.pipeline - The pipeline to use for search terms.
1653
- */
1654
- lunr.Index = function (attrs) {
1655
- this.invertedIndex = attrs.invertedIndex
1656
- this.fieldVectors = attrs.fieldVectors
1657
- this.tokenSet = attrs.tokenSet
1658
- this.fields = attrs.fields
1659
- this.pipeline = attrs.pipeline
1660
- }
1661
-
1662
- /**
1663
- * A result contains details of a document matching a search query.
1664
- * @typedef {Object} lunr.Index~Result
1665
- * @property {string} ref - The reference of the document this result represents.
1666
- * @property {number} score - A number between 0 and 1 representing how similar this document is to the query.
1667
- * @property {lunr.MatchData} matchData - Contains metadata about this match including which term(s) caused the match.
1668
- */
1669
-
1670
- /**
1671
- * Although lunr provides the ability to create queries using lunr.Query, it also provides a simple
1672
- * query language which itself is parsed into an instance of lunr.Query.
1673
- *
1674
- * For programmatically building queries it is advised to directly use lunr.Query, the query language
1675
- * is best used for human entered text rather than program generated text.
1676
- *
1677
- * At its simplest queries can just be a single term, e.g. `hello`, multiple terms are also supported
1678
- * and will be combined with OR, e.g `hello world` will match documents that contain either 'hello'
1679
- * or 'world', though those that contain both will rank higher in the results.
1680
- *
1681
- * Wildcards can be included in terms to match one or more unspecified characters, these wildcards can
1682
- * be inserted anywhere within the term, and more than one wildcard can exist in a single term. Adding
1683
- * wildcards will increase the number of documents that will be found but can also have a negative
1684
- * impact on query performance, especially with wildcards at the beginning of a term.
1685
- *
1686
- * Terms can be restricted to specific fields, e.g. `title:hello`, only documents with the term
1687
- * hello in the title field will match this query. Using a field not present in the index will lead
1688
- * to an error being thrown.
1689
- *
1690
- * Modifiers can also be added to terms, lunr supports edit distance and boost modifiers on terms. A term
1691
- * boost will make documents matching that term score higher, e.g. `foo^5`. Edit distance is also supported
1692
- * to provide fuzzy matching, e.g. 'hello~2' will match documents with hello with an edit distance of 2.
1693
- * Avoid large values for edit distance to improve query performance.
1694
- *
1695
- * To escape special characters the backslash character '\' can be used, this allows searches to include
1696
- * characters that would normally be considered modifiers, e.g. `foo\~2` will search for a term "foo~2" instead
1697
- * of attempting to apply a boost of 2 to the search term "foo".
1698
- *
1699
- * @typedef {string} lunr.Index~QueryString
1700
- * @example <caption>Simple single term query</caption>
1701
- * hello
1702
- * @example <caption>Multiple term query</caption>
1703
- * hello world
1704
- * @example <caption>term scoped to a field</caption>
1705
- * title:hello
1706
- * @example <caption>term with a boost of 10</caption>
1707
- * hello^10
1708
- * @example <caption>term with an edit distance of 2</caption>
1709
- * hello~2
1710
- */
1711
-
1712
- /**
1713
- * Performs a search against the index using lunr query syntax.
1714
- *
1715
- * Results will be returned sorted by their score, the most relevant results
1716
- * will be returned first.
1717
- *
1718
- * For more programmatic querying use lunr.Index#query.
1719
- *
1720
- * @param {lunr.Index~QueryString} queryString - A string containing a lunr query.
1721
- * @throws {lunr.QueryParseError} If the passed query string cannot be parsed.
1722
- * @returns {lunr.Index~Result[]}
1723
- */
1724
- lunr.Index.prototype.search = function (queryString) {
1725
- return this.query(function (query) {
1726
- var parser = new lunr.QueryParser(queryString, query)
1727
- parser.parse()
1728
- })
1729
- }
1730
-
1731
- /**
1732
- * A query builder callback provides a query object to be used to express
1733
- * the query to perform on the index.
1734
- *
1735
- * @callback lunr.Index~queryBuilder
1736
- * @param {lunr.Query} query - The query object to build up.
1737
- * @this lunr.Query
1738
- */
1739
-
1740
- /**
1741
- * Performs a query against the index using the yielded lunr.Query object.
1742
- *
1743
- * If performing programmatic queries against the index, this method is preferred
1744
- * over lunr.Index#search so as to avoid the additional query parsing overhead.
1745
- *
1746
- * A query object is yielded to the supplied function which should be used to
1747
- * express the query to be run against the index.
1748
- *
1749
- * Note that although this function takes a callback parameter it is _not_ an
1750
- * asynchronous operation, the callback is just yielded a query object to be
1751
- * customized.
1752
- *
1753
- * @param {lunr.Index~queryBuilder} fn - A function that is used to build the query.
1754
- * @returns {lunr.Index~Result[]}
1755
- */
1756
- lunr.Index.prototype.query = function (fn) {
1757
- // for each query clause
1758
- // * process terms
1759
- // * expand terms from token set
1760
- // * find matching documents and metadata
1761
- // * get document vectors
1762
- // * score documents
1763
-
1764
- var query = new lunr.Query(this.fields),
1765
- matchingFields = Object.create(null),
1766
- queryVectors = Object.create(null),
1767
- termFieldCache = Object.create(null)
1768
-
1769
- fn.call(query, query)
1770
-
1771
- for (var i = 0; i < query.clauses.length; i++) {
1772
- /*
1773
- * Unless the pipeline has been disabled for this term, which is
1774
- * the case for terms with wildcards, we need to pass the clause
1775
- * term through the search pipeline. A pipeline returns an array
1776
- * of processed terms. Pipeline functions may expand the passed
1777
- * term, which means we may end up performing multiple index lookups
1778
- * for a single query term.
1779
- */
1780
- var clause = query.clauses[i],
1781
- terms = null
1782
-
1783
- if (clause.usePipeline) {
1784
- terms = this.pipeline.runString(clause.term)
1785
- } else {
1786
- terms = [clause.term]
1787
- }
1788
-
1789
- for (var m = 0; m < terms.length; m++) {
1790
- var term = terms[m]
1791
-
1792
- /*
1793
- * Each term returned from the pipeline needs to use the same query
1794
- * clause object, e.g. the same boost and or edit distance. The
1795
- * simplest way to do this is to re-use the clause object but mutate
1796
- * its term property.
1797
- */
1798
- clause.term = term
1799
-
1800
- /*
1801
- * From the term in the clause we create a token set which will then
1802
- * be used to intersect the indexes token set to get a list of terms
1803
- * to lookup in the inverted index
1804
- */
1805
- var termTokenSet = lunr.TokenSet.fromClause(clause),
1806
- expandedTerms = this.tokenSet.intersect(termTokenSet).toArray()
1807
-
1808
- for (var j = 0; j < expandedTerms.length; j++) {
1809
- /*
1810
- * For each term get the posting and termIndex, this is required for
1811
- * building the query vector.
1812
- */
1813
- var expandedTerm = expandedTerms[j],
1814
- posting = this.invertedIndex[expandedTerm],
1815
- termIndex = posting._index
1816
-
1817
- for (var k = 0; k < clause.fields.length; k++) {
1818
- /*
1819
- * For each field that this query term is scoped by (by default
1820
- * all fields are in scope) we need to get all the document refs
1821
- * that have this term in that field.
1822
- *
1823
- * The posting is the entry in the invertedIndex for the matching
1824
- * term from above.
1825
- */
1826
- var field = clause.fields[k],
1827
- fieldPosting = posting[field],
1828
- matchingDocumentRefs = Object.keys(fieldPosting),
1829
- termField = expandedTerm + "/" + field
1830
-
1831
- /*
1832
- * To support field level boosts a query vector is created per
1833
- * field. This vector is populated using the termIndex found for
1834
- * the term and a unit value with the appropriate boost applied.
1835
- *
1836
- * If the query vector for this field does not exist yet it needs
1837
- * to be created.
1838
- */
1839
- if (queryVectors[field] === undefined) {
1840
- queryVectors[field] = new lunr.Vector
1841
- }
1842
-
1843
- /*
1844
- * Using upsert because there could already be an entry in the vector
1845
- * for the term we are working with. In that case we just add the scores
1846
- * together.
1847
- */
1848
- queryVectors[field].upsert(termIndex, 1 * clause.boost, function (a, b) { return a + b })
1849
-
1850
- /**
1851
- * If we've already seen this term, field combo then we've already collected
1852
- * the matching documents and metadata, no need to go through all that again
1853
- */
1854
- if (termFieldCache[termField]) {
1855
- continue
1856
- }
1857
-
1858
- for (var l = 0; l < matchingDocumentRefs.length; l++) {
1859
- /*
1860
- * All metadata for this term/field/document triple
1861
- * are then extracted and collected into an instance
1862
- * of lunr.MatchData ready to be returned in the query
1863
- * results
1864
- */
1865
- var matchingDocumentRef = matchingDocumentRefs[l],
1866
- matchingFieldRef = new lunr.FieldRef (matchingDocumentRef, field),
1867
- metadata = fieldPosting[matchingDocumentRef],
1868
- fieldMatch
1869
-
1870
- if ((fieldMatch = matchingFields[matchingFieldRef]) === undefined) {
1871
- matchingFields[matchingFieldRef] = new lunr.MatchData (expandedTerm, field, metadata)
1872
- } else {
1873
- fieldMatch.add(expandedTerm, field, metadata)
1874
- }
1875
-
1876
- }
1877
-
1878
- termFieldCache[termField] = true
1879
- }
1880
- }
1881
- }
1882
- }
1883
-
1884
- var matchingFieldRefs = Object.keys(matchingFields),
1885
- results = [],
1886
- matches = Object.create(null)
1887
-
1888
- for (var i = 0; i < matchingFieldRefs.length; i++) {
1889
- /*
1890
- * Currently we have document fields that match the query, but we
1891
- * need to return documents. The matchData and scores are combined
1892
- * from multiple fields belonging to the same document.
1893
- *
1894
- * Scores are calculated by field, using the query vectors created
1895
- * above, and combined into a final document score using addition.
1896
- */
1897
- var fieldRef = lunr.FieldRef.fromString(matchingFieldRefs[i]),
1898
- docRef = fieldRef.docRef,
1899
- fieldVector = this.fieldVectors[fieldRef],
1900
- score = queryVectors[fieldRef.fieldName].similarity(fieldVector),
1901
- docMatch
1902
-
1903
- if ((docMatch = matches[docRef]) !== undefined) {
1904
- docMatch.score += score
1905
- docMatch.matchData.combine(matchingFields[fieldRef])
1906
- } else {
1907
- var match = {
1908
- ref: docRef,
1909
- score: score,
1910
- matchData: matchingFields[fieldRef]
1911
- }
1912
- matches[docRef] = match
1913
- results.push(match)
1914
- }
1915
- }
1916
-
1917
- /*
1918
- * Sort the results objects by score, highest first.
1919
- */
1920
- return results.sort(function (a, b) {
1921
- return b.score - a.score
1922
- })
1923
- }
1924
-
1925
- /**
1926
- * Prepares the index for JSON serialization.
1927
- *
1928
- * The schema for this JSON blob will be described in a
1929
- * separate JSON schema file.
1930
- *
1931
- * @returns {Object}
1932
- */
1933
- lunr.Index.prototype.toJSON = function () {
1934
- var invertedIndex = Object.keys(this.invertedIndex)
1935
- .sort()
1936
- .map(function (term) {
1937
- return [term, this.invertedIndex[term]]
1938
- }, this)
1939
-
1940
- var fieldVectors = Object.keys(this.fieldVectors)
1941
- .map(function (ref) {
1942
- return [ref, this.fieldVectors[ref].toJSON()]
1943
- }, this)
1944
-
1945
- return {
1946
- version: lunr.version,
1947
- fields: this.fields,
1948
- fieldVectors: fieldVectors,
1949
- invertedIndex: invertedIndex,
1950
- pipeline: this.pipeline.toJSON()
1951
- }
1952
- }
1953
-
1954
- /**
1955
- * Loads a previously serialized lunr.Index
1956
- *
1957
- * @param {Object} serializedIndex - A previously serialized lunr.Index
1958
- * @returns {lunr.Index}
1959
- */
1960
- lunr.Index.load = function (serializedIndex) {
1961
- var attrs = {},
1962
- fieldVectors = {},
1963
- serializedVectors = serializedIndex.fieldVectors,
1964
- invertedIndex = {},
1965
- serializedInvertedIndex = serializedIndex.invertedIndex,
1966
- tokenSetBuilder = new lunr.TokenSet.Builder,
1967
- pipeline = lunr.Pipeline.load(serializedIndex.pipeline)
1968
-
1969
- if (serializedIndex.version != lunr.version) {
1970
- lunr.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'")
1971
- }
1972
-
1973
- for (var i = 0; i < serializedVectors.length; i++) {
1974
- var tuple = serializedVectors[i],
1975
- ref = tuple[0],
1976
- elements = tuple[1]
1977
-
1978
- fieldVectors[ref] = new lunr.Vector(elements)
1979
- }
1980
-
1981
- for (var i = 0; i < serializedInvertedIndex.length; i++) {
1982
- var tuple = serializedInvertedIndex[i],
1983
- term = tuple[0],
1984
- posting = tuple[1]
1985
-
1986
- tokenSetBuilder.insert(term)
1987
- invertedIndex[term] = posting
1988
- }
1989
-
1990
- tokenSetBuilder.finish()
1991
-
1992
- attrs.fields = serializedIndex.fields
1993
-
1994
- attrs.fieldVectors = fieldVectors
1995
- attrs.invertedIndex = invertedIndex
1996
- attrs.tokenSet = tokenSetBuilder.root
1997
- attrs.pipeline = pipeline
1998
-
1999
- return new lunr.Index(attrs)
2000
- }
2001
- /*!
2002
- * lunr.Builder
2003
- * Copyright (C) 2017 Oliver Nightingale
2004
- */
2005
-
2006
- /**
2007
- * lunr.Builder performs indexing on a set of documents and
2008
- * returns instances of lunr.Index ready for querying.
2009
- *
2010
- * All configuration of the index is done via the builder, the
2011
- * fields to index, the document reference, the text processing
2012
- * pipeline and document scoring parameters are all set on the
2013
- * builder before indexing.
2014
- *
2015
- * @constructor
2016
- * @property {string} _ref - Internal reference to the document reference field.
2017
- * @property {string[]} _fields - Internal reference to the document fields to index.
2018
- * @property {object} invertedIndex - The inverted index maps terms to document fields.
2019
- * @property {object} documentTermFrequencies - Keeps track of document term frequencies.
2020
- * @property {object} documentLengths - Keeps track of the length of documents added to the index.
2021
- * @property {lunr.tokenizer} tokenizer - Function for splitting strings into tokens for indexing.
2022
- * @property {lunr.Pipeline} pipeline - The pipeline performs text processing on tokens before indexing.
2023
- * @property {lunr.Pipeline} searchPipeline - A pipeline for processing search terms before querying the index.
2024
- * @property {number} documentCount - Keeps track of the total number of documents indexed.
2025
- * @property {number} _b - A parameter to control field length normalization, setting this to 0 disabled normalization, 1 fully normalizes field lengths, the default value is 0.75.
2026
- * @property {number} _k1 - A parameter to control how quickly an increase in term frequency results in term frequency saturation, the default value is 1.2.
2027
- * @property {number} termIndex - A counter incremented for each unique term, used to identify a terms position in the vector space.
2028
- * @property {array} metadataWhitelist - A list of metadata keys that have been whitelisted for entry in the index.
2029
- */
2030
- lunr.Builder = function () {
2031
- this._ref = "id"
2032
- this._fields = []
2033
- this.invertedIndex = Object.create(null)
2034
- this.fieldTermFrequencies = {}
2035
- this.fieldLengths = {}
2036
- this.tokenizer = lunr.tokenizer
2037
- this.pipeline = new lunr.Pipeline
2038
- this.searchPipeline = new lunr.Pipeline
2039
- this.documentCount = 0
2040
- this._b = 0.75
2041
- this._k1 = 1.2
2042
- this.termIndex = 0
2043
- this.metadataWhitelist = []
2044
- }
2045
-
2046
- /**
2047
- * Sets the document field used as the document reference. Every document must have this field.
2048
- * The type of this field in the document should be a string, if it is not a string it will be
2049
- * coerced into a string by calling toString.
2050
- *
2051
- * The default ref is 'id'.
2052
- *
2053
- * The ref should _not_ be changed during indexing, it should be set before any documents are
2054
- * added to the index. Changing it during indexing can lead to inconsistent results.
2055
- *
2056
- * @param {string} ref - The name of the reference field in the document.
2057
- */
2058
- lunr.Builder.prototype.ref = function (ref) {
2059
- this._ref = ref
2060
- }
2061
-
2062
- /**
2063
- * Adds a field to the list of document fields that will be indexed. Every document being
2064
- * indexed should have this field. Null values for this field in indexed documents will
2065
- * not cause errors but will limit the chance of that document being retrieved by searches.
2066
- *
2067
- * All fields should be added before adding documents to the index. Adding fields after
2068
- * a document has been indexed will have no effect on already indexed documents.
2069
- *
2070
- * @param {string} field - The name of a field to index in all documents.
2071
- */
2072
- lunr.Builder.prototype.field = function (field) {
2073
- this._fields.push(field)
2074
- }
2075
-
2076
- /**
2077
- * A parameter to tune the amount of field length normalisation that is applied when
2078
- * calculating relevance scores. A value of 0 will completely disable any normalisation
2079
- * and a value of 1 will fully normalise field lengths. The default is 0.75. Values of b
2080
- * will be clamped to the range 0 - 1.
2081
- *
2082
- * @param {number} number - The value to set for this tuning parameter.
2083
- */
2084
- lunr.Builder.prototype.b = function (number) {
2085
- if (number < 0) {
2086
- this._b = 0
2087
- } else if (number > 1) {
2088
- this._b = 1
2089
- } else {
2090
- this._b = number
2091
- }
2092
- }
2093
-
2094
- /**
2095
- * A parameter that controls the speed at which a rise in term frequency results in term
2096
- * frequency saturation. The default value is 1.2. Setting this to a higher value will give
2097
- * slower saturation levels, a lower value will result in quicker saturation.
2098
- *
2099
- * @param {number} number - The value to set for this tuning parameter.
2100
- */
2101
- lunr.Builder.prototype.k1 = function (number) {
2102
- this._k1 = number
2103
- }
2104
-
2105
- /**
2106
- * Adds a document to the index.
2107
- *
2108
- * Before adding fields to the index the index should have been fully setup, with the document
2109
- * ref and all fields to index already having been specified.
2110
- *
2111
- * The document must have a field name as specified by the ref (by default this is 'id') and
2112
- * it should have all fields defined for indexing, though null or undefined values will not
2113
- * cause errors.
2114
- *
2115
- * @param {object} doc - The document to add to the index.
2116
- */
2117
- lunr.Builder.prototype.add = function (doc) {
2118
- var docRef = doc[this._ref]
2119
-
2120
- this.documentCount += 1
2121
-
2122
- for (var i = 0; i < this._fields.length; i++) {
2123
- var fieldName = this._fields[i],
2124
- field = doc[fieldName],
2125
- tokens = this.tokenizer(field),
2126
- terms = this.pipeline.run(tokens),
2127
- fieldRef = new lunr.FieldRef (docRef, fieldName),
2128
- fieldTerms = Object.create(null)
2129
-
2130
- this.fieldTermFrequencies[fieldRef] = fieldTerms
2131
- this.fieldLengths[fieldRef] = 0
2132
-
2133
- // store the length of this field for this document
2134
- this.fieldLengths[fieldRef] += terms.length
2135
-
2136
- // calculate term frequencies for this field
2137
- for (var j = 0; j < terms.length; j++) {
2138
- var term = terms[j]
2139
-
2140
- if (fieldTerms[term] == undefined) {
2141
- fieldTerms[term] = 0
2142
- }
2143
-
2144
- fieldTerms[term] += 1
2145
-
2146
- // add to inverted index
2147
- // create an initial posting if one doesn't exist
2148
- if (this.invertedIndex[term] == undefined) {
2149
- var posting = Object.create(null)
2150
- posting["_index"] = this.termIndex
2151
- this.termIndex += 1
2152
-
2153
- for (var k = 0; k < this._fields.length; k++) {
2154
- posting[this._fields[k]] = Object.create(null)
2155
- }
2156
-
2157
- this.invertedIndex[term] = posting
2158
- }
2159
-
2160
- // add an entry for this term/fieldName/docRef to the invertedIndex
2161
- if (this.invertedIndex[term][fieldName][docRef] == undefined) {
2162
- this.invertedIndex[term][fieldName][docRef] = Object.create(null)
2163
- }
2164
-
2165
- // store all whitelisted metadata about this token in the
2166
- // inverted index
2167
- for (var l = 0; l < this.metadataWhitelist.length; l++) {
2168
- var metadataKey = this.metadataWhitelist[l],
2169
- metadata = term.metadata[metadataKey]
2170
-
2171
- if (this.invertedIndex[term][fieldName][docRef][metadataKey] == undefined) {
2172
- this.invertedIndex[term][fieldName][docRef][metadataKey] = []
2173
- }
2174
-
2175
- this.invertedIndex[term][fieldName][docRef][metadataKey].push(metadata)
2176
- }
2177
- }
2178
-
2179
- }
2180
- }
2181
-
2182
- /**
2183
- * Calculates the average document length for this index
2184
- *
2185
- * @private
2186
- */
2187
- lunr.Builder.prototype.calculateAverageFieldLengths = function () {
2188
-
2189
- var fieldRefs = Object.keys(this.fieldLengths),
2190
- numberOfFields = fieldRefs.length,
2191
- accumulator = {},
2192
- documentsWithField = {}
2193
-
2194
- for (var i = 0; i < numberOfFields; i++) {
2195
- var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),
2196
- field = fieldRef.fieldName
2197
-
2198
- documentsWithField[field] || (documentsWithField[field] = 0)
2199
- documentsWithField[field] += 1
2200
-
2201
- accumulator[field] || (accumulator[field] = 0)
2202
- accumulator[field] += this.fieldLengths[fieldRef]
2203
- }
2204
-
2205
- for (var i = 0; i < this._fields.length; i++) {
2206
- var field = this._fields[i]
2207
- accumulator[field] = accumulator[field] / documentsWithField[field]
2208
- }
2209
-
2210
- this.averageFieldLength = accumulator
2211
- }
2212
-
2213
- /**
2214
- * Builds a vector space model of every document using lunr.Vector
2215
- *
2216
- * @private
2217
- */
2218
- lunr.Builder.prototype.createFieldVectors = function () {
2219
- var fieldVectors = {},
2220
- fieldRefs = Object.keys(this.fieldTermFrequencies),
2221
- fieldRefsLength = fieldRefs.length,
2222
- termIdfCache = Object.create(null)
2223
-
2224
- for (var i = 0; i < fieldRefsLength; i++) {
2225
- var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),
2226
- field = fieldRef.fieldName,
2227
- fieldLength = this.fieldLengths[fieldRef],
2228
- fieldVector = new lunr.Vector,
2229
- termFrequencies = this.fieldTermFrequencies[fieldRef],
2230
- terms = Object.keys(termFrequencies),
2231
- termsLength = terms.length
2232
-
2233
- for (var j = 0; j < termsLength; j++) {
2234
- var term = terms[j],
2235
- tf = termFrequencies[term],
2236
- termIndex = this.invertedIndex[term]._index,
2237
- idf, score, scoreWithPrecision
2238
-
2239
- if (termIdfCache[term] === undefined) {
2240
- idf = lunr.idf(this.invertedIndex[term], this.documentCount)
2241
- termIdfCache[term] = idf
2242
- } else {
2243
- idf = termIdfCache[term]
2244
- }
2245
-
2246
- score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (fieldLength / this.averageFieldLength[field])) + tf)
2247
- scoreWithPrecision = Math.round(score * 1000) / 1000
2248
- // Converts 1.23456789 to 1.234.
2249
- // Reducing the precision so that the vectors take up less
2250
- // space when serialised. Doing it now so that they behave
2251
- // the same before and after serialisation. Also, this is
2252
- // the fastest approach to reducing a number's precision in
2253
- // JavaScript.
2254
-
2255
- fieldVector.insert(termIndex, scoreWithPrecision)
2256
- }
2257
-
2258
- fieldVectors[fieldRef] = fieldVector
2259
- }
2260
-
2261
- this.fieldVectors = fieldVectors
2262
- }
2263
-
2264
- /**
2265
- * Creates a token set of all tokens in the index using lunr.TokenSet
2266
- *
2267
- * @private
2268
- */
2269
- lunr.Builder.prototype.createTokenSet = function () {
2270
- this.tokenSet = lunr.TokenSet.fromArray(
2271
- Object.keys(this.invertedIndex).sort()
2272
- )
2273
- }
2274
-
2275
- /**
2276
- * Builds the index, creating an instance of lunr.Index.
2277
- *
2278
- * This completes the indexing process and should only be called
2279
- * once all documents have been added to the index.
2280
- *
2281
- * @returns {lunr.Index}
2282
- */
2283
- lunr.Builder.prototype.build = function () {
2284
- this.calculateAverageFieldLengths()
2285
- this.createFieldVectors()
2286
- this.createTokenSet()
2287
-
2288
- return new lunr.Index({
2289
- invertedIndex: this.invertedIndex,
2290
- fieldVectors: this.fieldVectors,
2291
- tokenSet: this.tokenSet,
2292
- fields: this._fields,
2293
- pipeline: this.searchPipeline
2294
- })
2295
- }
2296
-
2297
- /**
2298
- * Applies a plugin to the index builder.
2299
- *
2300
- * A plugin is a function that is called with the index builder as its context.
2301
- * Plugins can be used to customise or extend the behaviour of the index
2302
- * in some way. A plugin is just a function, that encapsulated the custom
2303
- * behaviour that should be applied when building the index.
2304
- *
2305
- * The plugin function will be called with the index builder as its argument, additional
2306
- * arguments can also be passed when calling use. The function will be called
2307
- * with the index builder as its context.
2308
- *
2309
- * @param {Function} plugin The plugin to apply.
2310
- */
2311
- lunr.Builder.prototype.use = function (fn) {
2312
- var args = Array.prototype.slice.call(arguments, 1)
2313
- args.unshift(this)
2314
- fn.apply(this, args)
2315
- }
2316
- /**
2317
- * Contains and collects metadata about a matching document.
2318
- * A single instance of lunr.MatchData is returned as part of every
2319
- * lunr.Index~Result.
2320
- *
2321
- * @constructor
2322
- * @param {string} term - The term this match data is associated with
2323
- * @param {string} field - The field in which the term was found
2324
- * @param {object} metadata - The metadata recorded about this term in this field
2325
- * @property {object} metadata - A cloned collection of metadata associated with this document.
2326
- * @see {@link lunr.Index~Result}
2327
- */
2328
- lunr.MatchData = function (term, field, metadata) {
2329
- var clonedMetadata = Object.create(null),
2330
- metadataKeys = Object.keys(metadata)
2331
-
2332
- // Cloning the metadata to prevent the original
2333
- // being mutated during match data combination.
2334
- // Metadata is kept in an array within the inverted
2335
- // index so cloning the data can be done with
2336
- // Array#slice
2337
- for (var i = 0; i < metadataKeys.length; i++) {
2338
- var key = metadataKeys[i]
2339
- clonedMetadata[key] = metadata[key].slice()
2340
- }
2341
-
2342
- this.metadata = Object.create(null)
2343
- this.metadata[term] = Object.create(null)
2344
- this.metadata[term][field] = clonedMetadata
2345
- }
2346
-
2347
- /**
2348
- * An instance of lunr.MatchData will be created for every term that matches a
2349
- * document. However only one instance is required in a lunr.Index~Result. This
2350
- * method combines metadata from another instance of lunr.MatchData with this
2351
- * objects metadata.
2352
- *
2353
- * @param {lunr.MatchData} otherMatchData - Another instance of match data to merge with this one.
2354
- * @see {@link lunr.Index~Result}
2355
- */
2356
- lunr.MatchData.prototype.combine = function (otherMatchData) {
2357
- var terms = Object.keys(otherMatchData.metadata)
2358
-
2359
- for (var i = 0; i < terms.length; i++) {
2360
- var term = terms[i],
2361
- fields = Object.keys(otherMatchData.metadata[term])
2362
-
2363
- if (this.metadata[term] == undefined) {
2364
- this.metadata[term] = Object.create(null)
2365
- }
2366
-
2367
- for (var j = 0; j < fields.length; j++) {
2368
- var field = fields[j],
2369
- keys = Object.keys(otherMatchData.metadata[term][field])
2370
-
2371
- if (this.metadata[term][field] == undefined) {
2372
- this.metadata[term][field] = Object.create(null)
2373
- }
2374
-
2375
- for (var k = 0; k < keys.length; k++) {
2376
- var key = keys[k]
2377
-
2378
- if (this.metadata[term][field][key] == undefined) {
2379
- this.metadata[term][field][key] = otherMatchData.metadata[term][field][key]
2380
- } else {
2381
- this.metadata[term][field][key] = this.metadata[term][field][key].concat(otherMatchData.metadata[term][field][key])
2382
- }
2383
-
2384
- }
2385
- }
2386
- }
2387
- }
2388
-
2389
- /**
2390
- * Add metadata for a term/field pair to this instance of match data.
2391
- *
2392
- * @param {string} term - The term this match data is associated with
2393
- * @param {string} field - The field in which the term was found
2394
- * @param {object} metadata - The metadata recorded about this term in this field
2395
- */
2396
- lunr.MatchData.prototype.add = function (term, field, metadata) {
2397
- if (!(term in this.metadata)) {
2398
- this.metadata[term] = Object.create(null)
2399
- this.metadata[term][field] = metadata
2400
- return
2401
- }
2402
-
2403
- if (!(field in this.metadata[term])) {
2404
- this.metadata[term][field] = metadata
2405
- return
2406
- }
2407
-
2408
- var metadataKeys = Object.keys(metadata)
2409
-
2410
- for (var i = 0; i < metadataKeys.length; i++) {
2411
- var key = metadataKeys[i]
2412
-
2413
- if (key in this.metadata[term][field]) {
2414
- this.metadata[term][field][key] = this.metadata[term][field][key].concat(metadata[key])
2415
- } else {
2416
- this.metadata[term][field][key] = metadata[key]
2417
- }
2418
- }
2419
- }
2420
- /**
2421
- * A lunr.Query provides a programmatic way of defining queries to be performed
2422
- * against a {@link lunr.Index}.
2423
- *
2424
- * Prefer constructing a lunr.Query using the {@link lunr.Index#query} method
2425
- * so the query object is pre-initialized with the right index fields.
2426
- *
2427
- * @constructor
2428
- * @property {lunr.Query~Clause[]} clauses - An array of query clauses.
2429
- * @property {string[]} allFields - An array of all available fields in a lunr.Index.
2430
- */
2431
- lunr.Query = function (allFields) {
2432
- this.clauses = []
2433
- this.allFields = allFields
2434
- }
2435
-
2436
- /**
2437
- * Constants for indicating what kind of automatic wildcard insertion will be used when constructing a query clause.
2438
- *
2439
- * This allows wildcards to be added to the beginning and end of a term without having to manually do any string
2440
- * concatenation.
2441
- *
2442
- * The wildcard constants can be bitwise combined to select both leading and trailing wildcards.
2443
- *
2444
- * @constant
2445
- * @default
2446
- * @property {number} wildcard.NONE - The term will have no wildcards inserted, this is the default behaviour
2447
- * @property {number} wildcard.LEADING - Prepend the term with a wildcard, unless a leading wildcard already exists
2448
- * @property {number} wildcard.TRAILING - Append a wildcard to the term, unless a trailing wildcard already exists
2449
- * @see lunr.Query~Clause
2450
- * @see lunr.Query#clause
2451
- * @see lunr.Query#term
2452
- * @example <caption>query term with trailing wildcard</caption>
2453
- * query.term('foo', { wildcard: lunr.Query.wildcard.TRAILING })
2454
- * @example <caption>query term with leading and trailing wildcard</caption>
2455
- * query.term('foo', {
2456
- * wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING
2457
- * })
2458
- */
2459
- lunr.Query.wildcard = new String ("*")
2460
- lunr.Query.wildcard.NONE = 0
2461
- lunr.Query.wildcard.LEADING = 1
2462
- lunr.Query.wildcard.TRAILING = 2
2463
-
2464
- /**
2465
- * A single clause in a {@link lunr.Query} contains a term and details on how to
2466
- * match that term against a {@link lunr.Index}.
2467
- *
2468
- * @typedef {Object} lunr.Query~Clause
2469
- * @property {string[]} fields - The fields in an index this clause should be matched against.
2470
- * @property {number} [boost=1] - Any boost that should be applied when matching this clause.
2471
- * @property {number} [editDistance] - Whether the term should have fuzzy matching applied, and how fuzzy the match should be.
2472
- * @property {boolean} [usePipeline] - Whether the term should be passed through the search pipeline.
2473
- * @property {number} [wildcard=0] - Whether the term should have wildcards appended or prepended.
2474
- */
2475
-
2476
- /**
2477
- * Adds a {@link lunr.Query~Clause} to this query.
2478
- *
2479
- * Unless the clause contains the fields to be matched all fields will be matched. In addition
2480
- * a default boost of 1 is applied to the clause.
2481
- *
2482
- * @param {lunr.Query~Clause} clause - The clause to add to this query.
2483
- * @see lunr.Query~Clause
2484
- * @returns {lunr.Query}
2485
- */
2486
- lunr.Query.prototype.clause = function (clause) {
2487
- if (!('fields' in clause)) {
2488
- clause.fields = this.allFields
2489
- }
2490
-
2491
- if (!('boost' in clause)) {
2492
- clause.boost = 1
2493
- }
2494
-
2495
- if (!('usePipeline' in clause)) {
2496
- clause.usePipeline = true
2497
- }
2498
-
2499
- if (!('wildcard' in clause)) {
2500
- clause.wildcard = lunr.Query.wildcard.NONE
2501
- }
2502
-
2503
- if ((clause.wildcard & lunr.Query.wildcard.LEADING) && (clause.term.charAt(0) != lunr.Query.wildcard)) {
2504
- clause.term = "*" + clause.term
2505
- }
2506
-
2507
- if ((clause.wildcard & lunr.Query.wildcard.TRAILING) && (clause.term.slice(-1) != lunr.Query.wildcard)) {
2508
- clause.term = "" + clause.term + "*"
2509
- }
2510
-
2511
- this.clauses.push(clause)
2512
-
2513
- return this
2514
- }
2515
-
2516
- /**
2517
- * Adds a term to the current query, under the covers this will create a {@link lunr.Query~Clause}
2518
- * to the list of clauses that make up this query.
2519
- *
2520
- * @param {string} term - The term to add to the query.
2521
- * @param {Object} [options] - Any additional properties to add to the query clause.
2522
- * @returns {lunr.Query}
2523
- * @see lunr.Query#clause
2524
- * @see lunr.Query~Clause
2525
- * @example <caption>adding a single term to a query</caption>
2526
- * query.term("foo")
2527
- * @example <caption>adding a single term to a query and specifying search fields, term boost and automatic trailing wildcard</caption>
2528
- * query.term("foo", {
2529
- * fields: ["title"],
2530
- * boost: 10,
2531
- * wildcard: lunr.Query.wildcard.TRAILING
2532
- * })
2533
- */
2534
- lunr.Query.prototype.term = function (term, options) {
2535
- var clause = options || {}
2536
- clause.term = term
2537
-
2538
- this.clause(clause)
2539
-
2540
- return this
2541
- }
2542
- lunr.QueryParseError = function (message, start, end) {
2543
- this.name = "QueryParseError"
2544
- this.message = message
2545
- this.start = start
2546
- this.end = end
2547
- }
2548
-
2549
- lunr.QueryParseError.prototype = new Error
2550
- lunr.QueryLexer = function (str) {
2551
- this.lexemes = []
2552
- this.str = str
2553
- this.length = str.length
2554
- this.pos = 0
2555
- this.start = 0
2556
- this.escapeCharPositions = []
2557
- }
2558
-
2559
- lunr.QueryLexer.prototype.run = function () {
2560
- var state = lunr.QueryLexer.lexText
2561
-
2562
- while (state) {
2563
- state = state(this)
2564
- }
2565
- }
2566
-
2567
- lunr.QueryLexer.prototype.sliceString = function () {
2568
- var subSlices = [],
2569
- sliceStart = this.start,
2570
- sliceEnd = this.pos
2571
-
2572
- for (var i = 0; i < this.escapeCharPositions.length; i++) {
2573
- sliceEnd = this.escapeCharPositions[i]
2574
- subSlices.push(this.str.slice(sliceStart, sliceEnd))
2575
- sliceStart = sliceEnd + 1
2576
- }
2577
-
2578
- subSlices.push(this.str.slice(sliceStart, this.pos))
2579
- this.escapeCharPositions.length = 0
2580
-
2581
- return subSlices.join('')
2582
- }
2583
-
2584
- lunr.QueryLexer.prototype.emit = function (type) {
2585
- this.lexemes.push({
2586
- type: type,
2587
- str: this.sliceString(),
2588
- start: this.start,
2589
- end: this.pos
2590
- })
2591
-
2592
- this.start = this.pos
2593
- }
2594
-
2595
- lunr.QueryLexer.prototype.escapeCharacter = function () {
2596
- this.escapeCharPositions.push(this.pos - 1)
2597
- this.pos += 1
2598
- }
2599
-
2600
- lunr.QueryLexer.prototype.next = function () {
2601
- if (this.pos >= this.length) {
2602
- return lunr.QueryLexer.EOS
2603
- }
2604
-
2605
- var char = this.str.charAt(this.pos)
2606
- this.pos += 1
2607
- return char
2608
- }
2609
-
2610
- lunr.QueryLexer.prototype.width = function () {
2611
- return this.pos - this.start
2612
- }
2613
-
2614
- lunr.QueryLexer.prototype.ignore = function () {
2615
- if (this.start == this.pos) {
2616
- this.pos += 1
2617
- }
2618
-
2619
- this.start = this.pos
2620
- }
2621
-
2622
- lunr.QueryLexer.prototype.backup = function () {
2623
- this.pos -= 1
2624
- }
2625
-
2626
- lunr.QueryLexer.prototype.acceptDigitRun = function () {
2627
- var char, charCode
2628
-
2629
- do {
2630
- char = this.next()
2631
- charCode = char.charCodeAt(0)
2632
- } while (charCode > 47 && charCode < 58)
2633
-
2634
- if (char != lunr.QueryLexer.EOS) {
2635
- this.backup()
2636
- }
2637
- }
2638
-
2639
- lunr.QueryLexer.prototype.more = function () {
2640
- return this.pos < this.length
2641
- }
2642
-
2643
- lunr.QueryLexer.EOS = 'EOS'
2644
- lunr.QueryLexer.FIELD = 'FIELD'
2645
- lunr.QueryLexer.TERM = 'TERM'
2646
- lunr.QueryLexer.EDIT_DISTANCE = 'EDIT_DISTANCE'
2647
- lunr.QueryLexer.BOOST = 'BOOST'
2648
-
2649
- lunr.QueryLexer.lexField = function (lexer) {
2650
- lexer.backup()
2651
- lexer.emit(lunr.QueryLexer.FIELD)
2652
- lexer.ignore()
2653
- return lunr.QueryLexer.lexText
2654
- }
2655
-
2656
- lunr.QueryLexer.lexTerm = function (lexer) {
2657
- if (lexer.width() > 1) {
2658
- lexer.backup()
2659
- lexer.emit(lunr.QueryLexer.TERM)
2660
- }
2661
-
2662
- lexer.ignore()
2663
-
2664
- if (lexer.more()) {
2665
- return lunr.QueryLexer.lexText
2666
- }
2667
- }
2668
-
2669
- lunr.QueryLexer.lexEditDistance = function (lexer) {
2670
- lexer.ignore()
2671
- lexer.acceptDigitRun()
2672
- lexer.emit(lunr.QueryLexer.EDIT_DISTANCE)
2673
- return lunr.QueryLexer.lexText
2674
- }
2675
-
2676
- lunr.QueryLexer.lexBoost = function (lexer) {
2677
- lexer.ignore()
2678
- lexer.acceptDigitRun()
2679
- lexer.emit(lunr.QueryLexer.BOOST)
2680
- return lunr.QueryLexer.lexText
2681
- }
2682
-
2683
- lunr.QueryLexer.lexEOS = function (lexer) {
2684
- if (lexer.width() > 0) {
2685
- lexer.emit(lunr.QueryLexer.TERM)
2686
- }
2687
- }
2688
-
2689
- // This matches the separator used when tokenising fields
2690
- // within a document. These should match otherwise it is
2691
- // not possible to search for some tokens within a document.
2692
- //
2693
- // It is possible for the user to change the separator on the
2694
- // tokenizer so it _might_ clash with any other of the special
2695
- // characters already used within the search string, e.g. :.
2696
- //
2697
- // This means that it is possible to change the separator in
2698
- // such a way that makes some words unsearchable using a search
2699
- // string.
2700
- lunr.QueryLexer.termSeparator = lunr.tokenizer.separator
2701
-
2702
- lunr.QueryLexer.lexText = function (lexer) {
2703
- while (true) {
2704
- var char = lexer.next()
2705
-
2706
- if (char == lunr.QueryLexer.EOS) {
2707
- return lunr.QueryLexer.lexEOS
2708
- }
2709
-
2710
- // Escape character is '\'
2711
- if (char.charCodeAt(0) == 92) {
2712
- lexer.escapeCharacter()
2713
- continue
2714
- }
2715
-
2716
- if (char == ":") {
2717
- return lunr.QueryLexer.lexField
2718
- }
2719
-
2720
- if (char == "~") {
2721
- lexer.backup()
2722
- if (lexer.width() > 0) {
2723
- lexer.emit(lunr.QueryLexer.TERM)
2724
- }
2725
- return lunr.QueryLexer.lexEditDistance
2726
- }
2727
-
2728
- if (char == "^") {
2729
- lexer.backup()
2730
- if (lexer.width() > 0) {
2731
- lexer.emit(lunr.QueryLexer.TERM)
2732
- }
2733
- return lunr.QueryLexer.lexBoost
2734
- }
2735
-
2736
- if (char.match(lunr.QueryLexer.termSeparator)) {
2737
- return lunr.QueryLexer.lexTerm
2738
- }
2739
- }
2740
- }
2741
-
2742
- lunr.QueryParser = function (str, query) {
2743
- this.lexer = new lunr.QueryLexer (str)
2744
- this.query = query
2745
- this.currentClause = {}
2746
- this.lexemeIdx = 0
2747
- }
2748
-
2749
- lunr.QueryParser.prototype.parse = function () {
2750
- this.lexer.run()
2751
- this.lexemes = this.lexer.lexemes
2752
-
2753
- var state = lunr.QueryParser.parseFieldOrTerm
2754
-
2755
- while (state) {
2756
- state = state(this)
2757
- }
2758
-
2759
- return this.query
2760
- }
2761
-
2762
- lunr.QueryParser.prototype.peekLexeme = function () {
2763
- return this.lexemes[this.lexemeIdx]
2764
- }
2765
-
2766
- lunr.QueryParser.prototype.consumeLexeme = function () {
2767
- var lexeme = this.peekLexeme()
2768
- this.lexemeIdx += 1
2769
- return lexeme
2770
- }
2771
-
2772
- lunr.QueryParser.prototype.nextClause = function () {
2773
- var completedClause = this.currentClause
2774
- this.query.clause(completedClause)
2775
- this.currentClause = {}
2776
- }
2777
-
2778
- lunr.QueryParser.parseFieldOrTerm = function (parser) {
2779
- var lexeme = parser.peekLexeme()
2780
-
2781
- if (lexeme == undefined) {
2782
- return
2783
- }
2784
-
2785
- switch (lexeme.type) {
2786
- case lunr.QueryLexer.FIELD:
2787
- return lunr.QueryParser.parseField
2788
- case lunr.QueryLexer.TERM:
2789
- return lunr.QueryParser.parseTerm
2790
- default:
2791
- var errorMessage = "expected either a field or a term, found " + lexeme.type
2792
-
2793
- if (lexeme.str.length >= 1) {
2794
- errorMessage += " with value '" + lexeme.str + "'"
2795
- }
2796
-
2797
- throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
2798
- }
2799
- }
2800
-
2801
- lunr.QueryParser.parseField = function (parser) {
2802
- var lexeme = parser.consumeLexeme()
2803
-
2804
- if (lexeme == undefined) {
2805
- return
2806
- }
2807
-
2808
- if (parser.query.allFields.indexOf(lexeme.str) == -1) {
2809
- var possibleFields = parser.query.allFields.map(function (f) { return "'" + f + "'" }).join(', '),
2810
- errorMessage = "unrecognised field '" + lexeme.str + "', possible fields: " + possibleFields
2811
-
2812
- throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
2813
- }
2814
-
2815
- parser.currentClause.fields = [lexeme.str]
2816
-
2817
- var nextLexeme = parser.peekLexeme()
2818
-
2819
- if (nextLexeme == undefined) {
2820
- var errorMessage = "expecting term, found nothing"
2821
- throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
2822
- }
2823
-
2824
- switch (nextLexeme.type) {
2825
- case lunr.QueryLexer.TERM:
2826
- return lunr.QueryParser.parseTerm
2827
- default:
2828
- var errorMessage = "expecting term, found '" + nextLexeme.type + "'"
2829
- throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
2830
- }
2831
- }
2832
-
2833
- lunr.QueryParser.parseTerm = function (parser) {
2834
- var lexeme = parser.consumeLexeme()
2835
-
2836
- if (lexeme == undefined) {
2837
- return
2838
- }
2839
-
2840
- parser.currentClause.term = lexeme.str.toLowerCase()
2841
-
2842
- if (lexeme.str.indexOf("*") != -1) {
2843
- parser.currentClause.usePipeline = false
2844
- }
2845
-
2846
- var nextLexeme = parser.peekLexeme()
2847
-
2848
- if (nextLexeme == undefined) {
2849
- parser.nextClause()
2850
- return
2851
- }
2852
-
2853
- switch (nextLexeme.type) {
2854
- case lunr.QueryLexer.TERM:
2855
- parser.nextClause()
2856
- return lunr.QueryParser.parseTerm
2857
- case lunr.QueryLexer.FIELD:
2858
- parser.nextClause()
2859
- return lunr.QueryParser.parseField
2860
- case lunr.QueryLexer.EDIT_DISTANCE:
2861
- return lunr.QueryParser.parseEditDistance
2862
- case lunr.QueryLexer.BOOST:
2863
- return lunr.QueryParser.parseBoost
2864
- default:
2865
- var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'"
2866
- throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
2867
- }
2868
- }
2869
-
2870
- lunr.QueryParser.parseEditDistance = function (parser) {
2871
- var lexeme = parser.consumeLexeme()
2872
-
2873
- if (lexeme == undefined) {
2874
- return
2875
- }
2876
-
2877
- var editDistance = parseInt(lexeme.str, 10)
2878
-
2879
- if (isNaN(editDistance)) {
2880
- var errorMessage = "edit distance must be numeric"
2881
- throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
2882
- }
2883
-
2884
- parser.currentClause.editDistance = editDistance
2885
-
2886
- var nextLexeme = parser.peekLexeme()
2887
-
2888
- if (nextLexeme == undefined) {
2889
- parser.nextClause()
2890
- return
2891
- }
2892
-
2893
- switch (nextLexeme.type) {
2894
- case lunr.QueryLexer.TERM:
2895
- parser.nextClause()
2896
- return lunr.QueryParser.parseTerm
2897
- case lunr.QueryLexer.FIELD:
2898
- parser.nextClause()
2899
- return lunr.QueryParser.parseField
2900
- case lunr.QueryLexer.EDIT_DISTANCE:
2901
- return lunr.QueryParser.parseEditDistance
2902
- case lunr.QueryLexer.BOOST:
2903
- return lunr.QueryParser.parseBoost
2904
- default:
2905
- var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'"
2906
- throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
2907
- }
2908
- }
2909
-
2910
- lunr.QueryParser.parseBoost = function (parser) {
2911
- var lexeme = parser.consumeLexeme()
2912
-
2913
- if (lexeme == undefined) {
2914
- return
2915
- }
2916
-
2917
- var boost = parseInt(lexeme.str, 10)
2918
-
2919
- if (isNaN(boost)) {
2920
- var errorMessage = "boost must be numeric"
2921
- throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
2922
- }
2923
-
2924
- parser.currentClause.boost = boost
2925
-
2926
- var nextLexeme = parser.peekLexeme()
2927
-
2928
- if (nextLexeme == undefined) {
2929
- parser.nextClause()
2930
- return
2931
- }
2932
-
2933
- switch (nextLexeme.type) {
2934
- case lunr.QueryLexer.TERM:
2935
- parser.nextClause()
2936
- return lunr.QueryParser.parseTerm
2937
- case lunr.QueryLexer.FIELD:
2938
- parser.nextClause()
2939
- return lunr.QueryParser.parseField
2940
- case lunr.QueryLexer.EDIT_DISTANCE:
2941
- return lunr.QueryParser.parseEditDistance
2942
- case lunr.QueryLexer.BOOST:
2943
- return lunr.QueryParser.parseBoost
2944
- default:
2945
- var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'"
2946
- throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
2947
- }
2948
- }
2949
-
2950
- /**
2951
- * export the module via AMD, CommonJS or as a browser global
2952
- * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
2953
- */
2954
- ;(function (root, factory) {
2955
- if (typeof define === 'function' && define.amd) {
2956
- // AMD. Register as an anonymous module.
2957
- define(factory)
2958
- } else if (typeof exports === 'object') {
2959
- /**
2960
- * Node. Does not work with strict CommonJS, but
2961
- * only CommonJS-like enviroments that support module.exports,
2962
- * like Node.
2963
- */
2964
- module.exports = factory()
2965
- } else {
2966
- // Browser globals (root is window)
2967
- root.lunr = factory()
2968
- }
2969
- }(this, function () {
2970
- /**
2971
- * Just return a value to define the module export.
2972
- * This example returns an object, but the module
2973
- * can return a function as the exported value.
2974
- */
2975
- return lunr
2976
- }))
2977
- })();