From d3d17c0460a0d3db037f29c7e2d8bcaeca227398 Mon Sep 17 00:00:00 2001 From: marksie1988 Date: Sat, 27 Jun 2020 10:02:36 +0100 Subject: [PATCH] fix conflicts --- _includes/nav.html | 106 ++++++++++++++++++++++-------------------- lib/tasks/search.rake | 63 +++++++++++++++++++++---- 2 files changed, 109 insertions(+), 60 deletions(-) diff --git a/_includes/nav.html b/_includes/nav.html index e41f79e..8f0b089 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -1,51 +1,55 @@ - + diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake index 163fb03..6b0900e 100644 --- a/lib/tasks/search.rake +++ b/lib/tasks/search.rake @@ -3,23 +3,68 @@ namespace :search do task :init do puts 'Creating search data json file...' mkdir_p 'assets/js' - touch 'assets/js/search-data.json' - content = %Q[{{ page.content | markdownify | replace: '\' -%} + {%- assign title = titleAndContent[0] | replace_first: \'>\', \'

\' | split: \'

\' -%} + {%- assign title = title[1] | strip_html -%} + {%- assign content = titleAndContent[1] -%} + {%- assign url = page.url -%} + {%- if title == page.title and parts[0] == \'\' -%} + {%- assign title_found = true -%} + {%- else -%} + {%- assign id = titleAndContent[0] -%} + {%- assign id = id | split: \'id="\' -%} + {%- if id.size == 2 -%} + {%- assign id = id[1] -%} + {%- assign id = id | split: \'"\' -%} + {%- assign id = id[0] -%} + {%- capture url -%}{{ url | append: \'#\' | append: id }}{%- endcapture -%} + {%- endif -%} + {%- endif -%} + {%- unless i == 0 -%},{%- endunless -%} + "{{ i }}": { + "doc": {{ page.title | jsonify }}, + "title": {{ title | jsonify }}, + "content": {{ content | replace: \'