From 3ee6887c513b5b34c0cc84a5bd2f35219710c49b Mon Sep 17 00:00:00 2001 From: Patrick Marsceill Date: Thu, 8 Jun 2017 14:24:29 -0400 Subject: [PATCH] Add search namespace --- lib/tasks/search.rake | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake index 3b56f3b..95cc5af 100644 --- a/lib/tasks/search.rake +++ b/lib/tasks/search.rake @@ -1,18 +1,20 @@ -task :init do - touch search-data.json +namespace :search do + task :init do + touch search-data.json - File.open('search-data.json', 'w') do |f| - f.puts ' ---- ---- -{ - {% for page in site.html_pages %}"{{ forloop.index0 }}": { - "id": "{{ forloop.index0 }}", - "title": "{{ page.title | xml_escape }}", - "content": "{{ page.content | markdownify | strip_html | xml_escape | remove: "Table of contents" | remove: page.title | strip_newlines | replace: "\", " "}}", - "url": "{{ page.url | xml_escape }}" - }{% if forloop.last %}{% else %}, - {% endif %}{% endfor %} -}' + File.open('search-data.json', 'w') do |f| + f.puts ' + --- + --- + { + {% for page in site.html_pages %}"{{ forloop.index0 }}": { + "id": "{{ forloop.index0 }}", + "title": "{{ page.title | xml_escape }}", + "content": "{{ page.content | markdownify | strip_html | xml_escape | remove: "Table of contents" | remove: page.title | strip_newlines | replace: "\", " "}}", + "url": "{{ page.url | xml_escape }}" + }{% if forloop.last %}{% else %}, + {% endif %}{% endfor %} + }' + end end end