From d8bf02262a7d8d9e897550a0e2a95b4352dab6a5 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 20 Mar 2018 11:51:49 -0400 Subject: [PATCH] Fix search excerpts that run together --- CHANGELOG.md | 1 + assets/javascripts/search-data.json | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2345c02..875bac4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fix Firefox [flexbox bug](https://bugzilla.mozilla.org/show_bug.cgi?id=939897) when printing pages. +- Fix search excerpts that run together because of implied spaces. ## [1.3.1] - 2018-02-16 diff --git a/assets/javascripts/search-data.json b/assets/javascripts/search-data.json index 9e87ff4..fd8e008 100644 --- a/assets/javascripts/search-data.json +++ b/assets/javascripts/search-data.json @@ -14,9 +14,25 @@ var store = [ "title": {{ doc.title | jsonify }}, "excerpt": {%- if site.search_full_content == true -%} - {{ doc.content | strip_html | strip_newlines | jsonify }}, + {{ doc.content | + replace:"

", " " | + replace:"", " " | + replace:"", " " | + replace:"", " " | + replace:"", " " | + replace:"", " " | + replace:"", " "| + strip_html | strip_newlines | jsonify }}, {%- else -%} - {{ doc.content | strip_html | strip_newlines | truncatewords: 50 | jsonify }}, + {{ doc.content | + replace:"

", " " | + replace:"", " " | + replace:"", " " | + replace:"", " " | + replace:"", " " | + replace:"", " " | + replace:"", " "| + strip_html | strip_newlines | truncatewords: 50 | jsonify }}, {%- endif -%} "categories": {{ doc.categories | jsonify }}, "tags": {{ doc.tags | jsonify }},