Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/google/docsy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorTakayama Fumihiko <tekezo@pqrs.org>2021-10-04 17:00:17 +0300
committerTakayama Fumihiko <tekezo@pqrs.org>2021-10-04 17:00:17 +0300
commit77b5ecd7ec21392ba8d1beaf936837311c033898 (patch)
treeb9c1281b2de4e262d2e4a905cdb2603d40baa74b /assets
parent170cdd9cd31794eac802b0cec083097155feb81b (diff)
Suppress blank lines from offline-search-index.json output
Diffstat (limited to 'assets')
-rw-r--r--assets/json/offline-search-index.json17
1 files changed, 14 insertions, 3 deletions
diff --git a/assets/json/offline-search-index.json b/assets/json/offline-search-index.json
index b3e21c5..0396a08 100644
--- a/assets/json/offline-search-index.json
+++ b/assets/json/offline-search-index.json
@@ -1,7 +1,18 @@
{{- $.Scratch.Add "offline-search-index" slice -}}
{{- range where .Site.AllPages ".Params.exclude_search" "!=" true -}}
-{{/* We have to apply `htmlUnescape` again after `truncate` because `truncate` applies `html.EscapeString` if the argument is not HTML. */}}
-{{/* Indvidual taxonomies can be added in the next line by add '"taxonomy-name" (.Params.taxonomy-name | default "")' to the dict (as seen for categories and tags). */}}
-{{- $.Scratch.Add "offline-search-index" (dict "ref" .RelPermalink "title" .Title "categories" (.Params.categories | default "") "tags" (.Params.tags | default "") "description" (.Description | default "") "body" (.Plain | htmlUnescape) "excerpt" ((.Description | default .Plain) | htmlUnescape | truncate (.Site.Params.offlineSearchSummaryLength | default 70) | htmlUnescape)) -}}
+{{- /* We have to apply `htmlUnescape` again after `truncate` because `truncate` applies `html.EscapeString` if the argument is not HTML. */ -}}
+{{- /* Indvidual taxonomies can be added in the next line by add '"taxonomy-name" (.Params.taxonomy-name | default "")' to the dict (as seen for categories and tags). */ -}}
+{{- $.Scratch.Add
+ "offline-search-index"
+ (dict
+ "ref" .RelPermalink
+ "title" .Title
+ "categories" (.Params.categories | default "")
+ "tags" (.Params.tags | default "")
+ "description" (.Description | default "")
+ "body" (.Plain | htmlUnescape)
+ "excerpt" ((.Description | default .Plain) | htmlUnescape | truncate (.Site.Params.offlineSearchSummaryLength | default 70) | htmlUnescape)
+ )
+-}}
{{- end -}}
{{- $.Scratch.Get "offline-search-index" | jsonify -}}