Merge pull request #266 from squidfunk/fix/search-missing-results

Fixed missing search results when only a h1 is present
This commit is contained in:
Martin Donath
2017-04-08 19:12:00 +02:00
committed by GitHub
6 changed files with 11 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -38,7 +38,7 @@
<script src="{{ base_url }}/assets/javascripts/modernizr-56ade86843.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr-56ade86843.js"></script>
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-b168d32589.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-b1a1975878.css">
{% if config.extra.palette %} {% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-f78e5cb881.palette.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-f78e5cb881.palette.css">
{% endif %} {% endif %}
@@ -150,7 +150,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-4f7a197d35.js"></script> <script src="{{ base_url }}/assets/javascripts/application-0b7df094bf.js"></script>
<script>app.initialize({url:{base:"{{ base_url }}"}})</script> <script>app.initialize({url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>

View File

@@ -179,13 +179,16 @@ export default class Result {
if (doc.parent) { if (doc.parent) {
const ref = doc.parent.location const ref = doc.parent.location
items.set(ref, (items.get(ref) || []).concat(item)) items.set(ref, (items.get(ref) || []).concat(item))
} else {
const ref = doc.location
items.set(ref, (items.get(ref) || []))
} }
return items return items
}, new Map) }, new Map)
/* Assemble highlight regex from query string */ /* Assemble highlight regex from query string */
const match = new RegExp( const match = new RegExp(
`\\b(${escape(this.value_.trim().replace(" ", "|"))})`, "img") `\\b(${escape(this.value_.trim()).replace(" ", "|")})`, "img")
const highlight = string => `<em>${string}</em>` const highlight = string => `<em>${string}</em>`
/* Render results */ /* Render results */

View File

@@ -443,9 +443,9 @@ $md-toggle__search--checked:
} }
} }
// Add a little spacing on the last link // Add a little spacing on the teaser of the last link
&:last-child { &:last-child .md-search-result__teaser {
padding-bottom: 0.8rem; margin-bottom: 1.2rem;
} }
} }